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: Thu, 12 Apr 2018 19:05:30 -0700	[thread overview]
Message-ID: <CAJ51ETr7p9XF1BX0xSQLoZhnzVJPTM-evafJKqubVixT1vUG1g@mail.gmail.com> (raw)
In-Reply-To: <87bmeo53ji.fsf@ericabrahamsen.net>

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

I don't know how to do that either. It does seem like you can set it
globally. You can try something like:

#+BEGIN_SRC emacs-lisp
(setq org-make-link-description-function
      (lambda (link desc)
(cond
((s-starts-with? "ebdb:uuid/" link)
  (replace-regexp-in-string "ebdb:uuid/" "" link))
(t
  desc))))
#+END_SRC

It doesn't seem too ideal, as it seems like something that should get set
in the link parameters.

Does anyone else have an idea?

John

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


On Thu, Apr 12, 2018 at 5:54 PM, Eric Abrahamsen <eric@ericabrahamsen.net>
wrote:

> I've coded Org link support for EBDB, a contact management package,
> where the :complete key looks like:
>
> (lambda ()
>   (format "ebdb:uuid/%s"
>           (ebdb-record-uuid
>            (ebdb-prompt-for-record
>             (ebdb-records)))))
>
> Which prompts for a record based on the contact name, then inserts the
> contact's UUID as the link.
>
> The problem is that Org then prompts for a link description. I'd like to
> provide the contact name as a default description (the user has just
> typed it in, after all), but haven't figured out how to do that.
>
> Clearly `org-make-link-description-function' is meant to play this role,
> and it would work perfectly, but I don't know to set it. I can't set it
> globally, but also don't know how to let-bind it locally.
>
> How am I supposed to use it?
>
> Thanks,
> Eric
>
>
>

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

  reply	other threads:[~2018-04-13  2:05 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 [this message]
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
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:
  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=CAJ51ETr7p9XF1BX0xSQLoZhnzVJPTM-evafJKqubVixT1vUG1g@mail.gmail.com \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric@ericabrahamsen.net \
    /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).