Subject: bug#12034: closed (Re: bug#12034: 24.1.50; pp-display-expression may select deleted window)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 25 Jul 2012 09:55:01 +0000

Your bug report

#12034: 24.1.50; pp-display-expression may select deleted window

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
12034: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12034
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#12034: 24.1.50; pp-display-expression may select deleted window
From: martin rudalics <[email-masked]>
To: [email-masked]
Date: Wed, 25 Jul 2012 11:47:51 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> In pp-display-expression there is this sexp:
> 
>     (let ((temp-buffer-show-function old-show-function)
>           (old-selected (selected-window))
>           (window (display-buffer buf)))
>                   ^^^^^^^^^^^^^^^^^^^^
>       (goto-char (point-min)) ; expected by some hooks ...
>       (make-frame-visible (window-frame window))
>       (unwind-protect
>           (progn
>             (select-window window)
>             (run-hooks 'temp-buffer-show-hook))
>         (select-window old-selected)
>         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>         (message "See buffer %s." out-buffer-name)))
> 
> An user may implement an overriding action for display-buffer that could
> delete old-selected.

Patch applied, bug closed.

Thanks, martin

Subject: 24.1.50; pp-display-expression may select deleted window
From: Christopher Schmidt <[email-masked]>
To: [email-masked]
Date: Mon, 23 Jul 2012 15:04:32 +0100 (BST)
List-Id: <debbugs-submit.debbugs.gnu.org>

In pp-display-expression there is this sexp:

    (let ((temp-buffer-show-function old-show-function)
          (old-selected (selected-window))
          (window (display-buffer buf)))
                  ^^^^^^^^^^^^^^^^^^^^
      (goto-char (point-min)) ; expected by some hooks ...
      (make-frame-visible (window-frame window))
      (unwind-protect
          (progn
            (select-window window)
            (run-hooks 'temp-buffer-show-hook))
        (select-window old-selected)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        (message "See buffer %s." out-buffer-name)))

An user may implement an overriding action for display-buffer that could
delete old-selected.
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2012-07-22 21:14:12 +0000
+++ lisp/ChangeLog	2012-07-23 12:49:21 +0000
@@ -1,3 +1,8 @@
+2012-07-23  Christopher Schmidt  <[email-masked]>
+
+	* emacs-lisp/pp.el (pp-display-expression): Select old selected
+	window only if it is still live (Bug#).
+
 2012-07-22  Vincent Belaïche  <[email-masked]>
 
 	* ses.el (ses-cell-formula-aset): New macro.

=== modified file 'lisp/emacs-lisp/pp.el'
--- lisp/emacs-lisp/pp.el	2012-02-05 02:09:35 +0000
+++ lisp/emacs-lisp/pp.el	2012-07-23 12:44:07 +0000
@@ -110,7 +110,8 @@
 			 (progn
 			   (select-window window)
 			   (run-hooks 'temp-buffer-show-hook))
-		       (select-window old-selected)
+		       (when (window-live-p old-selected)
+			 (select-window old-selected))
 		       (message "See buffer %s." out-buffer-name)))
 		 (message "%s" (buffer-substring (point-min) (point)))
 		 ))))))

        Christopher