emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: How to set org-make-link-description-function
Date: Fri, 13 Apr 2018 13:32:08 -0700	[thread overview]
Message-ID: <CAJ51ETo5xoxQbiPRgf4MN8oJoBVv43fvsuW1tFARSm_gyfwU_g@mail.gmail.com> (raw)
In-Reply-To: <877epbt3yv.fsf@ericabrahamsen.net>

[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]

Here is a globally defined version that would let you define a function for
any other kind of link I think. There are probably many variations on this
theme, like storing functions in some variable as an alist, etc. Something
like that is what would happen if this was defined in the link parameters.

#+BEGIN_SRC emacs-lisp
(defun my-comp (&optional arg)
  (format "fruit:%s"
          (completing-read "Choose a fruit: " '("apple" "orange" "grapes"

(org-link-set-parameters "fruit"
                         :complete 'my-comp)

(defun org-fruit-make-link-description (link desc)
  (replace-regexp-in-string "fruit:" "" link))

(setq org-make-link-description-function
      (lambda (link desc)
(let* ((link-type (car (s-split ":" link)))
       (make-func (intern (format "org-%s-make-link-description"
  (if (fboundp make-func)
      (funcall make-func link desc)


Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213

On Fri, Apr 13, 2018 at 10:23 AM, Eric Abrahamsen <eric@ericabrahamsen.net>

> John Kitchin <jkitchin@andrew.cmu.edu> writes:
> > Not with the way I wrote it. It should only affect your links and pass
> everything else through I
> > think.
> I just meant, you can only have one of these functions set. So if I
> provide special behavior for ebdb links, no other function would be able
> to do the equivalent for some other type of link.

[-- Attachment #2: Type: text/html, Size: 2879 bytes --]

  reply	other threads:[~2018-04-13 20:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-13  0:54 How to set org-make-link-description-function Eric Abrahamsen
2018-04-13  2:05 ` John Kitchin
2018-04-13  4:12   ` Eric Abrahamsen
2018-04-13  4:39     ` John Kitchin
2018-04-13 17:23       ` Eric Abrahamsen
2018-04-13 20:32         ` John Kitchin [this message]
2018-04-13 23:58           ` Eric Abrahamsen

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:

  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=CAJ51ETo5xoxQbiPRgf4MN8oJoBVv43fvsuW1tFARSm_gyfwU_g@mail.gmail.com \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric@ericabrahamsen.net \


* 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


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).