From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Detect window switches? Date: Thu, 26 Sep 2013 00:44:01 +0300 Message-ID: <831u4ch90e.fsf@gnu.org> References: <87a9j12qtx.fsf@informatimago.com> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1380145477 31119 80.91.229.3 (25 Sep 2013 21:44:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Sep 2013 21:44:37 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Sep 25 23:44:40 2013 Return-path: Envelope-to: geh-help-gnu-emacs@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 1VOwsx-0002Vb-Ik for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Sep 2013 23:44:39 +0200 Original-Received: from localhost ([::1]:55024 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOwsw-00084v-UP for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Sep 2013 17:44:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOwsa-0007tW-5t for help-gnu-emacs@gnu.org; Wed, 25 Sep 2013 17:44:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOwsS-0001Cr-Jy for help-gnu-emacs@gnu.org; Wed, 25 Sep 2013 17:44:15 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:44953) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOwsS-0001CZ-BE for help-gnu-emacs@gnu.org; Wed, 25 Sep 2013 17:44:08 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MTP00100AUIIZ00@a-mtaout20.012.net.il> for help-gnu-emacs@gnu.org; Thu, 26 Sep 2013 00:44:06 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MTP00129B1I6D90@a-mtaout20.012.net.il> for help-gnu-emacs@gnu.org; Thu, 26 Sep 2013 00:44:06 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:93589 Archived-At: > From: Joost Kremers > Date: 25 Sep 2013 21:30:37 GMT > > Pascal J. Bourguignon wrote: > > Joost Kremers writes: > > > >> Is there a way in Emacs to detect a window switch? Basically, I'd like > >> to perform an action when a window showing a particular buffer gains or > >> loses focus. Is there a hook or something that exposes this to Elisp? > > > > have a look at: window-configuration-change-hook > > I guess you will have to filter the exact condition yourself. > > Mmm, the documentation of that hook says that "[t]he buffer-local part > of this hook is run once for each window on the affected frame, > with the relevant window selected and its buffer current." That doesn't > seem to leave much room for determining if the relevant window has just > lost focus. Instead of selecting a solution, all by yourself, to a problem you don't describe, and asking details about that solution, I suggest to step back one notch and describe the problem you are trying to solve. It is quite possible that solutions other and better than "detect a window switch" will be suggested.