From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ihor Radchenko Subject: Re: FW: [RFC] Link-type for attachments, more attach options Date: Sat, 03 Nov 2018 11:37:31 +0800 Message-ID: <875zxe4yro.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> References: <84y3acss7h.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gImmV-0001V7-Hy for emacs-orgmode@gnu.org; Fri, 02 Nov 2018 23:39:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gImmQ-0004GG-8q for emacs-orgmode@gnu.org; Fri, 02 Nov 2018 23:39:26 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:43329) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gImmP-0004Eg-T7 for emacs-orgmode@gnu.org; Fri, 02 Nov 2018 23:39:22 -0400 Received: by mail-pf1-x433.google.com with SMTP id h4-v6so1858462pfi.10 for ; Fri, 02 Nov 2018 20:39:21 -0700 (PDT) In-Reply-To: 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" To: Gustav =?utf-8?Q?Wikstr=C3=B6m?= , Marco Wahl Cc: emacs-orgmode --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-ab= brev)")) (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"=20 :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-tr= ee-with-org-attach Best, Ihor Gustav Wikstr=C3=B6m 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 pro= jects. Usually, if the task is about some digital work, there are files inv= olved 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 t= o 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 th= em. Images for example, that then will be displayed in the org-mode file. H= aven'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 =20 > Sent: den 1 november 2018 17:01 > To: Gustav Wikstr=C3=B6m > Subject: Re: FW: [RFC] Link-type for attachments, more attach options > > The following message is a courtesy copy of an article that has been post= ed to gmane.emacs.orgmode as well. > > Hi Gustav, > > I played a bit with your proposition. I like it; in particular the compl= etion 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 fil= es. > > In my opinion your patch should be applied to the 'next' branch. > > > My 2ct, > Marco > --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEERZAHPFbUe3JemmzmZHB2Kn2hHYsFAlvdF/wACgkQZHB2Kn2h HYst2wgAqOUHRj1DarQbmUWxLW+kfG72rxlPfzkVCPZlSX9zC8fc3jsQs3A9Zktu vKEAJGL6vlY4XZpppBp1lC+dkmnYNtEWp3e9705faf7jMtGQ39BGF/j7KfI6wCBu rglD57GBygS8oSHoKr00ZvAjMKp/pKQj922kxJQHM8LBPRfn/ZAj8yl/9YZmhxx7 Dnur8ulu7nG1Gudx6myQIUlS8pPK4fuFELc7mmhOp3ReN+uSwgTcgzOmTriqhINe tkzBsdwdfEdJ9gu0742Okzw5ZAGaMHnzJCUuQzlwk4aIk9VdCEP9Smdz2+z01H2W SnP4suNM5uoxyj/ucQ8Ry3YvDyofDw== =7xXs -----END PGP SIGNATURE----- --=-=-=--