From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Gustav_Wikstr=F6m?= Subject: Re: Attachments and refiling Date: Mon, 29 Aug 2011 14:04:26 +0200 Message-ID: References: <87ei1rrdzd.fsf@gnu.org> <4e21b345.c74cec0a.7e49.3340@mx.google.com> <87mxg3v32m.fsf@altern.org> <877h76u7l7.fsf@gnu.org> <4e2d91f9.8188ec0a.1582.1369@mx.google.com> <87vcum6d5p.fsf@altern.org> <87bow8bgvg.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0015174757ba55650904aba3b22a Return-path: Received: from eggs.gnu.org ([140.186.70.92]:53587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qy0Zp-0005mW-La for emacs-orgmode@gnu.org; Mon, 29 Aug 2011 08:04:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qy0Zo-0007ba-Be for emacs-orgmode@gnu.org; Mon, 29 Aug 2011 08:04:29 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:39550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qy0Zo-0007bP-19 for emacs-orgmode@gnu.org; Mon, 29 Aug 2011 08:04:28 -0400 Received: by fxg9 with SMTP id 9so5084318fxg.0 for ; Mon, 29 Aug 2011 05:04:26 -0700 (PDT) In-Reply-To: <87bow8bgvg.fsf@fastmail.fm> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Matt Lundin Cc: Bastien , emacs-orgmode@gnu.org --0015174757ba55650904aba3b22a Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks for this. Added it to my settings for now =3D) /Gustav 2011/8/2 Matt Lundin > Gustav Wikstr=F6m 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 > --0015174757ba55650904aba3b22a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks for this. Added it to my settings for now =3D)

/Gustav

2011/8/2 Matt Lundin <mdl@imapmail.org>
Gustav Wikstr=F6m <gustav.erik@gmail.com> writes:=

> However I think it also is nice to also be abl= e to use custom names to
> attachment folders. And it would be nice be able to use some logic wit= h
> this, like automatically setting the folder name to the same as the > heading it's attached to. And to allow properties on a file/headin= g/
> sub-tree=A0basis which defines the base-path to where attachments to t= hat
> particular file/heading/sub-tree=A0should reside on the system, relati= ve
> 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.=A0So from my point of view it seems sound to try to reaso= n
> 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)
=A0"Prompt for attachment directory (thus preempting org-get-id).&quo= t;
=A0(unless (org-entry-get nil "ATTACH_DIR" 'inherit)
=A0 =A0(org-attach-set-directory)))
--8<---------------cut here---------------end---------= ------>8---

This allows one to enter the name of the directory *before* org attac= hes
the file. This is the way I use org-attach, as I prefer human-readable
directories to UUIDs.

Best,
Matt

--0015174757ba55650904aba3b22a--