From 6d864526b798904454df205f8381566954cf2605 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sun, 7 Apr 2024 16:03:10 +0300 Subject: [PATCH] org-offer-links-in-entry: Kill *Select Link* buffer on C-g * lisp/org.el (org-offer-links-in-entry): When selection is aborted via C-g, kill *Select Link* buffer. This is useful when the location of the buffer is customized via `display-buffer-alist' to be not in the same frame - then, `save-window-configuration' is not enough get rid of the temporary window. --- lisp/org.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 29c985672..d64b15477 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8781,8 +8781,8 @@ there is one, return it." (match-string 1 l))))))) (org-fit-window-to-buffer (get-buffer-window "*Select Link*")) (message "Select link to open, RET to open all:") - (setq c (read-char-exclusive)) - (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*")))) + (unwind-protect (setq c (read-char-exclusive)) + (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*"))))) (when (equal c ?q) (user-error "Abort")) (if (equal c ?\C-m) (setq link links)