emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] FW: [RFC] Link-type for attachments, more attach options


From: Ihor Radchenko
Subject: Re: [O] FW: [RFC] Link-type for attachments, more attach options
Date: Sat, 03 Nov 2018 11:37:31 +0800

Hi Gustav,

Thanks for the patch!
I am a heavy user of org attachments, so it is pleasant that someone
spent a time to implement this useful feature into org.

A comment regarding the code.
Your new link types appears to reimplement some of the code for the
"file:" links.
Would it make more sense to implement the "attachment:" link type as
abbreviation?
I mean something like the code below:

````
(defun yant/process-att-abbrev (arg)
  "Return `org-attach-dir' for the current entry."
  (s-concat (org-attach-dir 'CREATE) arg))

(add-to-list 'org-link-abbrev-alist (cons "att" 
"file:%(yant/process-att-abbrev)"))

(defun org-att-link-complete (&optional arg)
  "Completion function for att: link."
  (let* ((ref-dir (org-attach-dir 'CREATE))
         (filelink (let ((default-directory ref-dir))
                     (org-file-complete-link)))
         (filepath (apply #'s-concat (cdr (s-split ":" filelink)))))
    (format "att:%s" filepath)))

(org-link-set-parameters "att" 
                         :complete #'org-att-link-complete)
````

Also, is anyone interested in automatic placing of org attachments into
a folder structure, which mirrors the org path?
Something like in the following Stack Exchange question:
https://emacs.stackexchange.com/questions/26412/human-readable-directory-tree-with-org-attach

Best,
Ihor

Gustav Wikström <address@hidden> writes:

> Hi Marco,
>
> Nice to hear you like it! Yeah, I'm pretty happy with that functionality as 
> well. Use it all the time to quickly add links to attached files.
>
> One use case I have for this (as an example) is for projects and tasks. I 
> have a 'tasks.org' file with nodes for each of my tasks and each of my 
> projects. Usually, if the task is about some digital work, there are files 
> involved with it. So I have a convention to add folders next to the 
> 'tasks.org' file with names like 'YYMM [task/project title]', and attach the 
> folder to each task/project node. C-c C-l attached RET then makes it 
> super-easy to refer to particular files within that folder, from within the 
> node in the 'tasks.org' file!
>
> Another use case is for my 'digital brain', where it's also fairly common for 
> me to have attachment folders where I want to refer to files within them. 
> Images for example, that then will be displayed in the org-mode file. Haven't 
> settled on whether I should use auto-managed ID's for these folders, or 
> :ATTACH_DIR: properties though. Currently using a bit of both...
>
> I'm not familiar with the 'next' branch and the plans for integrating it into 
> 'master'. But if 'master' is to offensive to merge into straight away, 'next' 
> sounds like a good option!
>
> Kind regards
> Gustav
>
> -----Original Message-----
> From: Marco Wahl <address@hidden> 
> Sent: den 1 november 2018 17:01
> To: Gustav Wikström <address@hidden>
> Subject: Re: FW: [RFC] Link-type for attachments, more attach options
>
> The following message is a courtesy copy of an article that has been posted 
> to gmane.emacs.orgmode as well.
>
> Hi Gustav,
>
> I played a bit with your proposition.  I like it; in particular the 
> completion function to insert links from the attachment directory with
>
>     C-c C-l attached RET
>
> It seems natural to me to have a more specific link type for attached files.
>
> In my opinion your patch should be applied to the 'next' branch.
>
>
> My 2ct,
>         Marco
>

Attachment: signature.asc
Description: PGP signature


reply via email to

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