emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: emacs-orgmode@gnu.org
Subject: Re: [Feature proposal] Add :description function to org-link-parameters
Date: Fri, 02 Aug 2019 18:23:28 -0400	[thread overview]
Message-ID: <m2blx7p5pb.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <871ry3eety.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me>

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 <yantar92@gmail.com> 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

  reply	other threads:[~2019-08-02 22:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02 16:01 [Feature proposal] Add :description function to org-link-parameters Ihor Radchenko
2019-08-02 22:23 ` John Kitchin [this message]
2019-08-03  2:35   ` Ihor Radchenko
2019-10-07  2:52 ` stardiviner
2020-02-04  8:13 ` Bastien
2022-10-09  6:41 ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2blx7p5pb.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).