bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: search,query replace UI Question


From: Kevin Rodgers
Subject: Re: search,query replace UI Question
Date: Mon, 01 Oct 2001 12:58:08 -0600

"Sivaram N" wrote:
> C-s  followed by C-w(s) get the word(s) at point into the search buffer.
> Why doesn't the same thing happen when I do M-%,followed by C-w?

Because of the way those commands are implemented.  C-s invokes a minor mode
with its own keymap, whereas M-% simply reads its arguments using the same
minibuffer keymap used by all Emacs commands.

> Wouldn't that be more consistent?

Yes, but the incremental search bindings such as C-w and C-y are themselves
idiosyncratic.  I would prefer to have a set of commands that could insert
any object (in the thingatpt.el) sense from the current buffer into the
minibuffer, and bindings in the minibuffer keymaps to make them available
to all commands.

> Usually(I said usually), search is followed by replace,people take a quick 
> look
> at what they
> want to replace & then invoke replace. So, most other editors have the
> search&replace
> within a single dialog with the prior search string in it already OR within a
> drop down list.
> So,the search action is not repeated and the replace can happen pronto.
> 
> While I'm not asking for the same bells & whistles,why is it that it's so easy
> to search while
> I'll have to type it for replace? If I've missed an easy way to get strings 
> into
> query-replace,
> do Tell.

(require 'thingatpt)

(defun minibuffer-insert-thing-at-point (thing)
  "Insert the THING at point (from the minibuffer's parent buffer)."
  (insert (save-excursion
            (set-buffer (window-buffer minibuffer-scroll-window))
            (thing-at-point thing))))

(defun minibuffer-insert-word-at-point ()
  "Insert the word at point (from the minibuffer's parent buffer)."
  (interactive)
  (minibuffer-insert-thing-at-point 'word))

(define-key minibuffer-local-map "\C-cw" 'minibuffer-insert-word-at-point)

-- 
Kevin Rodgers <kevinr@ihs.com>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]