From: phillip.lord@newcastle.ac.uk (Phillip Lord)
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: pre-command-hook with input methods
Date: Tue, 10 Feb 2015 14:09:51 +0000 [thread overview]
Message-ID: <878ug53ljk.fsf@newcastle.ac.uk> (raw)
In-Reply-To: <jwvy4o7rrx2.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 9 Feb 2015 11:13:12 -0500")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> Maybe what you're after is just an input-event-hook?
>> I think for consistency, the hook should run immediately before or after
>> Emacs responds to C-u (or C-x) depending on whether it is pre- or post-.
>> Effectively, the C-x of a C-xC-f is, I think equivalent to the first "a"
>> of a "a`" post-fix input key sequence. The only reason that the former
>> works fine for me, and the latter is problematic is the latter changes the
>> display of the buffer while the former changes just the mini-buffer.
>
> So it sounds like you'd indeed be happy with an input-event-hook.
I think so yes -- so long as input-event means "user input-event" or I
have some way of telling. Something coming in from a process, or
file-watch notifications need to be ignored.
>> The other possibility is not to have an interaction hook but to have a
>> "the buffer has just changed in some way that is liable to cause a
>> redisplay"-hook. I don't know that this would be better. I throw it out
>> as a possibility, depending on which is easier.
>
> Then maybe the (new in 24.4) pre-redisplay-function could be used
> for that. Something like
>
> (add-function :before pre-redisplay-function
> (lambda (wins)
> (if (or (eq t wins)
> (memq <mybuffer> (mapcar #'window-buffer wins)))
> <take-foo-down>)))
>
> Of course, this will require some care, since a redisplay happens
> probably right after you've set things up (i.e. before you start
> waiting for user input), and you don't want *that* redisplay to trigger
> the <take-foo-down>.
Yes, that would be tricky. I'd probably have to ignore the first
redisplay after a completion has been offered. Also, my package does
idle cycle operations which include "sit-for" as a way of returning
control to the user. These trigger redisplay also which would be
unfortunate.
Probably they shouldn't do that. I *think* I added that so I could have
the idle-cycle operations add visible overlays for debugging purposes,
so the sit-for is necessary.
Still, it's there now, so I will give it a go. But having the
input-event-hook might be better.
Phil
next prev parent reply other threads:[~2015-02-10 14:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-05 13:28 pre-command-hook with input methods Phillip Lord
2015-02-05 20:19 ` Stefan Monnier
2015-02-06 13:55 ` Phillip Lord
2015-02-06 15:17 ` Stefan Monnier
2015-02-06 15:45 ` Phillip Lord
2015-02-06 23:58 ` Stefan Monnier
2015-02-09 10:47 ` Phillip Lord
2015-02-09 14:41 ` Stefan Monnier
2015-02-09 15:30 ` Phillip Lord
2015-02-09 16:13 ` Stefan Monnier
2015-02-10 14:09 ` Phillip Lord [this message]
2015-02-11 17:17 ` Phillip Lord
2015-02-11 19:21 ` Stefan Monnier
2015-02-12 10:27 ` Phillip Lord
2015-05-25 22:52 ` Stefan Monnier
2015-05-27 16:03 ` Phillip Lord
2015-05-27 19:45 ` Stefan Monnier
2015-05-27 21:54 ` Phillip Lord
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878ug53ljk.fsf@newcastle.ac.uk \
--to=phillip.lord@newcastle.ac.uk \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).