What would be the best way to implement an Emacs Lisp command that pops up the minibuffer, lets the user edit a search string there, and runs code to update the search results after each keystroke (or other command) that changes the minibuffer contents? To be specific, I'm asking about how to run a Lisp function in response to text changes; running a Lisp function in response to each keystroke may be close enough.
I'm talking about something that resembles the well-known incremental search (I-search) commands built into Emacs. isearch.el
shows that I-search itself sets up isearch-mode-map
such that each ASCII/multibyte character is manually mapped onto the isearch-printing-char
command. (It loops over all the numerical character codepoints and assigns the same command to each codepoint).
If possible, it would probably be easier to have normal minibuffer editing, and simply have a hook function that gets called after every keystroke (or other command) that changes the minibuffer contents.
post-command-hook
when you set up the minibuffer?M-e
to edit the search string). It uses the echo area, but with the cursor in that area. It can seem like it's using the minibuffer, but it's not.]