* Attachments and refiling @ 2011-07-15 11:06 Gustav Wikström 2011-07-15 11:16 ` Bastien 0 siblings, 1 reply; 30+ messages in thread From: Gustav Wikström @ 2011-07-15 11:06 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 120 bytes --] Is it possible to make attachment-folders move with the headings when refiling them to other locations? Regards Gustav [-- Attachment #2: Type: text/html, Size: 138 bytes --] ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-15 11:06 Attachments and refiling Gustav Wikström @ 2011-07-15 11:16 ` Bastien 2011-07-15 14:55 ` Gustav Wikström 0 siblings, 1 reply; 30+ messages in thread From: Bastien @ 2011-07-15 11:16 UTC (permalink / raw) To: Gustav Wikström; +Cc: emacs-orgmode Hi Gustav, Gustav Wikström <gustav.erik@gmail.com> writes: > Is it possible to make attachment-folders move with the headings when > refiling them to other locations? I'm not sure what you mean. Can you give an example? -- Bastien ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-15 11:16 ` Bastien @ 2011-07-15 14:55 ` Gustav Wikström 2011-07-16 15:50 ` Darlan Cavalcante Moreira 0 siblings, 1 reply; 30+ messages in thread From: Gustav Wikström @ 2011-07-15 14:55 UTC (permalink / raw) To: Bastien; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 939 bytes --] Hello Bastien! To clarify a bit. Lets say I have a file c:\temp\agenda.org (I'm calling it file 'a'). When marked with TODO item: done, headings in this file are archived to another file called c:\temp\archive\agenda.org_archive ('b') If i use C-c C-a to attach a file to a certain topic in 'a' and then refile this topic to 'b', when done the attachment still resides in c:\temp\data and will not be found when looking at the attachment in 'b'. Thus my question is if it is possible to also refile the attachment so the attachment-folder resides in c:\temp\archive\data and is avaliable in 'b'? /Gustav 2011/7/15 Bastien <bzg@altern.org> > Hi Gustav, > > Gustav Wikström <gustav.erik@gmail.com> writes: > > > Is it possible to make attachment-folders move with the headings when > > refiling them to other locations? > > I'm not sure what you mean. > > Can you give an example? > > -- > Bastien > [-- Attachment #2: Type: text/html, Size: 1507 bytes --] ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-15 14:55 ` Gustav Wikström @ 2011-07-16 15:50 ` Darlan Cavalcante Moreira 2011-07-19 12:17 ` Gustav Wikström 0 siblings, 1 reply; 30+ messages in thread From: Darlan Cavalcante Moreira @ 2011-07-16 15:50 UTC (permalink / raw) To: Gustav Wikström; +Cc: Bastien, emacs-orgmode I use org-attach regularly and consider it to be a great feature of org-mode. Since I only attach to the sub-tree (instead of to a different file) I have not this problem. However, sometimes a set the attach directory of two different headings to the same folder (when it makes sense) and if org always moved the attached files it would break the other sub-tree. An alternative is to change the attach directory in the archived entry to point to the original attach directory where the files are. When archiving to a file in a different folder org could ask if it should also move the attached files or simply change the attach directory accordingly (I would prefer this as the default if "ask" as the default was considered too annoying). -- Darlan At Fri, 15 Jul 2011 16:55:06 +0200, Gustav Wikström <gustav.erik@gmail.com> wrote: > > [1 <text/plain; ISO-8859-1 (quoted-printable)>] > Hello Bastien! > > To clarify a bit. Lets say I have a file c:\temp\agenda.org (I'm calling it > file 'a'). > > When marked with TODO item: done, headings in this file are archived to > another file called c:\temp\archive\agenda.org_archive ('b') > > If i use C-c C-a to attach a file to a certain topic in 'a' and then refile > this topic to 'b', when done the attachment still resides in c:\temp\data > and will not be found when looking at the attachment in 'b'. > > Thus my question is if it is possible to also refile the attachment so the > attachment-folder resides in c:\temp\archive\data and is avaliable in 'b'? > > /Gustav > > 2011/7/15 Bastien <bzg@altern.org> > > > Hi Gustav, > > > > Gustav Wikström <gustav.erik@gmail.com> writes: > > > > > Is it possible to make attachment-folders move with the headings when > > > refiling them to other locations? > > > > I'm not sure what you mean. > > > > Can you give an example? > > > > -- > > Bastien > > > [2 <text/html; ISO-8859-1 (quoted-printable)>] > ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-16 15:50 ` Darlan Cavalcante Moreira @ 2011-07-19 12:17 ` Gustav Wikström 2011-07-24 20:00 ` Bastien 2011-07-24 20:07 ` Bastien 0 siblings, 2 replies; 30+ messages in thread From: Gustav Wikström @ 2011-07-19 12:17 UTC (permalink / raw) To: Darlan Cavalcante Moreira; +Cc: Bastien, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 2541 bytes --] Ok. I would really like attachments to be integrated with refiling though even if it was a non-default option. Another feature that could improve the use of attachments is to allow links to the attached folders also via the C-c C-l interface in a similar way as stored links (C-c l ). I.E to get the attachment-folder as an item in the C-c C-l buffer with TAB-completion. regards G 2011/7/16 Darlan Cavalcante Moreira <darcamo@gmail.com> > > I use org-attach regularly and consider it to be a great feature of > org-mode. Since I only attach to the sub-tree (instead of to a different > file) I have not this problem. However, sometimes a set the attach > directory of two different headings to the same folder (when it makes > sense) and if org always moved the attached files it would break the other > sub-tree. > > An alternative is to change the attach directory in the archived entry to > point to the original attach directory where the files are. When archiving > to a file in a different folder org could ask if it should also move the > attached files or simply change the attach directory accordingly (I would > prefer this as the default if "ask" as the default was considered too > annoying). > > -- > Darlan > > At Fri, 15 Jul 2011 16:55:06 +0200, > Gustav Wikström <gustav.erik@gmail.com> wrote: > > > > [1 <text/plain; ISO-8859-1 (quoted-printable)>] > > Hello Bastien! > > > > To clarify a bit. Lets say I have a file c:\temp\agenda.org (I'm calling > it > > file 'a'). > > > > When marked with TODO item: done, headings in this file are archived to > > another file called c:\temp\archive\agenda.org_archive ('b') > > > > If i use C-c C-a to attach a file to a certain topic in 'a' and then > refile > > this topic to 'b', when done the attachment still resides in c:\temp\data > > and will not be found when looking at the attachment in 'b'. > > > > Thus my question is if it is possible to also refile the attachment so > the > > attachment-folder resides in c:\temp\archive\data and is avaliable in > 'b'? > > > > /Gustav > > > > 2011/7/15 Bastien <bzg@altern.org> > > > > > Hi Gustav, > > > > > > Gustav Wikström <gustav.erik@gmail.com> writes: > > > > > > > Is it possible to make attachment-folders move with the headings when > > > > refiling them to other locations? > > > > > > I'm not sure what you mean. > > > > > > Can you give an example? > > > > > > -- > > > Bastien > > > > > [2 <text/html; ISO-8859-1 (quoted-printable)>] > > > [-- Attachment #2: Type: text/html, Size: 3369 bytes --] ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-19 12:17 ` Gustav Wikström @ 2011-07-24 20:00 ` Bastien 2011-07-25 0:14 ` Brian van den Broek 2011-07-25 7:10 ` Gustav Wikström 2011-07-24 20:07 ` Bastien 1 sibling, 2 replies; 30+ messages in thread From: Bastien @ 2011-07-24 20:00 UTC (permalink / raw) To: Gustav Wikström; +Cc: emacs-orgmode Hi Gustav and Darlan, one solution I can think of is to set `org-attach-directory' to an absolute path instead of "data/" (the current default value). This way, refiling an entry will not lose attachments. I'm considering using "~/.org-data/" as the default value. What do you think? -- Bastien ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-24 20:00 ` Bastien @ 2011-07-25 0:14 ` Brian van den Broek 2011-07-25 7:10 ` Gustav Wikström 1 sibling, 0 replies; 30+ messages in thread From: Brian van den Broek @ 2011-07-25 0:14 UTC (permalink / raw) To: emacs-orgmode 2011/7/24 Bastien <bzg@altern.org>: > Hi Gustav and Darlan, > > one solution I can think of is to set `org-attach-directory' > to an absolute path instead of "data/" (the current default > value). > > This way, refiling an entry will not lose attachments. > > I'm considering using "~/.org-data/" as the default value. > > What do you think? > > -- > Bastien I don't make much use of attachments, but I would think something like (setq org-attach-dir (concat org-directory ".data")) would make more sense. I, at least, prefer to have all of my org related data living in one directory tree. Best, Brian vdB ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-24 20:00 ` Bastien 2011-07-25 0:14 ` Brian van den Broek @ 2011-07-25 7:10 ` Gustav Wikström 2011-07-25 7:45 ` Bastien 1 sibling, 1 reply; 30+ messages in thread From: Gustav Wikström @ 2011-07-25 7:10 UTC (permalink / raw) To: Bastien; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 599 bytes --] I'm leaning towards not moving my archive to a different folder. I like having the attachments relative. Are archive- and refile-hooks implemented b.t.w.? This would make it possible to hack a personal setting, or am I wrong? /Gustav 2011/7/24 Bastien <bzg@altern.org> > Hi Gustav and Darlan, > > one solution I can think of is to set `org-attach-directory' > to an absolute path instead of "data/" (the current default > value). > > This way, refiling an entry will not lose attachments. > > I'm considering using "~/.org-data/" as the default value. > > What do you think? > > -- > Bastien > [-- Attachment #2: Type: text/html, Size: 983 bytes --] ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-25 7:10 ` Gustav Wikström @ 2011-07-25 7:45 ` Bastien 2011-07-25 15:55 ` Darlan Cavalcante Moreira 0 siblings, 1 reply; 30+ messages in thread From: Bastien @ 2011-07-25 7:45 UTC (permalink / raw) To: Gustav Wikström; +Cc: emacs-orgmode Gustav Wikström <gustav.erik@gmail.com> writes: > I'm leaning towards not moving my archive to a different folder. I > like having the attachments relative. Okay. But as Darlan pointed out, moving the attached files when refiling the entry might be dangerous, because files in this attached directory can also be attached in a different subtree. I don't have a good general solution to this -- if someone has, please share. > Are archive- and refile-hooks implemented b.t.w.? C-h v org-archive-*-hook TAG C-h v org-refile-*-hook TAG helps. There is `org-after-refile-insert-hook' but there is no `org-archive-hook'. I'll consider adding this. > This would make it > possible to hack a personal setting, or am I wrong? You're probably right. Code is proof. -- Bastien ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-25 7:45 ` Bastien @ 2011-07-25 15:55 ` Darlan Cavalcante Moreira 2011-07-28 7:51 ` Bastien 0 siblings, 1 reply; 30+ messages in thread From: Darlan Cavalcante Moreira @ 2011-07-25 15:55 UTC (permalink / raw) To: Bastien; +Cc: Gustav Wikström, emacs-orgmode As I see changing the attach directory to point to the original one is the easiest solution that has no chances of breaking anything and would keep attachments working in the refiled/archived sub-trees. Maybe a org-attach-move-files function could also be implemented to easily move an attachment directory to a different place. It should move the directory and automatically set the ATTACH_DIR property to the appropriated value. Of course org could try to find out if this attach directory is also used in a different file/sub-tree (maybe search in the agenda files and in the current directory for org-files using this attach directory) and change ATTACH_DIR in that file/sub-tree or warn the user before moving the files. This won't be bullet proof but if the users only set the same attach directory for headings in the same file, for instance (I do this), then it would work perfectly. Then, when the user wants the refiling/archiving process to also move the attached files it could pass an argument before refiling/archiving and org-attach-move-files would be called appropriately. -- Darlan At Mon, 25 Jul 2011 09:45:24 +0200, Bastien <bzg@altern.org> wrote: > > Gustav Wikström <gustav.erik@gmail.com> writes: > > > I'm leaning towards not moving my archive to a different folder. I > > like having the attachments relative. > > Okay. > > But as Darlan pointed out, moving the attached files when refiling the > entry might be dangerous, because files in this attached directory can > also be attached in a different subtree. > > I don't have a good general solution to this -- if someone has, please > share. > > > Are archive- and refile-hooks implemented b.t.w.? > > C-h v org-archive-*-hook TAG > C-h v org-refile-*-hook TAG > > helps. > > There is `org-after-refile-insert-hook' but there is no > `org-archive-hook'. I'll consider adding this. > > > This would make it > > possible to hack a personal setting, or am I wrong? > > You're probably right. Code is proof. > > -- > Bastien ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-25 15:55 ` Darlan Cavalcante Moreira @ 2011-07-28 7:51 ` Bastien 2011-07-28 10:38 ` suvayu ali ` (2 more replies) 0 siblings, 3 replies; 30+ messages in thread From: Bastien @ 2011-07-28 7:51 UTC (permalink / raw) To: Darlan Cavalcante Moreira; +Cc: Gustav Wikström, emacs-orgmode Hi Darlan, here is how I see the situation regarding attachments: 1. org-attach.el is nice because it makes it easy to attach a file to a task, while not *worrying* about where the file is on the harddrive. 2. Adding an ATTACH_DIR property will always add an absolute path, so there is no problem when moving an entry with an explicit ATTACH_DIR. 3. Refiling/archiving subtrees lose track of some attachments when the attach directory "data/" is *relative* to the org file (which is the default) and when the target org file is not in the same directory. 4. Moving an entry with an ATTACH_DIR_INHERIT will lose attachments when the ATTACH_DIR of the target entry is different. (3) and (4) are two distinct problems. I suggest fixing problem (3) by making `org-attach-dir' defaulting to "~/.org-attachments/". I I suggest fixing problem (4) by explicitely replacing ATTACH_DIR_INHERIT with the corresponding ATTACH_DIR when the target subtree has a different ATTACH_DIR. The core idea is that I want to avoid moving files themselves: I think it's a risky road, and I hope the solutions above will make this road unnecessary. I'm interested in feedback and ideas about such proposed changes. Thanks a lot! -- Bastien ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-28 7:51 ` Bastien @ 2011-07-28 10:38 ` suvayu ali 2011-07-28 13:46 ` Nick Dokos 2011-07-28 17:31 ` Darlan Cavalcante Moreira 2011-07-29 7:27 ` Gustav Wikström 2 siblings, 1 reply; 30+ messages in thread From: suvayu ali @ 2011-07-28 10:38 UTC (permalink / raw) To: Bastien; +Cc: Gustav Wikström, emacs-orgmode Hi Bastien, On Thu, Jul 28, 2011 at 9:51 AM, Bastien <bzg@altern.org> wrote: > I suggest fixing problem (3) by making `org-attach-dir' defaulting to > "~/.org-attachments/". Since most of us like to put our org files under version control, maybe setting it to (concat org-directory "/.org-attachments/") would be a better default? -- Suvayu Open source is the future. It sets us free. ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-28 10:38 ` suvayu ali @ 2011-07-28 13:46 ` Nick Dokos 2011-07-28 13:49 ` suvayu ali 0 siblings, 1 reply; 30+ messages in thread From: Nick Dokos @ 2011-07-28 13:46 UTC (permalink / raw) To: suvayu ali; +Cc: Bastien, nicholas.dokos, emacs-orgmode, Gustav Wikström suvayu ali <fatkasuvayu+linux@gmail.com> wrote: > Hi Bastien, > > On Thu, Jul 28, 2011 at 9:51 AM, Bastien <bzg@altern.org> wrote: > > I suggest fixing problem (3) by making `org-attach-dir' defaulting to > > "~/.org-attachments/". > > Since most of us like to put our org files under version control, > maybe setting it to > > (concat org-directory "/.org-attachments/") > > would be a better default? > Why is it better? Nick ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-28 13:46 ` Nick Dokos @ 2011-07-28 13:49 ` suvayu ali 2011-07-28 14:33 ` Nick Dokos 0 siblings, 1 reply; 30+ messages in thread From: suvayu ali @ 2011-07-28 13:49 UTC (permalink / raw) To: nicholas.dokos; +Cc: Bastien, emacs-orgmode, Gustav Wikström On Thu, Jul 28, 2011 at 3:46 PM, Nick Dokos <nicholas.dokos@hp.com> wrote: > suvayu ali <fatkasuvayu+linux@gmail.com> wrote: > >> Hi Bastien, >> >> On Thu, Jul 28, 2011 at 9:51 AM, Bastien <bzg@altern.org> wrote: >> > I suggest fixing problem (3) by making `org-attach-dir' defaulting to >> > "~/.org-attachments/". >> >> Since most of us like to put our org files under version control, >> maybe setting it to >> >> (concat org-directory "/.org-attachments/") >> >> would be a better default? >> > > Why is it better? > Then the attachments can also be version controlled. If it is under ~/.org-attachments/, then it is outside the directory tree. > Nick > -- Suvayu Open source is the future. It sets us free. ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-28 13:49 ` suvayu ali @ 2011-07-28 14:33 ` Nick Dokos 0 siblings, 0 replies; 30+ messages in thread From: Nick Dokos @ 2011-07-28 14:33 UTC (permalink / raw) To: suvayu ali; +Cc: Bastien, nicholas.dokos, emacs-orgmode, Gustav Wikström suvayu ali <fatkasuvayu+linux@gmail.com> wrote: > On Thu, Jul 28, 2011 at 3:46 PM, Nick Dokos <nicholas.dokos@hp.com> wrote: > > suvayu ali <fatkasuvayu+linux@gmail.com> wrote: > > > >> Hi Bastien, > >> > >> On Thu, Jul 28, 2011 at 9:51 AM, Bastien <bzg@altern.org> wrote: > >> > I suggest fixing problem (3) by making `org-attach-dir' defaulting to > >> > "~/.org-attachments/". > >> > >> Since most of us like to put our org files under version control, > >> maybe setting it to > >> > >> (concat org-directory "/.org-attachments/") > >> > >> would be a better default? > >> > > > > Why is it better? > > > > Then the attachments can also be version controlled. If it is under > ~/.org-attachments/, then it is outside the directory tree. > D'oh! thanks. Nick ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-28 7:51 ` Bastien 2011-07-28 10:38 ` suvayu ali @ 2011-07-28 17:31 ` Darlan Cavalcante Moreira 2011-07-28 18:04 ` Bernt Hansen 2011-07-29 7:27 ` Gustav Wikström 2 siblings, 1 reply; 30+ messages in thread From: Darlan Cavalcante Moreira @ 2011-07-28 17:31 UTC (permalink / raw) To: Bastien; +Cc: Gustav Wikström, emacs-orgmode Regarding (2), is this a design decision? Currently I have the ATTACH_DIR property of some headings set to a relative path from the org file and it works perfectly. That is, it is possible to use either absolute or relative path for the ATTACH_DIR property right now. But if this is a design decision then I should not consider this behavior as granted, right? Also, Suvayu's suggestion for the default attachments directory is the best solution IMHO. That is, the default attach directory should be relative to org-directory. -- Darlan At Thu, 28 Jul 2011 09:51:54 +0200, Bastien <bzg@altern.org> wrote: > > Hi Darlan, > > here is how I see the situation regarding attachments: > > 1. org-attach.el is nice because it makes it easy to attach a file to a > task, while not *worrying* about where the file is on the harddrive. > > 2. Adding an ATTACH_DIR property will always add an absolute path, so > there is no problem when moving an entry with an explicit ATTACH_DIR. > > 3. Refiling/archiving subtrees lose track of some attachments when the > attach directory "data/" is *relative* to the org file (which is the > default) and when the target org file is not in the same directory. > > 4. Moving an entry with an ATTACH_DIR_INHERIT will lose attachments > when the ATTACH_DIR of the target entry is different. > > (3) and (4) are two distinct problems. > > I suggest fixing problem (3) by making `org-attach-dir' defaulting to > "~/.org-attachments/". I > > I suggest fixing problem (4) by explicitely replacing ATTACH_DIR_INHERIT > with the corresponding ATTACH_DIR when the target subtree has a > different ATTACH_DIR. > > The core idea is that I want to avoid moving files themselves: I think > it's a risky road, and I hope the solutions above will make this road > unnecessary. > > I'm interested in feedback and ideas about such proposed changes. > > Thanks a lot! > > -- > Bastien ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-28 17:31 ` Darlan Cavalcante Moreira @ 2011-07-28 18:04 ` Bernt Hansen 0 siblings, 0 replies; 30+ messages in thread From: Bernt Hansen @ 2011-07-28 18:04 UTC (permalink / raw) To: Darlan Cavalcante Moreira; +Cc: Bastien, emacs-orgmode, Gustav Wikström > At Thu, 28 Jul 2011 09:51:54 +0200, > Bastien <bzg@altern.org> wrote: >> >> Hi Darlan, >> >> here is how I see the situation regarding attachments: >> >> 1. org-attach.el is nice because it makes it easy to attach a file to a >> task, while not *worrying* about where the file is on the harddrive. >> >> 2. Adding an ATTACH_DIR property will always add an absolute path, so >> there is no problem when moving an entry with an explicit ATTACH_DIR. >> >> 3. Refiling/archiving subtrees lose track of some attachments when the >> attach directory "data/" is *relative* to the org file (which is the >> default) and when the target org file is not in the same directory. >> >> 4. Moving an entry with an ATTACH_DIR_INHERIT will lose attachments >> when the ATTACH_DIR of the target entry is different. >> >> (3) and (4) are two distinct problems. >> >> I suggest fixing problem (3) by making `org-attach-dir' defaulting to >> "~/.org-attachments/". I >> >> I suggest fixing problem (4) by explicitely replacing ATTACH_DIR_INHERIT >> with the corresponding ATTACH_DIR when the target subtree has a >> different ATTACH_DIR. >> >> The core idea is that I want to avoid moving files themselves: I think >> it's a risky road, and I hope the solutions above will make this road >> unnecessary. >> >> I'm interested in feedback and ideas about such proposed changes. Darlan Cavalcante Moreira <darcamo@gmail.com> writes: > Regarding (2), is this a design decision? Currently I have the ATTACH_DIR > property of some headings set to a relative path from the org file and it > works perfectly. That is, it is possible to use either absolute or relative > path for the ATTACH_DIR property right now. > > But if this is a design decision then I should not consider this behavior > as granted, right? > > Also, Suvayu's suggestion for the default attachments directory is the best > solution IMHO. That is, the default attach directory should be relative to > org-directory. I've used attachments in the past to *copy* attached files somewhere into my org git repository (~/git/org) with attachments under ~/git/org/data/... Since the files are copied I can refile the task with the attachment anywhere in the same git repository without worrying about the details of exactly where it lives. Since then I've stopped using attachments regularly but I still have archived tasks with attachments in my git repo. None of my existing entries have ever specified an ATTACH_DIR* property. Whatever solution is arrived at from this thread I would like my existing (old) attachments to still be retrievable. -Bernt PS. Darlan: Please don't top-post, it makes articles much harder to read. ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-28 7:51 ` Bastien 2011-07-28 10:38 ` suvayu ali 2011-07-28 17:31 ` Darlan Cavalcante Moreira @ 2011-07-29 7:27 ` Gustav Wikström 2011-08-02 4:02 ` Matt Lundin 2 siblings, 1 reply; 30+ messages in thread From: Gustav Wikström @ 2011-07-29 7:27 UTC (permalink / raw) To: Bastien; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 2792 bytes --] In case the "not worrying about where.." in (1) is part the purpose of the attachment functionality the idea of an absolute path seems sound. I agree with it being a nice feature, and probably the best to have as default. 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. This adds a bit to the complexity of designing the functionality, and questions about refiling and archiving arise.. But maybe just adding a warning for these events might be enough as a first step. Although, with file-properties for attachment directories it might be possible to ask if the attachment-dir should also be moved (or copied) to this new location. 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. Just some thoughts Gustav On Thu, Jul 28, 2011 at 9:51 AM, Bastien <bzg@altern.org> wrote: > Hi Darlan, > > here is how I see the situation regarding attachments: > > 1. org-attach.el is nice because it makes it easy to attach a file to a > task, while not *worrying* about where the file is on the harddrive. > > 2. Adding an ATTACH_DIR property will always add an absolute path, so > there is no problem when moving an entry with an explicit ATTACH_DIR. > > 3. Refiling/archiving subtrees lose track of some attachments when the > attach directory "data/" is *relative* to the org file (which is the > default) and when the target org file is not in the same directory. > > 4. Moving an entry with an ATTACH_DIR_INHERIT will lose attachments > when the ATTACH_DIR of the target entry is different. > > (3) and (4) are two distinct problems. > > I suggest fixing problem (3) by making `org-attach-dir' defaulting to > "~/.org-attachments/". I > > I suggest fixing problem (4) by explicitely replacing ATTACH_DIR_INHERIT > with the corresponding ATTACH_DIR when the target subtree has a > different ATTACH_DIR. > > The core idea is that I want to avoid moving files themselves: I think > it's a risky road, and I hope the solutions above will make this road > unnecessary. > > I'm interested in feedback and ideas about such proposed changes. > > Thanks a lot! > > -- > Bastien > [-- Attachment #2: Type: text/html, Size: 3343 bytes --] ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-29 7:27 ` Gustav Wikström @ 2011-08-02 4:02 ` Matt Lundin 2011-08-29 12:04 ` Gustav Wikström 0 siblings, 1 reply; 30+ messages in thread From: Matt Lundin @ 2011-08-02 4:02 UTC (permalink / raw) To: Gustav Wikström; +Cc: Bastien, emacs-orgmode Gustav Wikström <gustav.erik@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 ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-08-02 4:02 ` Matt Lundin @ 2011-08-29 12:04 ` Gustav Wikström 0 siblings, 0 replies; 30+ messages in thread From: Gustav Wikström @ 2011-08-29 12:04 UTC (permalink / raw) To: Matt Lundin; +Cc: Bastien, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1832 bytes --] Thanks for this. Added it to my settings for now =) /Gustav 2011/8/2 Matt Lundin <mdl@imapmail.org> > Gustav Wikström <gustav.erik@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 > [-- Attachment #2: Type: text/html, Size: 2428 bytes --] ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-19 12:17 ` Gustav Wikström 2011-07-24 20:00 ` Bastien @ 2011-07-24 20:07 ` Bastien 2011-07-25 7:21 ` Gustav Wikström 1 sibling, 1 reply; 30+ messages in thread From: Bastien @ 2011-07-24 20:07 UTC (permalink / raw) To: Gustav Wikström; +Cc: emacs-orgmode Hi Gustav, Gustav Wikström <gustav.erik@gmail.com> writes: > Another feature that could improve the use of attachments is to allow > links to the attached folders also via the C-c C-l interface in a > similar way as stored links (C-c l ). I.E to get the attachment-folder > as an item in the C-c C-l buffer with TAB-completion. You can already use (setq org-attach-store-link-p t) to create a link while attaching a file. Since links are deleted as soon as they are inserted, this will be usable only once. We can imagine *persistent links* -- and links to attached files could be a good example of persistent links. What do you think? -- Bastien ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-24 20:07 ` Bastien @ 2011-07-25 7:21 ` Gustav Wikström 2011-07-29 8:33 ` Gustav Wikström 0 siblings, 1 reply; 30+ messages in thread From: Gustav Wikström @ 2011-07-25 7:21 UTC (permalink / raw) To: Bastien; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1009 bytes --] To make org-mode look for attachments in the current sub-tree when using org-insert-link would simplify the process of "linking" to attached files (useful at least when exporting). Persistent links, in in this regard, seems like a nice idea! /Gustav 2011/7/24 Bastien <bzg@altern.org> > Hi Gustav, > > Gustav Wikström <gustav.erik@gmail.com> writes: > > > Another feature that could improve the use of attachments is to allow > > links to the attached folders also via the C-c C-l interface in a > > similar way as stored links (C-c l ). I.E to get the attachment-folder > > as an item in the C-c C-l buffer with TAB-completion. > > You can already use (setq org-attach-store-link-p t) to create a link > while attaching a file. > > Since links are deleted as soon as they are inserted, this will be > usable only once. We can imagine *persistent links* -- and links to > attached files could be a good example of persistent links. > > What do you think? > > -- > Bastien > [-- Attachment #2: Type: text/html, Size: 1496 bytes --] ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-25 7:21 ` Gustav Wikström @ 2011-07-29 8:33 ` Gustav Wikström 2011-07-29 20:58 ` Darlan Cavalcante Moreira 0 siblings, 1 reply; 30+ messages in thread From: Gustav Wikström @ 2011-07-29 8:33 UTC (permalink / raw) To: Bastien; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1290 bytes --] What about being able to link to attachments in a similar way as one links to files or web-pages? Using [[attachment:some_file.sql][some link name]] ? Comments? Problems with this? 2011/7/25 Gustav Wikström <gustav.erik@gmail.com> > To make org-mode look for attachments in the current sub-tree when using > org-insert-link would simplify the process of "linking" to attached files > (useful at least when exporting). Persistent links, in in this regard, seems > like a nice idea! > > /Gustav > > 2011/7/24 Bastien <bzg@altern.org> > >> Hi Gustav, >> >> Gustav Wikström <gustav.erik@gmail.com> writes: >> >> > Another feature that could improve the use of attachments is to allow >> > links to the attached folders also via the C-c C-l interface in a >> > similar way as stored links (C-c l ). I.E to get the attachment-folder >> > as an item in the C-c C-l buffer with TAB-completion. >> >> You can already use (setq org-attach-store-link-p t) to create a link >> while attaching a file. >> >> Since links are deleted as soon as they are inserted, this will be >> usable only once. We can imagine *persistent links* -- and links to >> attached files could be a good example of persistent links. >> >> What do you think? >> >> -- >> Bastien >> > > [-- Attachment #2: Type: text/html, Size: 2032 bytes --] ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-29 8:33 ` Gustav Wikström @ 2011-07-29 20:58 ` Darlan Cavalcante Moreira 2011-08-18 17:33 ` Bastien 0 siblings, 1 reply; 30+ messages in thread From: Darlan Cavalcante Moreira @ 2011-07-29 20:58 UTC (permalink / raw) To: Gustav Wikström; +Cc: Bastien, emacs-orgmode I requested this some time ago [1]. While there is not a built-in attach link type, org provides you with ways to easily create this functionality. In the setup part in my org-files I put --8<---------------cut here---------------start------------->8--- #+LINK: attach elisp:(org-open-file (org-attach-expand "%s")) --8<---------------cut here---------------end--------------->8--- Now I can use the "attach" link type, but org will ask me if I want to allow executing the elisp code. To avoid this you can even set org-confirm-elisp-link-function to nil (I don't like this because it allows any elisp code in links) or you can set org-confirm-elisp-link-not-regexp appropriately. In my case I use : (setq org-confirm-elisp-link-not-regexp "org-open-file") This works very well. -- Darlan [1] http://www.mail-archive.com/emacs-orgmode@gnu.org/msg37613.html At Fri, 29 Jul 2011 10:33:37 +0200, Gustav Wikström <gustav.erik@gmail.com> wrote: > > [1 <text/plain; ISO-8859-1 (quoted-printable)>] > What about being able to link to attachments in a similar way as one links > to files or web-pages? Using [[attachment:some_file.sql][some link name]] ? > Comments? Problems with this? > > 2011/7/25 Gustav Wikström <gustav.erik@gmail.com> > > > To make org-mode look for attachments in the current sub-tree when using > > org-insert-link would simplify the process of "linking" to attached files > > (useful at least when exporting). Persistent links, in in this regard, seems > > like a nice idea! > > > > /Gustav > > > > 2011/7/24 Bastien <bzg@altern.org> > > > >> Hi Gustav, > >> > >> Gustav Wikström <gustav.erik@gmail.com> writes: > >> > >> > Another feature that could improve the use of attachments is to allow > >> > links to the attached folders also via the C-c C-l interface in a > >> > similar way as stored links (C-c l ). I.E to get the attachment-folder > >> > as an item in the C-c C-l buffer with TAB-completion. > >> > >> You can already use (setq org-attach-store-link-p t) to create a link > >> while attaching a file. > >> > >> Since links are deleted as soon as they are inserted, this will be > >> usable only once. We can imagine *persistent links* -- and links to > >> attached files could be a good example of persistent links. > >> > >> What do you think? > >> > >> -- > >> Bastien > >> > > > > > [2 <text/html; ISO-8859-1 (quoted-printable)>] > ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-07-29 20:58 ` Darlan Cavalcante Moreira @ 2011-08-18 17:33 ` Bastien 2011-08-18 20:37 ` Darlan Cavalcante Moreira 0 siblings, 1 reply; 30+ messages in thread From: Bastien @ 2011-08-18 17:33 UTC (permalink / raw) To: Darlan Cavalcante Moreira; +Cc: Gustav Wikström, emacs-orgmode Hi Darlan, Darlan Cavalcante Moreira <darcamo@gmail.com> writes: > I requested this some time ago [1]. While there is not a built-in attach > link type, org provides you with ways to easily create this functionality. > > In the setup part in my org-files I put > #+LINK: attach elisp:(org-open-file (org-attach-expand "%s")) > > Now I can use the "attach" link type, but org will ask me if I want to > allow executing the elisp code. To avoid this you can even set > org-confirm-elisp-link-function to nil (I don't like this because it allows > any elisp code in links) or you can set org-confirm-elisp-link-not-regexp > appropriately. > > In my case I use > : (setq org-confirm-elisp-link-not-regexp "org-open-file") > > This works very well. This is a nice and useful hack -- I added it to Worg/org-hacks.org. Thanks! -- Bastien ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-08-18 17:33 ` Bastien @ 2011-08-18 20:37 ` Darlan Cavalcante Moreira 2011-08-19 8:46 ` Bastien 0 siblings, 1 reply; 30+ messages in thread From: Darlan Cavalcante Moreira @ 2011-08-18 20:37 UTC (permalink / raw) To: Bastien; +Cc: Gustav Wikström, emacs-orgmode Hello Bastien, I'm glad to help (even if such a small contribution). The downside of this hack is that it does not work when you export the buffer. If you use the file: link type then the link will works when you export the org buffer, but you have to type the whole path of the attached file. Therefore, there is this trade-off for now. There is probably a way to make the attach link type also work when exporting the org buffer, but since I don't need this right now I didn't search how to do it. -- Darlan At Thu, 18 Aug 2011 19:33:37 +0200, Bastien <bzg@altern.org> wrote: > > Hi Darlan, > > Darlan Cavalcante Moreira <darcamo@gmail.com> writes: > > > I requested this some time ago [1]. While there is not a built-in attach > > link type, org provides you with ways to easily create this functionality. > > > > In the setup part in my org-files I put > > #+LINK: attach elisp:(org-open-file (org-attach-expand "%s")) > > > > Now I can use the "attach" link type, but org will ask me if I want to > > allow executing the elisp code. To avoid this you can even set > > org-confirm-elisp-link-function to nil (I don't like this because it allows > > any elisp code in links) or you can set org-confirm-elisp-link-not-regexp > > appropriately. > > > > In my case I use > > : (setq org-confirm-elisp-link-not-regexp "org-open-file") > > > > This works very well. > > This is a nice and useful hack -- I added it to Worg/org-hacks.org. > > Thanks! > > -- > Bastien ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-08-18 20:37 ` Darlan Cavalcante Moreira @ 2011-08-19 8:46 ` Bastien 2011-08-19 16:29 ` Darlan Cavalcante Moreira 0 siblings, 1 reply; 30+ messages in thread From: Bastien @ 2011-08-19 8:46 UTC (permalink / raw) To: Darlan Cavalcante Moreira; +Cc: Gustav Wikström, emacs-orgmode Hi Darlan, Darlan Cavalcante Moreira <darcamo@gmail.com> writes: > There is probably a way to make the attach link type also work when > exporting the org buffer, but since I don't need this right now I didn't > search how to do it. You could use a `org-export-preprocess-hook' to convert those "attach" links into proper "file" links. -- Bastien ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-08-19 8:46 ` Bastien @ 2011-08-19 16:29 ` Darlan Cavalcante Moreira 2011-08-24 14:12 ` Bastien 0 siblings, 1 reply; 30+ messages in thread From: Darlan Cavalcante Moreira @ 2011-08-19 16:29 UTC (permalink / raw) To: Bastien; +Cc: Gustav Wikström, emacs-orgmode At Fri, 19 Aug 2011 10:46:26 +0200, Bastien <bzg@altern.org> wrote: What about org-add-link-type? Besides the new link type name, org-add-link-type can receives two functions, one used to follow the link and another to export the link. I was able to make the attach link type work by using org-add-link-type, where the "follow" function is practically the same code I have used with #+LINK. However, I could not make the the "export" part work because I can't use org-attach-expand in it. Therefore, I don't know how to get the attach directory inside a function that I can pass to org-add-link-type as the export function. Unfortunately, my elisp skills are very limited to go any further for now. -- Darlan > > Hi Darlan, > > Darlan Cavalcante Moreira <darcamo@gmail.com> writes: > > > There is probably a way to make the attach link type also work when > > exporting the org buffer, but since I don't need this right now I didn't > > search how to do it. > > You could use a `org-export-preprocess-hook' to convert those "attach" > links into proper "file" links. > > -- > Bastien ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-08-19 16:29 ` Darlan Cavalcante Moreira @ 2011-08-24 14:12 ` Bastien 2011-08-24 14:56 ` Darlan Cavalcante Moreira 0 siblings, 1 reply; 30+ messages in thread From: Bastien @ 2011-08-24 14:12 UTC (permalink / raw) To: Darlan Cavalcante Moreira; +Cc: Gustav Wikström, emacs-orgmode Hi Darlan, Darlan Cavalcante Moreira <darcamo@gmail.com> writes: > At Fri, 19 Aug 2011 10:46:26 +0200, > Bastien <bzg@altern.org> wrote: > > What about org-add-link-type? Mmhh.. yes. We should be able to use something like: (org-add-link-type "attach" 'org-attach-open 'org-attach-export) > However, I could not make the the "export" part work because I can't use > org-attach-expand in it. Therefore, I don't know how to get the attach > directory inside a function that I can pass to org-add-link-type as the > export function. That's not possible for now. That's something we can keep in mind while working an a new export engine: exporting part of the content should be done in a context-aware fashion, where it's possible to get the value of org-attach-dir. > Unfortunately, my elisp skills are very limited to go any further for > now. Even with good elisp skills I'm afraid we cannot achieve this for the moment. HTH, -- Bastien ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Attachments and refiling 2011-08-24 14:12 ` Bastien @ 2011-08-24 14:56 ` Darlan Cavalcante Moreira 0 siblings, 0 replies; 30+ messages in thread From: Darlan Cavalcante Moreira @ 2011-08-24 14:56 UTC (permalink / raw) To: Bastien; +Cc: Gustav Wikström, emacs-orgmode At Wed, 24 Aug 2011 16:12:01 +0200, Bastien <bzg@altern.org> wrote: > > Hi Darlan, > > Darlan Cavalcante Moreira <darcamo@gmail.com> writes: > > > At Fri, 19 Aug 2011 10:46:26 +0200, > > Bastien <bzg@altern.org> wrote: > > > > What about org-add-link-type? > > Mmhh.. yes. We should be able to use something like: > > (org-add-link-type "attach" 'org-attach-open 'org-attach-export) > > > However, I could not make the the "export" part work because I can't use > > org-attach-expand in it. Therefore, I don't know how to get the attach > > directory inside a function that I can pass to org-add-link-type as the > > export function. > > That's not possible for now. That's something we can keep in mind > while working an a new export engine: exporting part of the content > should be done in a context-aware fashion, where it's possible to > get the value of org-attach-dir. Thanks for the confirmation Bastien. At least for me the export part is not very important right now. A context aware export engine would make this easy to achieve with org-add-link-type and probably open up many other possibilities, but I understand it is a lot of work. > > > Unfortunately, my elisp skills are very limited to go any further for > > now. > > Even with good elisp skills I'm afraid we cannot achieve this for > the moment. > > HTH, > > -- > Bastien -- Darlan ^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2011-08-29 12:04 UTC | newest] Thread overview: 30+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-07-15 11:06 Attachments and refiling Gustav Wikström 2011-07-15 11:16 ` Bastien 2011-07-15 14:55 ` Gustav Wikström 2011-07-16 15:50 ` Darlan Cavalcante Moreira 2011-07-19 12:17 ` Gustav Wikström 2011-07-24 20:00 ` Bastien 2011-07-25 0:14 ` Brian van den Broek 2011-07-25 7:10 ` Gustav Wikström 2011-07-25 7:45 ` Bastien 2011-07-25 15:55 ` Darlan Cavalcante Moreira 2011-07-28 7:51 ` Bastien 2011-07-28 10:38 ` suvayu ali 2011-07-28 13:46 ` Nick Dokos 2011-07-28 13:49 ` suvayu ali 2011-07-28 14:33 ` Nick Dokos 2011-07-28 17:31 ` Darlan Cavalcante Moreira 2011-07-28 18:04 ` Bernt Hansen 2011-07-29 7:27 ` Gustav Wikström 2011-08-02 4:02 ` Matt Lundin 2011-08-29 12:04 ` Gustav Wikström 2011-07-24 20:07 ` Bastien 2011-07-25 7:21 ` Gustav Wikström 2011-07-29 8:33 ` Gustav Wikström 2011-07-29 20:58 ` Darlan Cavalcante Moreira 2011-08-18 17:33 ` Bastien 2011-08-18 20:37 ` Darlan Cavalcante Moreira 2011-08-19 8:46 ` Bastien 2011-08-19 16:29 ` Darlan Cavalcante Moreira 2011-08-24 14:12 ` Bastien 2011-08-24 14:56 ` Darlan Cavalcante Moreira
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).