From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] frame.c: focus hooks Date: Tue, 14 Jan 2014 19:10:07 +0100 Message-ID: <52D57D7F.3040607@gmx.at> References: <528C65F3.9080502@gmx.at> <52D11C17.8040508@gmx.at> <52D26662.4050508@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1389723037 7781 80.91.229.3 (14 Jan 2014 18:10:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 14 Jan 2014 18:10:37 +0000 (UTC) Cc: Brian Jenkins , emacs-devel , Stefan Monnier , Bozhidar Batsov , rms@gnu.org To: Josh Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 14 19:10:43 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W38Rk-0004pS-Hp for ged-emacs-devel@m.gmane.org; Tue, 14 Jan 2014 19:10:40 +0100 Original-Received: from localhost ([::1]:49918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W38Rj-0004vA-Gw for ged-emacs-devel@m.gmane.org; Tue, 14 Jan 2014 13:10:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W38RW-0004p4-3k for emacs-devel@gnu.org; Tue, 14 Jan 2014 13:10:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W38RO-00055W-QP for emacs-devel@gnu.org; Tue, 14 Jan 2014 13:10:26 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:54030) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W38RO-00055A-H3 for emacs-devel@gnu.org; Tue, 14 Jan 2014 13:10:18 -0500 Original-Received: from [62.47.49.220] ([62.47.49.220]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0LjJCt-1VVRBP2AQh-00daQP for ; Tue, 14 Jan 2014 19:10:16 +0100 In-Reply-To: X-Provags-ID: V03:K0:Zg/zMSTDmINEpjps1AhgIPaxcak32G0EH+zSbvJ9/YDOzlRm7rw jC97IRJpiQD9ZEErbaxEMmIsHVTBdmAMC0FunQQdmB0dADauxWzkXcfIrZdPSK9WSkv0euW /HdAJENxKhfD7LVnE2vPJqLaRE5tBLQ8tMP2zJhqF7kOVQf1lxiUHyzYT54vEgQUpJoMRye dbG26wZ2Pk+5fuaXYsnxw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.15.18 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:168375 Archived-At: >> (1) The first interpretation means (implicitly) that we could replace >> the call to `buffer-list-update-hook' by calling instead something >> we could name `record-buffer-hook'. > > I'm not sure I understand. I see that near the end of select_window > we now call record_buffer, which in turn runs `buffer-list-update-hook'; > are you suggesting that if we went down this path then record_buffer > would run a new `record-buffer-hook' (and no longer run > `buffer-list-update-hook')? Yes. All callers of `buffer-list-update-hook' would then have to call `record-buffer-hook' too. >> You didn't explain _what_ you want to solve. Adding the name of the >> current buffer whenever a hook is run doesn't sound very reasonable to >> me. > > Sure, it was just an experiment intended to help me understand how > often that hook is run and under what conditions. Aha. You now know that it's run too often for your needs. But doesn't `select-window' also run too often for you, for example, when selecting the minibuffer window? > Thanks for explanation and suggestion. I'll experiment some more > to see if there's a reasonable way to obtain the desired behavior > with the existing machinery, which I agree would be better than > introducing a new hook. If you told me a bit what you the "desired behavior" is, I might provide suggestions. > Incidentally, I just noticed that though record_buffer runs > `buffer-list-update-hook' it's not mentioned in the docstring: > > Functions running this hook are `get-buffer-create', > `make-indirect-buffer', `rename-buffer', `kill-buffer', > and `bury-buffer-internal'. > > Perhaps this is intentional because record_buffer is not exposed at > the Lisp level, though? Hmm... Actually it's not there because I have added it only recently. Stefan soon detected some bug in the initial change so it's not safe yet either. That is, if you do something silly there, you might easily infloop or crash Emacs. But the same would obviously hold for a `select-window-hook'. martin