This patch introduces two new functions in org-attach.el,
`org-attach-expand', and `org-attach-expand-link'. Both take a file
name as an argument, assume that this file is an attachment of the
current entry, and return the full path to this file or a
"file:..." link to it, respectively.
With these functions, it becomes very easy to use link abbreviations
to create a new link type to attachments:
After
(setq org-link-abbrev-alist '(("att" . org-attach-expand-link)))
links like [[att:file.txt]] will work.
So far, Org used either `fit-window-to-buffer' or
`shrink-window-if-larger-than-buffer' without any further checks when
displaying one of its many help and selection buffers. This can cause
problems if the user has set up Emacs to split windows horizontally
rather than vertically, because the window being shrunken then may be
side-by-side with another window, and shrinking the height of one will
also change the other.
With this patch, shrinking a window always goes through the new
function `org-fit-window-to-buffer' which only acts if the current
window spans the whole width of the frame.
Furthermore, this function also helps with compatibility, because it
falls back to `shrink-window-if-larger-than-buffer' if
`fit-window-to-buffer' does not exist, as is the case on older version
of Emacs and XEmacs.