diff options
author | Bastien <bzg@gnu.org> | 2017-12-29 18:43:40 +0100 |
---|---|---|
committer | Bastien <bzg@gnu.org> | 2017-12-29 18:43:40 +0100 |
commit | 199908ba6293281996130f842fb630e43b661807 (patch) | |
tree | 49b4f518efd644445fb41a9442427c5623986ed6 | |
parent | 29dd9a66053d0cccd805bab5c925a03be72f2d13 (diff) | |
download | org-mode-199908ba6293281996130f842fb630e43b661807.tar.gz |
org: Enhance non-interactive calls to `org-insert-link`
* org.el (org-insert-link): When called non-interactivily,
don't allow to edit the default description.
-rw-r--r-- | lisp/org.el | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/org.el b/lisp/org.el index 9975cd9..def4274 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9905,7 +9905,8 @@ 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." +default link description. When called non-interactivily, don't +allow to edit the default description." (interactive "P") (let* ((wcf (current-window-configuration)) (origbuf (current-buffer)) @@ -10059,7 +10060,9 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (symbol-name org-make-link-description-function)) (sit-for 2) nil)))))) - (setq desc (read-string "Description: " initial-input)))) + (setq desc (if (called-interactively-p 'any) + (read-string "Description: " initial-input) + initial-input)))) (unless (string-match "\\S-" desc) (setq desc nil)) (when remove (apply 'delete-region remove)) |