From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Zoom: a window management minor mode -- best practices and questions Date: Tue, 08 May 2018 20:52:46 +0300 Message-ID: <83muxaox01.fsf@gnu.org> References: <83muxioten.fsf@gnu.org> <5AEAB616.4040900@gmx.at> <83603zqqfv.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1525802566 12265 195.159.176.226 (8 May 2018 18:02:46 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 8 May 2018 18:02:46 +0000 (UTC) Cc: rudalics@gmx.at, emacs-devel@gnu.org To: Andrea Cardaci Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 08 20:02:42 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fG6wj-00035H-QX for ged-emacs-devel@m.gmane.org; Tue, 08 May 2018 20:02:41 +0200 Original-Received: from localhost ([::1]:52741 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG6yq-0007sr-Tm for ged-emacs-devel@m.gmane.org; Tue, 08 May 2018 14:04:52 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG6nL-0005LA-VF for emacs-devel@gnu.org; Tue, 08 May 2018 13:53:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fG6nH-0005me-Bt for emacs-devel@gnu.org; Tue, 08 May 2018 13:53:00 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50855) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG6nH-0005mV-8S; Tue, 08 May 2018 13:52:55 -0400 Original-Received: from [176.228.60.248] (port=4624 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fG6nD-0000E2-Vw; Tue, 08 May 2018 13:52:55 -0400 In-reply-to: (message from Andrea Cardaci on Tue, 8 May 2018 12:40:01 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:225155 Archived-At: > From: Andrea Cardaci > Date: Tue, 8 May 2018 12:40:01 +0200 > Cc: martin rudalics , emacs-devel@gnu.org > > > I don't remember (perhaps Martin does). But if you show a C-level > > backtrace from such a call to buffer-list-update-hook, it will be easy > > to say whether this is expected or not. > > Is there a simple way to dump a backtrace from Emacs? > > It's easy to reproduce tough: > > (defun foo () > (message "buffer-list-update-hook")) > > (add-hook 'buffer-list-update-hook 'foo) > > then simply click in the selected window. > > Anyway according to the documentation this hook is called by > `select-window` which is actually called if you click on a window, > even if it is the selected one. Yes, and the comments in select-window say that it's important it moves the selected window's buffer to the front of various alists, which is done by record_buffer. So I guess this is a feature. Maybe we could be smarter, and avoid calling the hook if the buffer is already at the front of those alists.