all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: michael_heerdegen@web.de, 8789@debbugs.gnu.org
Subject: bug#8789: 23.3; debug backtrace buffer changes window on step-through
Date: Thu, 16 Feb 2012 09:03:15 +0100	[thread overview]
Message-ID: <4F3CB843.6030401@gmx.at> (raw)
In-Reply-To: <jwvmx8jc41i.fsf-monnier+emacs@gnu.org>

 > Sounds good for the backtrace buffer, but the patch you propose would
 > affect many more cases, and while I think it might be good to do it
 > globally like you suggest, I wouldn't want to make such a change so late
 > in the pretest.

Neither do I.  The problem is that if a window is not very suitable for
getting reused, there's no easy way for the user (or the application) to
communicate that to the buffer display routines.

 > Can you provide another patch that limits the effect to the
 > backtrace buffer?

Can you?  I think that using `display-buffer-overriding-action' would be
too harsh so we would have to specify this via the ACTION argument in
(pop-to-buffer debugger-buffer).  A patch in that direction is below.

martin


=== modified file 'lisp/emacs-lisp/debug.el'
--- lisp/emacs-lisp/debug.el	2012-01-19 07:21:25 +0000
+++ lisp/emacs-lisp/debug.el	2012-02-16 07:51:35 +0000
@@ -194,7 +194,9 @@
  		  ;; Place an extra debug-on-exit for macro's.
  		  (when (eq 'lambda (car-safe (cadr (backtrace-frame 4))))
  		    (backtrace-debug 5 t)))
-                (pop-to-buffer debugger-buffer)
+                (pop-to-buffer
+		 debugger-buffer
+		 '((display-buffer-in-window-previously-showing-it . nil)))
  		(debugger-mode)
  		(debugger-setup-buffer debugger-args)
  		(when noninteractive

=== modified file 'lisp/window.el'
--- lisp/window.el	2012-02-12 05:10:30 +0000
+++ lisp/window.el	2012-02-16 07:54:35 +0000
@@ -4846,6 +4846,22 @@
        (and pop-up-windows
  	   (display-buffer-pop-up-window buffer alist))))

+(defun display-buffer-in-window-previously-showing-it (buffer &optional alist)
+  "Display BUFFER in a window previously showing it."
+  (let (best-window second-best-window window)
+    (catch 'best-window
+      (dolist (window (window-list-1 nil 'nomini 'visible))
+	(when (and (assq buffer (window-prev-buffers window))
+		   (not (window-dedicated-p window)))
+	  (if (eq window (selected-window))
+	      (setq second-best-window window)
+	    (setq best-window window)
+	    (throw 'best-window t)))))
+
+    (when (setq window (or best-window second-best-window))
+      (display-buffer-record-window 'reuse window buffer)
+      (window--display-buffer-2 buffer window display-buffer-mark-dedicated))))
+
  (defun display-buffer-use-some-window (buffer alist)
    "Display BUFFER in an existing window.
  Search for a usable window, set that window to the buffer, and







  reply	other threads:[~2012-02-16  8:03 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02 17:07 bug#8789: 23.3; debug backtrace buffer changes window on step-through Pete Beardmore
2011-06-02 18:00 ` Drew Adams
2011-06-03 13:19 ` martin rudalics
2011-06-08 15:29   ` Stefan Monnier
2012-02-09  5:31     ` Michael Heerdegen
2012-02-09 18:21       ` Stefan Monnier
2012-02-11  0:04         ` Michael Heerdegen
2012-02-15 17:00         ` martin rudalics
2012-02-15 19:05           ` Stefan Monnier
2012-02-16  8:03             ` martin rudalics [this message]
2012-02-16 13:52               ` Stefan Monnier
2012-02-16 17:50                 ` martin rudalics
2012-02-16 21:53                   ` Michael Heerdegen
2012-02-17  9:58                     ` martin rudalics
2012-02-24 18:42                     ` martin rudalics
2012-02-28 23:56                       ` Michael Heerdegen
2012-02-29  8:47                         ` martin rudalics
2012-03-03 19:48                           ` Michael Heerdegen
2012-09-08 13:33                     ` martin rudalics
2012-09-12 14:20                       ` Michael Heerdegen
2012-09-12 15:50                         ` martin rudalics
2012-10-19  7:53                           ` Michael Heerdegen
2012-10-19 10:02                             ` martin rudalics
2012-09-17 20:34                         ` Drew Adams
2012-09-17 22:30                           ` martin rudalics
2012-09-17 22:46                             ` Drew Adams
2012-09-18  7:10                               ` martin rudalics
2012-09-18 14:28                                 ` Drew Adams
2012-09-19 16:46                                   ` Drew Adams
2012-09-19 17:10                                     ` martin rudalics
2012-09-19 17:48                                       ` Drew Adams
2012-09-19 20:39                                         ` Drew Adams
2012-09-19 20:55                                           ` Drew Adams
2012-09-20 13:50                                             ` martin rudalics
2012-09-20 18:22                                               ` Drew Adams
2012-09-20 13:50                                           ` martin rudalics
2012-09-20 17:10                                             ` Michael Heerdegen
2012-09-20 17:26                                               ` martin rudalics
2012-09-20 18:08                                                 ` Drew Adams
2012-09-20 18:30                                                   ` Eli Zaretskii
2012-09-20 18:49                                                     ` Drew Adams
2012-09-20 20:41                                                       ` Eli Zaretskii
2012-09-20 20:59                                                         ` Drew Adams
2012-09-20 22:15                                                           ` Stefan Monnier
2012-09-20 20:17                                                     ` Michael Heerdegen
2012-09-20 20:34                                                       ` Drew Adams
2012-09-20 20:52                                                         ` Eli Zaretskii
2012-09-20 21:11                                                           ` Drew Adams
2012-09-20 21:25                                                         ` Michael Heerdegen
2012-09-20 21:33                                                           ` Drew Adams
2012-09-20 22:01                                                             ` Michael Heerdegen
2012-09-20 23:16                                                               ` Drew Adams
2012-09-19 17:17                                     ` Drew Adams
2012-10-03  9:13                       ` martin rudalics
2012-10-03 16:09                         ` Drew Adams
2012-03-11 18:14           ` martin rudalics
2012-02-09 18:24       ` martin rudalics
2012-02-11  0:00         ` Michael Heerdegen

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

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

  git send-email \
    --in-reply-to=4F3CB843.6030401@gmx.at \
    --to=rudalics@gmx.at \
    --cc=8789@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@IRO.UMontreal.CA \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.