mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-07-16 10:16:26 +00:00
Clean up when aborting capture template selection
* lisp/org.el (org-switch-to-buffer-other-window): Return the buffer. Patch by Sebastian Rose.
This commit is contained in:
parent
3009fc46b3
commit
bbfca4a0e4
|
@ -48,15 +48,13 @@ under this key will be shown and offered for selection.
|
||||||
|
|
||||||
TITLE will be placed over the selection in the temporary buffer,
|
TITLE will be placed over the selection in the temporary buffer,
|
||||||
PROMPT will be used when prompting for a key. SPECIAL is an alist with
|
PROMPT will be used when prompting for a key. SPECIAL is an alist with
|
||||||
also (\"key\" \"description\") entries. When they are selected,
|
also (\"key\" \"description\") entries. When one of these is selection,
|
||||||
|
only the bare key is returned."
|
||||||
|
|
||||||
"
|
|
||||||
(setq prompt (or prompt "Select: "))
|
(setq prompt (or prompt "Select: "))
|
||||||
(let (tbl orig-table dkey ddesc des-keys allowed-keys
|
(let (tbl orig-table dkey ddesc des-keys allowed-keys
|
||||||
current prefix rtn re pressed)
|
current prefix rtn re pressed buffer (inhibit-quit t))
|
||||||
(save-window-excursion
|
(save-window-excursion
|
||||||
(org-switch-to-buffer-other-window "*Org Select*")
|
(setq buffer (org-switch-to-buffer-other-window "*Org Select*"))
|
||||||
(setq orig-table table)
|
(setq orig-table table)
|
||||||
(catch 'exit
|
(catch 'exit
|
||||||
(while t
|
(while t
|
||||||
|
@ -104,7 +102,9 @@ also (\"key\" \"description\") entries. When they are selected,
|
||||||
(message "Invalid key `%s'" pressed) (sit-for 1)
|
(message "Invalid key `%s'" pressed) (sit-for 1)
|
||||||
(message prompt)
|
(message prompt)
|
||||||
(setq pressed (char-to-string (read-char-exclusive))))
|
(setq pressed (char-to-string (read-char-exclusive))))
|
||||||
(if (equal pressed "\C-g") (error "Abort"))
|
(when (equal pressed "\C-g")
|
||||||
|
(kill-buffer buffer)
|
||||||
|
(error "Abort"))
|
||||||
(when (and (not (assoc pressed table))
|
(when (and (not (assoc pressed table))
|
||||||
(not (member pressed des-keys))
|
(not (member pressed des-keys))
|
||||||
(assoc pressed specials))
|
(assoc pressed specials))
|
||||||
|
@ -121,7 +121,7 @@ also (\"key\" \"description\") entries. When they are selected,
|
||||||
nil))
|
nil))
|
||||||
table))
|
table))
|
||||||
(setq table (remove nil table)))))
|
(setq table (remove nil table)))))
|
||||||
(kill-buffer "*Org Select*")
|
(when buffer (kill-buffer buffer))
|
||||||
rtn))
|
rtn))
|
||||||
|
|
||||||
(provide 'org-mks)
|
(provide 'org-mks)
|
||||||
|
|
|
@ -18143,7 +18143,8 @@ return nil."
|
||||||
|
|
||||||
(defun org-switch-to-buffer-other-window (&rest args)
|
(defun org-switch-to-buffer-other-window (&rest args)
|
||||||
"Switch to buffer in a second window on the current frame.
|
"Switch to buffer in a second window on the current frame.
|
||||||
In particular, do not allow pop-up frames."
|
In particular, do not allow pop-up frames.
|
||||||
|
Returns the newly created buffer."
|
||||||
(let (pop-up-frames special-display-buffer-names special-display-regexps
|
(let (pop-up-frames special-display-buffer-names special-display-regexps
|
||||||
special-display-function)
|
special-display-function)
|
||||||
(apply 'switch-to-buffer-other-window args)))
|
(apply 'switch-to-buffer-other-window args)))
|
||||||
|
|
Loading…
Reference in a new issue