summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-06-26 07:17:57 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2010-06-26 07:18:27 +0200
commitbbfca4a0e43fdc843375e5073a7cb10cf919d18e (patch)
tree0f2d2766f3bf709f6294479c08c99edd3d6f7905
parent3009fc46b38b606c61f283a40bf80c97019c650e (diff)
downloadorg-mode-bbfca4a0e43fdc843375e5073a7cb10cf919d18e.tar.gz
Clean up when aborting capture template selection
* lisp/org.el (org-switch-to-buffer-other-window): Return the buffer. Patch by Sebastian Rose.
-rw-r--r--lisp/org-mks.el16
-rw-r--r--lisp/org.el3
2 files changed, 10 insertions, 9 deletions
diff --git a/lisp/org-mks.el b/lisp/org-mks.el
index abf5e79..4a49a2b 100644
--- a/lisp/org-mks.el
+++ b/lisp/org-mks.el
@@ -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,
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: "))
(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
- (org-switch-to-buffer-other-window "*Org Select*")
+ (setq buffer (org-switch-to-buffer-other-window "*Org Select*"))
(setq orig-table table)
(catch 'exit
(while t
@@ -104,7 +102,9 @@ also (\"key\" \"description\") entries. When they are selected,
(message "Invalid key `%s'" pressed) (sit-for 1)
(message prompt)
(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))
(not (member pressed des-keys))
(assoc pressed specials))
@@ -121,7 +121,7 @@ also (\"key\" \"description\") entries. When they are selected,
nil))
table))
(setq table (remove nil table)))))
- (kill-buffer "*Org Select*")
+ (when buffer (kill-buffer buffer))
rtn))
(provide 'org-mks)
diff --git a/lisp/org.el b/lisp/org.el
index 7bb4f45..517f782 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18143,7 +18143,8 @@ return nil."
(defun org-switch-to-buffer-other-window (&rest args)
"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
special-display-function)
(apply 'switch-to-buffer-other-window args)))