Gustav Wikström <gustav.e...@gmail.com> writes: > However I think it also is nice to also be able to use custom names to > attachment folders. And it would be nice be able to use some logic with > this, like automatically setting the folder name to the same as the > heading it's attached to. And to allow properties on a file/heading/ > sub-tree basis which defines the base-path to where attachments to that > particular file/heading/sub-tree should reside on the system, relative > or non-relative. This would allow for more atomic solutions if i'm > writing a document on the side of my main setup and want to add some > attachments in the same path. > > But still, it is a really nice feature to have control over the > attachments. So from my point of view it seems sound to try to reason > about different solutions to this or at least keep it in mind for > future functionality.
One possibility is to advise the function org-attach-dir to call org-attach-set-directory (and, optionally, org-attach-set-inherit) if the entry does not already have an ATTACH_DIR property: --8<---------------cut here---------------start------------->8--- (defadvice org-attach-dir (before my-org-attach-set-dir-before-attach activate) "Prompt for attachment directory (thus preempting org-get-id)." (unless (org-entry-get nil "ATTACH_DIR" 'inherit) (org-attach-set-directory))) --8<---------------cut here---------------end--------------->8--- This allows one to enter the name of the directory *before* org attaches the file. This is the way I use org-attach, as I prefer human-readable directories to UUIDs. Best, Matt