From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: HowTo: Run a hook when a buffer becomes "current" Date: Wed, 16 Dec 2015 23:58:37 -0500 Message-ID: References: Reply-To: rms@gnu.org NNTP-Posting-Host: plane.gmane.org Content-Type: text/plain; charset=Utf-8 X-Trace: ger.gmane.org 1450328347 3124 80.91.229.3 (17 Dec 2015 04:59:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 17 Dec 2015 04:59:07 +0000 (UTC) Cc: emacs-devel@gnu.org To: raman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 17 05:58:59 2015 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 1a9QeY-0001TR-9M for ged-emacs-devel@m.gmane.org; Thu, 17 Dec 2015 05:58:58 +0100 Original-Received: from localhost ([::1]:50801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9QeX-0002N2-Qv for ged-emacs-devel@m.gmane.org; Wed, 16 Dec 2015 23:58:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9QeG-0002Mb-AZ for emacs-devel@gnu.org; Wed, 16 Dec 2015 23:58:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9QeF-0005d7-D5 for emacs-devel@gnu.org; Wed, 16 Dec 2015 23:58:40 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9QeD-0005cR-TW; Wed, 16 Dec 2015 23:58:37 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1a9QeD-000275-BV; Wed, 16 Dec 2015 23:58:37 -0500 In-reply-to: (message from raman on Wed, 16 Dec 2015 08:37:57 -0800) 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.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:196415 Archived-At: [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > I was looking for a way of running a function when a buffer becomes > "current". I cant find any hooks in Emacs -- the closest is > buffer-list-update-hook -- but that gets called way too often including > when a buffer is buried, is visited transiently from within lisp code > etc. This is one of the hooks I decided we should not have. If changing the current buffer, with set-buffer for instance, can affect execution of code, you'll never be able to debug code when that hook is in use. -- Dr Richard Stallman President, Free Software Foundation (gnu.org, fsf.org) Internet Hall-of-Famer (internethalloffame.org) Skype: No way! See stallman.org/skype.html.