From: Sylvain Rousseau <thisirs@gmail.com>
To: Bastien <bzg@altern.org>
Cc: emacs-orgmode@gnu.org, Miro Bezjak <bezjak.miro@gmail.com>
Subject: Re: org-insert-link with HTML title as default description
Date: Sat, 29 Sep 2012 17:09:15 +0200 [thread overview]
Message-ID: <CAJ8n830FbuEWrv=xSBsaO3Fx1ZxAhKwNrsSf=_hABLBOfFyd8Q@mail.gmail.com> (raw)
In-Reply-To: <87r4pklwkb.fsf@bzg.ath.cx>
Hi Miro and Bastien,
This can be done by setting the function
`org-make-link-description-function'. However when set, the function
is supposed to handle all type of links and return a string no matter
what. There is no fallback mechanism. Here is a patch that fixes it:
diff --git a/lisp/org.el b/lisp/org.el
index bdb85de..3630623 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9527,10 +9527,12 @@ Use TAB to complete link prefixes, then RET for type-spe
(setq desc path))))
(if org-make-link-description-function
- (setq desc (funcall org-make-link-description-function link desc))
- (if default-description (setq desc default-description)
- (setq desc (or (and auto-desc desc)
- (read-string "Description: " desc)))))
+ (setq desc (or (funcall org-make-link-description-function link desc)
+ desc)))
+
+ (if default-description (setq desc default-description)
+ (setq desc (or (and auto-desc desc)
+ (read-string "Description: " desc))))
(unless (string-match "\\S-" desc) (setq desc nil))
(if remove (apply 'delete-region remove))
For example my `org-make-link-description-function' is:
(setq org-link-to-description
'(("\\`file:.*/\\([^/:]+\\)\\(::.*\\)" . "\\1")
("\\`file:.*/\\([^/:]+\\)" . "\\1")))
(setq org-make-link-description-function
(lambda (link description)
(let ((found (assoc-default link org-link-to-description
'string-match)))
(cond
((stringp found) (match-substitute-replacement found t
nil link))))))
HTH,
Sylvain.
next prev parent reply other threads:[~2012-09-29 15:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-29 12:23 org-insert-link with HTML title as default description Miro Bezjak
2012-09-29 14:42 ` Bastien
2012-09-29 15:09 ` Sylvain Rousseau [this message]
2012-09-29 18:43 ` Miro Bezjak
2012-09-29 20:53 ` Bastien
2012-09-29 23:00 ` Sylvain Rousseau
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='CAJ8n830FbuEWrv=xSBsaO3Fx1ZxAhKwNrsSf=_hABLBOfFyd8Q@mail.gmail.com' \
--to=thisirs@gmail.com \
--cc=bezjak.miro@gmail.com \
--cc=bzg@altern.org \
--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).