all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Update `minibuffer-line' on buffer switches
Date: Sun, 28 Jun 2015 23:36:51 -0400	[thread overview]
Message-ID: <jwv4mlrry45.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: mailman.5854.1435513096.904.help-gnu-emacs@gnu.org

> very expensive.  Furthermore, it would be nice to have hook(s)
> corresponding to buffer switching, e.g. tracking an event of entering
> (transferring focus) to another buffer.

These are actually fairly tricky to define in a way that corresponds to
your intuitive understanding.

But you might get partway there, by doing something like

  (add-function :after pre-redisplay-function
                (lambda (windows)
                  ;; Only recompute if we've switched window, or if
                  ;; (force-mode-line-update t) has been called.
                  (unless (and (consp windows) (null (cdr windows)))
                    (minibuffer-line--update))))

> Wouldn't Emacs 25 benefit the flexibility offered by such hooks?
> What do you think Stefan?

"switching buffer" already has a hook: window-configuration-change-hook.
Changing which window is selected does not have a hook, OTOH.

Adding a hook to `select-window' could work, but could be a bit tricky
since this function is sometimes used internally at places which don't
correspond to something which the end-user would consider as relevant.

I guess we could synthesize such a hook with pre-redisplay-function by
comparing the current selected-window with the window that was selected
last time pre-redisplay-function was run (or the same could be done with
post-command-hook).  Not sure how often that would be useful.


        Stefan


  parent reply	other threads:[~2015-06-29  3:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-27 14:22 Update `minibuffer-line' on buffer switches Alexander Shukaev
2015-06-27 15:43 ` Michael Heerdegen
2015-06-27 21:59   ` Stefan Monnier
2015-06-28 17:19     ` Alexander Shukaev
2015-06-28 17:38       ` Alexander Shukaev
     [not found]       ` <mailman.5854.1435513096.904.help-gnu-emacs@gnu.org>
2015-06-29  3:36         ` Stefan Monnier [this message]
2015-06-29 16:31           ` Alexander Shukaev
2015-06-29 17:00             ` Eli Zaretskii
2015-06-29 19:02               ` Alexander Shukaev
2015-06-29 19:50                 ` Alexander Shukaev
  -- strict thread matches above, loose matches on Subject: below --
2015-06-29 17:15 martin rudalics
2015-06-29 19:00 ` Alexander Shukaev

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=jwv4mlrry45.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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.