From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: How to set org-make-link-description-function Date: Thu, 12 Apr 2018 19:05:30 -0700 Message-ID: References: <87bmeo53ji.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114b41128b20e10569b14e19" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f6o5m-00029I-QR for emacs-orgmode@gnu.org; Thu, 12 Apr 2018 22:05:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f6o5l-0004eH-M0 for emacs-orgmode@gnu.org; Thu, 12 Apr 2018 22:05:34 -0400 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]:39347) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f6o5l-0004c3-98 for emacs-orgmode@gnu.org; Thu, 12 Apr 2018 22:05:33 -0400 Received: by mail-wm0-x230.google.com with SMTP id b21so1474005wme.4 for ; Thu, 12 Apr 2018 19:05:32 -0700 (PDT) In-Reply-To: <87bmeo53ji.fsf@ericabrahamsen.net> 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: Eric Abrahamsen Cc: org-mode-email --001a114b41128b20e10569b14e19 Content-Type: text/plain; charset="UTF-8" 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 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 > > > --001a114b41128b20e10569b14e19 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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=
=C2=A0 =C2=A0 =C2=A0 (lambda (link desc)
(cond
((s-starts-with? "ebdb:uuid/" link)
=C2=A0 (replace-regexp-in-string "ebdb= :uuid/" "" link))
= (t
=C2=A0 desc))= ))
#+END_SRC

It doesn't seem t= oo ideal, as it seems like something that should get set in the link parame= ters.=C2=A0

Does anyone else have an idea?

John

-----------------------------------
Professor John = Kitchin=C2=A0
Doherty Hall A207F
Department of Chemical EngineeringCarnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
<= div dir=3D"ltr">@johnkitchin
http://kitchingroup.cheme.cmu.edu


On Thu, Apr 12, 2018 at 5:54 PM, Eric Abraha= msen <eric@ericabrahamsen.net> wrote:
I've coded Org link support for EBDB, a contact manag= ement package,
where the :complete key looks like:

(lambda ()
=C2=A0 (format "ebdb:uuid/%s"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (ebdb-record-uuid
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(ebdb-prompt-for-record
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (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 t= o
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 se= t it
globally, but also don't know how to let-bind it locally.

How am I supposed to use it?

Thanks,
Eric



--001a114b41128b20e10569b14e19--