From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Rose Subject: [Patch] Kill capture-template selection buffer after C-g Date: Sat, 26 Jun 2010 00:04:46 +0200 Message-ID: <87mxuibwg1.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=39819 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OSH0t-0000fp-Bh for emacs-orgmode@gnu.org; Fri, 25 Jun 2010 18:04:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OSH0s-0001iE-1l for emacs-orgmode@gnu.org; Fri, 25 Jun 2010 18:04:43 -0400 Received: from mail.gmx.net ([213.165.64.20]:37320) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OSH0r-0001hu-Lh for emacs-orgmode@gnu.org; Fri, 25 Jun 2010 18:04:41 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Emacs-orgmode mailing list --=-=-= `C-c c' brings up the template selection. If you press `C-g' to quit capturing, the buffer is not deleted. Instead the old window configuration is restored and the buffer is the second on the buffer stack. `C-x b' switches to the selection buffer again surprisingly. The appended patch fixes this issue. Carsten: this patch depends on the currently undocumented return value of `org-switch-to-buffer-other-window' (the newly created buffer). I'd suggest to either document it (see the second patch) or alter the patch: (setq buffer (get-buffer "*Org Select*")) --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=org-mks.el-kill-Org-Select-buffer.patch diff --git a/lisp/org-mks.el b/lisp/org-mks.el index abf5e79..6700fa2 100644 --- a/lisp/org-mks.el +++ b/lisp/org-mks.el @@ -54,9 +54,10 @@ also (\"key\" \"description\") entries. When they are selected, " (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) + (unwind-protect (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 @@ -121,7 +122,7 @@ also (\"key\" \"description\") entries. When they are selected, nil)) table)) (setq table (remove nil table))))) - (kill-buffer "*Org Select*") + (when buffer (kill-buffer "*Org Select*"))) rtn)) (provide 'org-mks) --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=org.el-document-return-value-of-function.patch 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))) --=-=-= Best wishes Sebastian --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--