emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sebastian Rose <sebastian_rose@gmx.de>
To: Emacs-orgmode mailing list <emacs-orgmode@gnu.org>
Subject: [Patch] Kill capture-template selection buffer after C-g
Date: Sat, 26 Jun 2010 00:04:46 +0200	[thread overview]
Message-ID: <87mxuibwg1.fsf@gmx.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 575 bytes --]


`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*"))



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-mks.el-kill-Org-Select-buffer.patch --]
[-- Type: text/x-diff, Size: 898 bytes --]

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)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: org.el-document-return-value-of-function.patch --]
[-- Type: text/x-diff, Size: 548 bytes --]

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)))

[-- Attachment #4: Type: text/plain, Size: 29 bytes --]



Best wishes

  Sebastian



[-- Attachment #5: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

             reply	other threads:[~2010-06-25 22:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-25 22:04 Sebastian Rose [this message]
2010-06-26  5:18 ` [Patch] Kill capture-template selection buffer after C-g Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mxuibwg1.fsf@gmx.de \
    --to=sebastian_rose@gmx.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).