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: Thu, 16 Feb 2012 09:03:15 +0100 Message-ID: <4F3CB843.6030401@gmx.at> References: <4DE8DF63.5050405@gmx.at> <87haz0po82.fsf@web.de> <4F3BE4CB.3030909@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1329379474 26372 80.91.229.3 (16 Feb 2012 08:04:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 16 Feb 2012 08:04:34 +0000 (UTC) Cc: michael_heerdegen@web.de, 8789@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 16 09:04:29 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RxwKK-0000Yj-RF for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Feb 2012 09:04:29 +0100 Original-Received: from localhost ([::1]:42220 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxwKI-0002i8-0w for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Feb 2012 03:04:26 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:33939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxwKA-0002hp-6X for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2012 03:04:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RxwK8-0004k9-9G for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2012 03:04:18 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxwK8-0004k3-5z for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2012 03:04:16 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RxwLq-00085i-2z for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2012 03:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Feb 2012 08:06: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.132937951331046 (code B ref 8789); Thu, 16 Feb 2012 08:06:02 +0000 Original-Received: (at 8789) by debbugs.gnu.org; 16 Feb 2012 08:05:13 +0000 Original-Received: from localhost ([127.0.0.1]:42133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RxwL2-00084h-Ml for submit@debbugs.gnu.org; Thu, 16 Feb 2012 03:05:12 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:34030) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RxwKz-00084N-Ua for 8789@debbugs.gnu.org; Thu, 16 Feb 2012 03:05:11 -0500 Original-Received: (qmail invoked by alias); 16 Feb 2012 08:03:17 -0000 Original-Received: from 62-47-33-194.adsl.highway.telekom.at (EHLO [62.47.33.194]) [62.47.33.194] by mail.gmx.net (mp004) with SMTP; 16 Feb 2012 09:03:17 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1/2HdF1qBz2vcAgtENx9mrSVfW9uSsAVFeYW1xkzP Bd7ttu1braCrGq In-Reply-To: X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:56932 Archived-At: > 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