diff options
author | Bastien Guerry <bzg@altern.org> | 2012-09-29 22:38:26 +0200 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2012-09-29 22:38:26 +0200 |
commit | d9e5aed2aa5ea9e1df20d308a67d0bcaaa7b6e8a (patch) | |
tree | 5d4b48aab53edbcd049c5c0d1d2db1e63588ac11 | |
parent | ead43c9807cba47ffb6af075798b5ec17fcc5afc (diff) | |
download | org-mode-d9e5aed2aa5ea9e1df20d308a67d0bcaaa7b6e8a.tar.gz |
org.el: Fall back in interactive prompt when `org-make-link-description-function' fails
* org.el (org-make-link-description-function): Enhance
docstring.
(org-insert-link): Fall back on interactive prompt when
`org-make-link-description-function' fails.
Thanks to Sylvain Rousseau for triggering this.
-rw-r--r-- | lisp/org.el | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/org.el b/lisp/org.el index 532d5d6..8c8741b 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1395,11 +1395,11 @@ Changing this variable requires a restart of Emacs to become effective." (const :tag "Footnotes" footnote))) (defcustom org-make-link-description-function nil - "Function to use to generate link descriptions from links. -If nil the link location will be used. This function must take -two parameters; the first is the link and the second the -description `org-insert-link' has generated, and should return the -description to use." + "Function to use for generating link descriptions from links. +When nil, the link location will be used. This function must take +two parameters: the first one is the link, the second one is the +description generated by `org-insert-link'. The function should +return the description to use." :group 'org-link :type 'function) @@ -9497,7 +9497,13 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (setq desc path)))) (if org-make-link-description-function - (setq desc (funcall org-make-link-description-function link desc)) + (setq desc + (or (condition-case nil + (funcall org-make-link-description-function link desc) + (error (progn (message "Can't get link description from `%s'" + (symbol-name org-make-link-description-function)) + (sit-for 2) nil))) + (read-string "Description: " default-description))) (if default-description (setq desc default-description) (setq desc (or (and auto-desc desc) (read-string "Description: " desc))))) |