[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: looking for: query-replace with a "yank-word" binding ala isearch
From: |
bigfaceworm |
Subject: |
Re: looking for: query-replace with a "yank-word" binding ala isearch |
Date: |
13 Nov 2002 09:53:57 -0800 |
Works great, thanks.
But I'm confused now.
I didn't expect the code to work b/c I don't see how subsequent calls to
'bfw-insert-word would insert more and more words. I expected the
'save-excursion to save the point&mark in the minibuffer-scroll-window (as
well as the state of the current buffer (minibuffer).
But... the documentation says it just saves the point&mark in the current
buffer - a distinction I didn't realize before.
So, this code works b/c we're actually moving the point in the
minibuffer-scroll-window? (which is protected by a larger save-excursion
inside of the query-replace)?
That is probably why the debugged version worked (like Kevin pointed out).
Learn a new thing every day...
BFW
Kevin Rodgers <kevinr@ihs.com> wrote in message
news:<3DD13E7D.5060800@ihs.com>...
> Why should the contents of the minibuffer affect what text is inserted?
>
> (defun bfw-insert-word ()
> "Insert the word after point from the selected buffer into the minibuffer.
> This advances point in the selected buffer."
> (interactive)
> (insert (save-excursion
> (set-buffer (window-buffer minibuffer-scroll-window))
> (buffer-substring (point)
> (progn (forward-word 1) (point))))))