unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: bigfaceworm@hotmail.com (bigfaceworm)
Subject: Re: looking for: query-replace with a "yank-word" binding ala isearch
Date: 13 Nov 2002 09:53:57 -0800	[thread overview]
Message-ID: <2bd747c7.0211130953.68c7e867@posting.google.com> (raw)
In-Reply-To: 3DD13E7D.5060800@ihs.com

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))))))

      reply	other threads:[~2002-11-13 17:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-08  4:24 looking for: query-replace with a "yank-word" binding ala isearch bigfaceworm
2002-11-08 17:10 ` Kevin Rodgers
2002-11-11 16:36   ` looking for: query-replace with a yank-word " Ehud Karni
2002-11-11 22:21   ` looking for: query-replace with a "yank-word" " bigfaceworm
2002-11-12 17:46     ` Kevin Rodgers
2002-11-13 17:53       ` bigfaceworm [this message]

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=2bd747c7.0211130953.68c7e867@posting.google.com \
    --to=bigfaceworm@hotmail.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).