From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ihor Radchenko Subject: Re: [RFC] Link-type for attachments, more attach options Date: Mon, 29 Jul 2019 07:20:51 +0800 Message-ID: <87tvb53fvw.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> References: <87muqo8o68.fsf@nicolasgoaziou.fr> <877eh8vd52.fsf_-_@nicolasgoaziou.fr> <87y39euadx.fsf@nicolasgoaziou.fr> <87pnnfnfio.fsf@nicolasgoaziou.fr> <87tvby4z01.fsf@nicolasgoaziou.fr> <87y30j34ry.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:59257) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrsUK-00047W-5i for emacs-orgmode@gnu.org; Sun, 28 Jul 2019 19:22:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hrsUJ-0004Rv-17 for emacs-orgmode@gnu.org; Sun, 28 Jul 2019 19:22:00 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:34062) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hrsUI-0004R1-RP for emacs-orgmode@gnu.org; Sun, 28 Jul 2019 19:21:58 -0400 Received: by mail-pf1-x432.google.com with SMTP id b13so27007964pfo.1 for ; Sun, 28 Jul 2019 16:21:58 -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?= Cc: "emacs-orgmode@gnu.org" , Nicolas Goaziou Dear Gustav, Thanks for the update. For now, I fixed the problem for me with the following advice: #+begin_src emacs-lisp (define-advice org-attach-dir (:filter-return (dir) yant/org-attach-use-a= ttach-dir-inheritance -100) "Use :ATTACH_DIR_INHERIT: property." (let ((attach-dir-inherited (and (org-entry-get-with-inheritance "ATTAC= H_DIR_INHERIT") (not (org-entry-get (point) "ATTACH_DIR_INHERIT" nil)) (org-with-point-at org-entry-property-inherited-from (org-attach-d= ir))))) (or attach-dir-inherited dir))) #+end_src Regards, Ihor Gustav Wikstr=C3=B6m writes: > Hi Ihor, > >> -----Original Message----- >> From: Ihor Radchenko >> Sent: den 27 juli 2019 16:56 >> To: Gustav Wikstr=C3=B6m ; Nicolas Goaziou >> Cc: emacs-orgmode@gnu.org >> Subject: Re: [O] [RFC] Link-type for attachments, more attach options > >> I just found that removing ATTACH_DIR_INHERIT broke my current >> configuration. I do not use ATTACH_DIR property - all the attachment >> folders are created using ID. Also, I use ID property to store links to >> entries. Therefore, inheriting ATTACH_DIR does nothing for me and >> inheriting ID always gives the current entry's id value. At the end, I >> cannot make a common attachment directory for the whole subtree, like I >> was able to do with ATTACH_DIR_INHERIT. > > Ah, yes. That is an unfortunate side effect of ID properties having > other use-cases outside of attachments. I thought about that for some > time during the development but didn't get to implement any solution > for it. The way I thought to do it was to create an algorithm that > looks through the outline hierarchy at successively lower hierarchy > for an ID property that has a corresponding attachment folder. If no > folder exist for the ID attribute at the given level, the inherit > functionality would continue to look at a lower level until a folder > was found. I imagined the algorithm to look for both ID and DIR > properties at each level and stop at the first property that had an > existing attachment folder, with DIR taking precedence at each level > if for some reason both ID and DIR based folders existed. > > Adding such functionality means going outside the scope of current > property inheritance in Org mode. It adds some complexity but maybe > it's warranted to do so here? But, as mentioned, I only got to the > point of thinking about it, I didn't implement it. > > If someone wants to take up the challenge of implementing it then the > starting point should be to modify org-attach-dir, replacing > org-entry-get with something similar to the algorithm mentioned above. > > I might get to it at some point as well, but my motivation lies > elsewhere right now (document-level stuff... see other threads by > me). > > Kind regards > Gustav