diff --git a/lisp/org.el b/lisp/org.el index 532d5d68a..8c8741bce 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)))))