From: "Drew Adams" <drew.adams@oracle.com>
Subject: Q on after-change-functions
Date: Tue, 21 Feb 2006 17:57:53 -0800 [thread overview]
Message-ID: <MEEKKIABFKKDFJMPIOEBGEFFCPAA.drew.adams@oracle.com> (raw)
In Emacs 22 or 20 -
I do this:
(set-buffer (window-buffer (minibuffer-window)))
(add-hook 'after-change-functions 'foobar nil 'local)
(BTW, is there an easier way to get the minibuffer buffer than via its
window?)
Then I do this:
(set-buffer (window-buffer (minibuffer-window)))
(describe-variable 'after-change-functions)
That prints this, showing (I think) that `foobar' is in the minibuffer-local
value of `after-change-functions':
after-change-functions's value is (foobar t)
Local in buffer *Minibuf-0*; global value is nil
I then do this:
(defun foobar (a b c) (message "phooey!"))
When I then do, say, `M-x abcdef' I'm expecting that `foobar' will be called
each time I insert a character in the minibuffer: a b c ... Likewise each
time I delete characters from the minibuffer input. I'm expecting any change
to the text in buffer minibuffer to provoke `foobar'. (I haven't yet started
to wonder how to turn it off for things like prompt insertion!)
However, `foobar' never gets called, as seen by using `debug-on-entry
foobar' (and by the lack of any message from `foobar').
What am I missing? Suggestions? I'm trying to pick up any user changes to
input in the minibuffer. I don't, however, want to trigger `foobar' for
insertion of prompts and such by program.
Currently, I use a different approach, redefining several basic editing keys
(character, word, etc. insertion and deletion) so that they do both 1) their
normal thing and 2) call `foobar'. That works well, but I thought perhaps
`after-change-functions' might provide a simpler, more elegant
implementation. In any case, I'm curious about how it works.
next reply other threads:[~2006-02-22 1:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-22 1:57 Drew Adams [this message]
[not found] <mailman.1173.1140573492.2856.help-gnu-emacs@gnu.org>
2006-02-23 15:50 ` Q on after-change-functions Stefan Monnier
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=MEEKKIABFKKDFJMPIOEBGEFFCPAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
/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.
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).