[Top][All Lists]

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

Re: [O] [Feature proposal] Add :description function to org-link-paramet

From: Ihor Radchenko
Subject: Re: [O] [Feature proposal] Add :description function to org-link-parameters
Date: Sat, 03 Aug 2019 10:35:59 +0800

Oops. Indeed, :desk should be replaced with :description. I used :desk
property in my personal config, but it may be confusing for others.


John Kitchin <address@hidden> writes:

> 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 <address@hidden> 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

Ihor Radchenko,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong 
University, Xi'an, China
Email: address@hidden, address@hidden

reply via email to

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