all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Keep the link if the command was cancelled
@ 2023-06-30 22:11 Evgenii Klimov
  2023-07-03 12:48 ` Ihor Radchenko
  0 siblings, 1 reply; 13+ messages in thread
From: Evgenii Klimov @ 2023-06-30 22:11 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Evgenii Klimov

* lisp/ol.el (org-insert-link): Keep the link in `org-stored-links' if
the command was interrupted by the user during the reading of a
description from the minibuffer.
---
Currently the link is lost if the user chooses the link but cancells
the comand while writing the description.

 lisp/ol.el | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lisp/ol.el b/lisp/ol.el
index e2bf90acd..e48138ef9 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1896,11 +1896,6 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
       (or entry (push link org-link--insert-history))
       (setq desc (or desc (nth 1 entry)))))
 
-    (when (funcall (if (equal complete-file '(64)) 'not 'identity)
-		   (not org-link-keep-stored-after-insertion))
-      (setq org-stored-links (delq (assoc link org-stored-links)
-				   org-stored-links)))
-
     (when (and (string-match org-link-plain-re link)
 	       (not (string-match org-ts-regexp link)))
       ;; URL-like link, normalize the use of angular brackets.
@@ -1995,6 +1990,10 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
                      (read-string "Description: " initial-input)
                    initial-input)))
 
+    (when (funcall (if (equal complete-file '(64)) 'not 'identity)
+                   (not org-link-keep-stored-after-insertion))
+      (setq org-stored-links (delq (assoc link org-stored-links)
+                                   org-stored-links)))
     (unless (org-string-nw-p desc) (setq desc nil))
     (when remove (apply #'delete-region remove))
     (insert (org-link-make-string link desc))
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-07-16  8:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-30 22:11 [PATCH] Keep the link if the command was cancelled Evgenii Klimov
2023-07-03 12:48 ` Ihor Radchenko
2023-07-03 15:08   ` Max Nikulin
2023-07-03 15:11     ` Ihor Radchenko
2023-07-03 15:15       ` Max Nikulin
2023-07-03 15:28         ` Ihor Radchenko
2023-07-03 16:04           ` Evgenii Klimov
2023-07-03 16:20             ` Ihor Radchenko
2023-07-12 12:00           ` Max Nikulin
2023-07-16  8:46             ` Ihor Radchenko
2023-07-03 15:53   ` Evgenii Klimov
2023-07-03 23:43   ` [PATCH v2] " Evgenii Klimov
2023-07-04 10:48     ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.