unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Pete Beardmore <pete.beardmore@msn.com>
Cc: 8789@debbugs.gnu.org
Subject: bug#8789: 23.3; debug backtrace buffer changes window on step-through
Date: Fri, 03 Jun 2011 15:19:31 +0200	[thread overview]
Message-ID: <4DE8DF63.5050405@gmx.at> (raw)
In-Reply-To: <BLU0-SMTP1780198B51620B8A778E7328A7C0@phx.gbl>

 > A couple of my frame window layouts cause the emacs debugger's backtrace
 > buffer to cycle between several windows when stepping through code,
 > making it very difficult to focus.
 >
 > Please follow the minimal steps below to re-produce this undesirable
 > behaviour, also confirmed as present by another user (#emacs 'off-by-1')
 > in a 'relatively recent git version'..

I never use debug and don't have Emacs 23 installed, so I'm probably not
of very much help here.

 > emacs -q
 > C-x 3
 > C-x 2
 > M-x debug-on-entry RET
 > apropos RET
 > M-x apropos RET
 > x RET

IIUC this shows *backtrace* in the window on the right?

 > d RET
 > d RET

These steps happen without the RETs I presume?

 > ..you should see the buffer alternate windows on each step through the
 > code.

On my trunk the *backtrace* buffer is alternately shown in the left
lower and the right window, is that what you see?  That is, the left
upper window is never used?

I suppose it happens because `debug' contains this pretty fragile code

	      (save-window-excursion
	        ...
                 (pop-to-buffer debugger-buffer)

which I don't understand so I can only speculate.  Your three-window
setup apparently prevents the creation of a new window so Emacs is
forced to reuse an existing one.  Now repeating "d" does apparently

(1) remove *backtrace* from the window configuration, restoring the
     previous configuration, and

(2) pop to *backtrace* in any but the selected window (which is the left
     upper one).  Now, when it reuses a window, `display-buffer' first
     tries to use the least-recently-used one, which, in your scenario,
     is alternatingly one of the two lower windows.

You can verify (2) for yourself by replacing the line

		  (or (get-lru-window frame-to-use)

in `display-buffer' with the form

		  (or (let ((window (get-lru-window frame-to-use)))
			(when window
			  (message "%s" window)
			  (sit-for 3)
			  window))

and go through your scenario.

I don't have the slightest idea how to fix this though because I don't
understand why apparently the *backtrace* buffer is removed from display
in (1), and what the subsequent fragment

	  ;; Kill or at least neuter the backtrace buffer, so that users
	  ;; don't try to execute debugger commands in an invalid context.
	  (if (get-buffer-window debugger-buffer 0)
	      ;; Still visible despite the save-window-excursion?  Maybe it
	      ;; it's in a pop-up frame.  It would be annoying to delete and
	      ;; recreate it every time the debugger stops, so instead we'll
	      ;; erase it (and maybe hide it) but keep it alive.
	      (with-current-buffer debugger-buffer
		(erase-buffer)
		(fundamental-mode)
		(with-selected-window (get-buffer-window debugger-buffer 0)
                   (when (and (window-dedicated-p (selected-window))
                              (not debugger-will-be-back))
                     ;; If the window is not dedicated, burying the buffer
                     ;; will mean that the frame created for it is left
                     ;; around showing some random buffer, and next time we
                     ;; pop to the debugger buffer we'll create yet
                     ;; another frame.
                     ;; If debugger-will-be-back is non-nil, the frame
                     ;; would need to be de-iconified anyway immediately
                     ;; after when we re-enter the debugger, so iconifying it
                     ;; here would cause flashing.
                     ;; Drew Adams is not happy with this: he wants to frame
                     ;; to be left at the top-level, still working on how
                     ;; best to do that.
                     (bury-buffer))))
	    (kill-buffer debugger-buffer))

is needed for (despite its detailed comment).  So we need help from
someone familiar with the debug code :-(

martin





  parent reply	other threads:[~2011-06-03 13:19 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 [this message]
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
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=4DE8DF63.5050405@gmx.at \
    --to=rudalics@gmx.at \
    --cc=8789@debbugs.gnu.org \
    --cc=pete.beardmore@msn.com \
    /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.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).