Re: [PATCH] emacs: tweak error buffer handling

Subject: Re: [PATCH] emacs: tweak error buffer handling

Date: Tue, 25 Dec 2012 23:05:51 +0200

To: Mark Walters, notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


On Sat, Dec 22 2012, Mark Walters <markwalters1009@gmail.com> wrote:

> view-mode-enter changed between emacs 23 and emacs 24: the current
> code makes the error buffer disappear in emacs 24 on quitting it (ie
> pressing q) but this just kills the buffer without closing the split
> window in emacs 23.
>
> This patch makes the error buffer window disappear in emacs 23
> too. Since the view-mode-enter function changed we have to test for
> version and do the correct thing in each case.
> ---
>
> This seems to work but I have only tested on 23.4 and 24.2

I run emacs 23.1.1 to get the documentation of view-mode-enter
there. So, this patch instructs to delete WINDOW when exiting
view mode...

Documentation of pop-to-buffer says:

"Select buffer BUFFER-OR-NAME in some window, preferably a different one."

What if pop-up-windows's value is nil -- the content of current window
is replaced with this view stuff -- and when exiting view mode, the
window will be deleted ? What happens with emacs 24 in this case ?

Tomi

> Best wishes
>
> Mark
>
>
>
>  emacs/notmuch-lib.el |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 77a591d..0407f8a 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -324,15 +324,17 @@ the user dismisses it."
>  
>    (let ((buf (get-buffer-create "*Notmuch errors*")))
>      (with-current-buffer buf
> -      (view-mode-enter nil #'kill-buffer)
> +      (pop-to-buffer buf)
> +      (view-mode-enter (when (< emacs-major-version 24)
> +			   (cons (selected-window) (cons nil t)))
> +		       #'kill-buffer)
>        (let ((inhibit-read-only t))
>  	(goto-char (point-max))
>  	(unless (bobp)
>  	  (insert "\n"))
>  	(insert msg)
>  	(unless (bolp)
> -	  (insert "\n"))))
> -    (pop-to-buffer buf)))
> +	  (insert "\n"))))))
>  
>  (defun notmuch-check-async-exit-status (proc msg)
>    "If PROC exited abnormally, pop up an error buffer and signal an error.
> -- 
> 1.7.9.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

Thread: