|
@@ -1939,10 +1939,10 @@ in the Org buffer so that the change takes effect."
|
|
|
|
|
|
(defcustom org-make-link-description-function nil
|
|
|
"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."
|
|
|
+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 '(choice (const nil) (function)))
|
|
|
|
|
@@ -10152,15 +10152,14 @@ the current directory or below.
|
|
|
A `\\[universal-argument] \\[universal-argument] \\[universal-argument]' \
|
|
|
prefix negates `org-keep-stored-link-after-insertion'.
|
|
|
|
|
|
-If `org-make-link-description-function' is non-nil, this function will be
|
|
|
-called with the link target, and the result will be the default
|
|
|
-link description.
|
|
|
-
|
|
|
If the LINK-LOCATION parameter is non-nil, this value will be used as
|
|
|
the link location instead of reading one interactively.
|
|
|
|
|
|
-If the DEFAULT-DESCRIPTION parameter is non-nil, this value will be used
|
|
|
-as the default description."
|
|
|
+If the DEFAULT-DESCRIPTION parameter is non-nil, this value will
|
|
|
+be used as the default description. Otherwise, if
|
|
|
+`org-make-link-description-function' is non-nil, this function
|
|
|
+will be called with the link target, and the result will be the
|
|
|
+default link description."
|
|
|
(interactive "P")
|
|
|
(let* ((wcf (current-window-configuration))
|
|
|
(origbuf (current-buffer))
|
|
@@ -10294,17 +10293,19 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
|
|
|
(when (equal desc origpath)
|
|
|
(setq desc path)))))
|
|
|
|
|
|
- (if org-make-link-description-function
|
|
|
- (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)))))
|
|
|
+ (unless auto-desc
|
|
|
+ (let ((initial-input
|
|
|
+ (cond
|
|
|
+ (default-description)
|
|
|
+ ((not org-make-link-description-function) desc)
|
|
|
+ (t (condition-case nil
|
|
|
+ (funcall org-make-link-description-function link desc)
|
|
|
+ (error
|
|
|
+ (message "Can't get link description from `%s'"
|
|
|
+ (symbol-name org-make-link-description-function))
|
|
|
+ (sit-for 2)
|
|
|
+ nil))))))
|
|
|
+ (setq desc (read-string "Description: " initial-input))))
|
|
|
|
|
|
(unless (string-match "\\S-" desc) (setq desc nil))
|
|
|
(when remove (apply 'delete-region remove))
|