all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dan Espen <despen@verizon.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Detect window switches?
Date: Fri, 27 Sep 2013 11:27:36 -0400	[thread overview]
Message-ID: <icsiwql1xz.fsf@home.home> (raw)
In-Reply-To: mailman.2973.1380261467.10748.help-gnu-emacs@gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Dan Espen <despen@verizon.net>
>> Date: Thu, 26 Sep 2013 16:15:52 -0400
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> From: Dan Espen <despen@verizon.net>
>> >> Date: Thu, 26 Sep 2013 15:22:58 -0400
>> >> 
>> >> Eli Zaretskii <eliz@gnu.org> writes:
>> >> 
>> >> >> From: Dan Espen <despen@verizon.net>
>> >> >> Date: Thu, 26 Sep 2013 14:22:15 -0400
>> >> >> 
>> >> >> My mode line changes color when a buffer changes from active/inactive.
>> >> >> Isn't that what the OP is looking for?
>> >> >
>> >> > That's done on the C level, and Lisp programs cannot hook into this.
>> >> 
>> >> Hmm, starting to sound like a bug.
>> >> Here's an event that Emacs acts on but doesn't make the
>> >> event visible to ELisp.
>> >
>> > No, Emacs doesn't act on this as an event.  What happens is that the
>> > next redisplay after a window switch redraws the mode line in a
>> > different face.  The redisplay isn't triggered by an event (because
>> > there is no such event), it is triggered by other means, mostly
>> > because Emacs becomes idle.  That could happen many seconds after the
>> > switch, if Emacs becomes busy calculating something, for example.
>> 
>> I only meant event with the meaning that something happens.
>
> But that's just it: nothing happened, as far as Emacs is concerned.
> As part of routine redisplay, Emacs displays the mode line of the
> selected window differently than it does with other windows.  It
> doesn't track whether a particular window was selected earlier and
> became non-selected now, so it doesn't know that "something's
> happened".  It just reflects the current state of affairs on the
> screen.
>
>> Here Emacs sees a buffer become active or inactive
>
> No, it doesn't know a buffer _became_ active, it just _finds_ it to be
> current or not current.
>
>> Well, it also changes the physical appearance of the keyboard cursor.
>> Mine goes from 3 pixels wide to 1.
>
> More of the same.

I think I understand.

Switching buffers tells Emacs to redraw everything.
Something else set the state flag to active or inactive
and the redraw routines just see the new flag.

So the place the hook is needed is where that state flag
is set.  And Emacs may need to add a test while setting
that state flag to see if it's a change in state so it
could run the new hook.

-- 
Dan Espen


  parent reply	other threads:[~2013-09-27 15:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2910.1380199959.10748.help-gnu-emacs@gnu.org>
2013-09-26 16:54 ` Detect window switches? Joost Kremers
2013-09-26 17:49   ` Eli Zaretskii
     [not found]   ` <mailman.2942.1380217810.10748.help-gnu-emacs@gnu.org>
2013-09-26 18:22     ` Dan Espen
2013-09-26 18:37       ` Eli Zaretskii
     [not found]       ` <mailman.2950.1380220732.10748.help-gnu-emacs@gnu.org>
2013-09-26 19:22         ` Dan Espen
2013-09-26 19:48           ` Eli Zaretskii
2013-09-26 20:27             ` Stefan Monnier
2013-09-27  6:01               ` Eli Zaretskii
2013-09-27 13:13                 ` Stefan Monnier
     [not found]           ` <mailman.2957.1380224960.10748.help-gnu-emacs@gnu.org>
2013-09-26 20:15             ` Dan Espen
2013-09-27  5:57               ` Eli Zaretskii
     [not found]               ` <mailman.2973.1380261467.10748.help-gnu-emacs@gnu.org>
2013-09-27 15:27                 ` Dan Espen [this message]
2013-09-26 20:54           ` Joost Kremers
2013-09-26 20:51     ` Joost Kremers
2013-09-27  5:48 martin rudalics
  -- strict thread matches above, loose matches on Subject: below --
2013-09-26 12:52 martin rudalics
2013-09-25  9:07 Joost Kremers
2013-09-25  9:28 ` Pascal J. Bourguignon
2013-09-25 21:30   ` Joost Kremers
2013-09-25 21:44     ` Eli Zaretskii
     [not found]     ` <mailman.2884.1380145465.10748.help-gnu-emacs@gnu.org>
2013-09-26  2:50       ` Joost Kremers
2013-09-26  6:45         ` Eli Zaretskii
     [not found]         ` <mailman.2899.1380177976.10748.help-gnu-emacs@gnu.org>
2013-09-26 10:23           ` Joost Kremers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=icsiwql1xz.fsf@home.home \
    --to=despen@verizon.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.