From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: request: make-frame-visible hook Date: Sat, 21 Feb 2009 03:11:36 +0100 Message-ID: <877i3ky1wn.fsf@kfs-lx.rd.rdm> References: <87zlgjis69.fsf@earthlink.net> <87vdr7i5cc.fsf@earthlink.net> <87ljs199so.fsf@catnip.gol.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1235182354 28720 80.91.229.12 (21 Feb 2009 02:12:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Feb 2009 02:12:34 +0000 (UTC) Cc: emacs-devel@gnu.org To: Miles Bader Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 21 03:13:49 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LahMo-0000Is-Hy for ged-emacs-devel@m.gmane.org; Sat, 21 Feb 2009 03:13:22 +0100 Original-Received: from localhost ([127.0.0.1]:45712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LahLU-0000hx-0T for ged-emacs-devel@m.gmane.org; Fri, 20 Feb 2009 21:12:00 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LahLO-0000gM-5m for emacs-devel@gnu.org; Fri, 20 Feb 2009 21:11:54 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LahLM-0000gA-Jb for emacs-devel@gnu.org; Fri, 20 Feb 2009 21:11:52 -0500 Original-Received: from [199.232.76.173] (port=37529 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LahLM-0000g7-Ef for emacs-devel@gnu.org; Fri, 20 Feb 2009 21:11:52 -0500 Original-Received: from mail1-hoer.fullrate.dk ([90.185.1.42]:53003 helo=smtp.fullrate.dk) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LahLI-00020e-Ql; Fri, 20 Feb 2009 21:11:49 -0500 Original-Received: from kfs-lx.rd.rdm.cua.dk (unknown [90.184.173.152]) by smtp.fullrate.dk (Postfix) with SMTP id 0A5F89CDCE; Sat, 21 Feb 2009 03:11:36 +0100 (CET) In-Reply-To: <87ljs199so.fsf@catnip.gol.com> (Miles Bader's message of "Fri, 20 Feb 2009 10:28:07 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:109266 Archived-At: Miles Bader writes: > Lynbech Christian writes: >> Alternatively you can consider using post-command-hook, this is run all >> the time and this particular problem should not pose a performance >> problem. > > Using post-command-hook _will_ pose a performance problem if everybody > and their dog gets in the habit of using it... I know people are repeating this claim again and again as "gospel truth". However, I strongly doubt this is really true in practice. The amount of lisp code executed in the post-command-hook is not nearly comparable to the amount of work done in redisplay for every (non-trivial) keypress... E.g. just hitting RET performs - I would guess - 1000 times the code anybody has every put into the post-command-hook... IMO, the real problem using post-command-hook is that there is no way to control the sequence of things that is done via that hook - so if you have two packages putting stuff on the hook - and they both do something which modifies either buffer contents or visual appearence - then users may see different results depending on which package is loaded first. So I agree that using post-command-hook is not a good thing .. unfortunately there are not many hooks in Emacs which can do global things - and there seem to be a reluctance to adding "necessary" hooks (in the sense that the alternative is to use post-commmand-hook). E.g. where is: before-modify-buffer-hook (run before changing buffer) after-modify-buffer-hook (run after changing buffer) before-cursor-move-hook after-cursor-move-hook before-window-buffer-change-hook after-window-buffer-change-hook focus-window-hook unfocus-window-hook enter-buffer-hook exit-buffer-hook etc. etc. etc. I'm not going to discuss semantics of those hooks here, but these things are typically used for stuff that would currently involve pre-command-hook and post-command-hook code to notice and react to specific state changes. -- Kim F. Storm http://www.cua.dk