From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#8789: 23.3; debug backtrace buffer changes window on step-through Date: Fri, 03 Jun 2011 15:19:31 +0200 Message-ID: <4DE8DF63.5050405@gmx.at> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1307107239 10567 80.91.229.12 (3 Jun 2011 13:20:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 3 Jun 2011 13:20:39 +0000 (UTC) Cc: 8789@debbugs.gnu.org To: Pete Beardmore Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 03 15:20:34 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QSUIj-0003eB-SB for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Jun 2011 15:20:34 +0200 Original-Received: from localhost ([::1]:34656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QSUIi-0004Rv-K7 for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Jun 2011 09:20:32 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:51814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QSUII-0004NV-CY for bug-gnu-emacs@gnu.org; Fri, 03 Jun 2011 09:20:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QSUIG-0003BB-AL for bug-gnu-emacs@gnu.org; Fri, 03 Jun 2011 09:20:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60474) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QSUIF-0003Ar-VB for bug-gnu-emacs@gnu.org; Fri, 03 Jun 2011 09:20:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QSUIE-0001so-Qx; Fri, 03 Jun 2011 09:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Jun 2011 13:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8789 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8789-submit@debbugs.gnu.org id=B8789.13071071837205 (code B ref 8789); Fri, 03 Jun 2011 13:20:02 +0000 Original-Received: (at 8789) by debbugs.gnu.org; 3 Jun 2011 13:19:43 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QSUHv-0001s9-2S for submit@debbugs.gnu.org; Fri, 03 Jun 2011 09:19:43 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.22]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QSUHr-0001rw-PA for 8789@debbugs.gnu.org; Fri, 03 Jun 2011 09:19:41 -0400 Original-Received: (qmail invoked by alias); 03 Jun 2011 13:19:32 -0000 Original-Received: from 62-47-33-83.adsl.highway.telekom.at (EHLO [62.47.33.83]) [62.47.33.83] by mail.gmx.net (mp030) with SMTP; 03 Jun 2011 15:19:32 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1+LJPA4k4mL1AQeuYPtxSP2Hr8haoW1NhqwlCcb82 7dFEoeOb1l9zgI User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) In-Reply-To: X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 03 Jun 2011 09:20:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:46920 Archived-At: > 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