emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Attachments and refiling


From: Matt Lundin
Subject: Re: [O] Attachments and refiling
Date: Mon, 01 Aug 2011 23:02:27 -0500
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Gustav Wikström <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]