emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Patch] Kill capture-template selection buffer after C-g
@ 2010-06-25 22:04 Sebastian Rose
  2010-06-26  5:18 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Rose @ 2010-06-25 22:04 UTC (permalink / raw)
  To: Emacs-orgmode mailing list

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] Kill capture-template selection buffer after C-g
  2010-06-25 22:04 [Patch] Kill capture-template selection buffer after C-g Sebastian Rose
@ 2010-06-26  5:18 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2010-06-26  5:18 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: Emacs-orgmode mailing list

Applied, with modification, thanks

- Carsten

On Jun 26, 2010, at 12:04 AM, Sebastian Rose wrote:

>
> `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*"))
>
>
> <org-mks.el-kill-Org-Select-buffer.patch><org.el-document-return- 
> value-of-function.patch>
>
> Best wishes
>
>  Sebastian
>
>
> _______________________________________________
> 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

- Carsten

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-26  5:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-25 22:04 [Patch] Kill capture-template selection buffer after C-g Sebastian Rose
2010-06-26  5:18 ` Carsten Dominik

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