From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Re: HowTo: Run a hook when a buffer becomes "current" Date: Fri, 18 Dec 2015 09:56:57 +0800 Message-ID: <87r3ikiknq.fsf@red-bean.com> References: Reply-To: Karl Fogel NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1450403844 22049 80.91.229.3 (18 Dec 2015 01:57:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 18 Dec 2015 01:57:24 +0000 (UTC) Cc: emacs-devel@gnu.org To: raman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 18 02:57:18 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 1a9kIH-0001T9-Hc for ged-emacs-devel@m.gmane.org; Fri, 18 Dec 2015 02:57:17 +0100 Original-Received: from localhost ([::1]:58023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9kIG-0005rJ-SM for ged-emacs-devel@m.gmane.org; Thu, 17 Dec 2015 20:57:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9kIC-0005r0-Mg for emacs-devel@gnu.org; Thu, 17 Dec 2015 20:57:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9kI8-0006Vm-Lt for emacs-devel@gnu.org; Thu, 17 Dec 2015 20:57:12 -0500 Original-Received: from mail-pf0-x232.google.com ([2607:f8b0:400e:c00::232]:33753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9kI8-0006Ve-G8 for emacs-devel@gnu.org; Thu, 17 Dec 2015 20:57:08 -0500 Original-Received: by mail-pf0-x232.google.com with SMTP id n128so22299470pfn.0 for ; Thu, 17 Dec 2015 17:57:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:reply-to:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=7PGLrW7NhMBBrrYYR3QFEEKUCfsXCvzJ1+WPwAJ/e2E=; b=SkpUKQLnRA3BdZWyU3wjVpymYxmB+Hc4fpfCOWGg+TRG5jQg6jN6aE1n4gCI3aYEHT LhGGjsvgC7AkTtvTk81PF47cyH3BYfAiyk7ag5Oaj5aIBnLRQPDMUq5DDkAVqvnoD+W4 YgFbHf/WTf34RVg9avi8mwqbLOd5xjFJfQDa3uCsRY+6RYiTtx8B86+mkFqRbl4iFb2B G9APNka9eFlsi+neksIZov6VVKCVsnRD25a5npt6zyY3P27DmEBCXd5fDp8nt8NVJFlX /TtyItUme9BBUU8QocGI8fJ+YlRpqdnVT6ROUNHcbf2nTI+1GKduIoXHIDyiRR3wrEbz M8iA== X-Received: by 10.98.75.77 with SMTP id y74mr1347974pfa.115.1450403827584; Thu, 17 Dec 2015 17:57:07 -0800 (PST) Original-Received: from klen ([1.209.122.28]) by smtp.gmail.com with ESMTPSA id l64sm13915961pfb.40.2015.12.17.17.57.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Dec 2015 17:57:06 -0800 (PST) In-Reply-To: (raman@google.com's message of "Wed, 16 Dec 2015 08:37:57 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::232 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:196444 Archived-At: raman writes: >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. > >Is there a hook that I'm missing, or is advice the only fallback I have? I'm curious what your larger goal is? (Would want to know that before suggesting `select-buffer-hook' be created :-) ...)