From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: [Feature proposal] Add :description function to org-link-parameters Date: Fri, 02 Aug 2019 18:23:28 -0400 Message-ID: References: <871ry3eety.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:57032) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htfxc-0000D6-C8 for emacs-orgmode@gnu.org; Fri, 02 Aug 2019 18:23:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1htfxa-0008Gs-Ed for emacs-orgmode@gnu.org; Fri, 02 Aug 2019 18:23:40 -0400 Received: from mail-qt1-x829.google.com ([2607:f8b0:4864:20::829]:37027) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1htfxY-0008Et-ET for emacs-orgmode@gnu.org; Fri, 02 Aug 2019 18:23:38 -0400 Received: by mail-qt1-x829.google.com with SMTP id y26so75539479qto.4 for ; Fri, 02 Aug 2019 15:23:31 -0700 (PDT) Received: from Johns-MacBook-Air.local (c-67-171-67-30.hsd1.pa.comcast.net. [67.171.67.30]) by smtp.gmail.com with ESMTPSA id r4sm49817830qta.93.2019.08.02.15.23.29 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 15:23:29 -0700 (PDT) In-reply-to: <871ry3eety.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> 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: emacs-orgmode@gnu.org This sounds reasonable. I was a little confused with the mixture of of description and desk in the code below. If you replace desk with description everywhere in your code is that what you mean? Ihor Radchenko writes: > Hi, > > Wondering if anyone is interested in adding a new org-link property to > customise generating the link description. > > For now, there is global org-link-make-description-function, which is > shared among all the link types. If would be more convenient if the > description function can be set independently for different link types. > > I propose to use :description property in org-link-parameters. A sample > implementation working with current org version is below: > > #+begin_src emacs-lisp > (defun yant/org-make-link-description-function (link desk) > "Return description of the link LINK according to :description link property. > Return DESK if :desk is not set." > (let ((fun (org-link-get-parameter (car (split-string link ":")) :description))) > (if (functionp fun) > (funcall fun link desk) > desk))) > > (setq org-make-link-description-function #'yant/org-make-link-description-function) > #+end_src > > Example usage: > > #+begin_src emacs-lisp > (defun org-id-link-desk (link desk) > "Description function for id: link." > (let ((id (cadr (split-string link ":")))) > (org-with-point-at (org-id-find id 'marker) > (s-replace "||" "/" (yant/task-fulltitle))))) > > (org-link-set-parameters "id" > :desk #'org-id-link-desk) > #+end_src > > Best, > Ihor -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu