[Top][All Lists]

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

Word search (was: First two elements of search-ring shown twice in minib

From: Juri Linkov
Subject: Word search (was: First two elements of search-ring shown twice in minibuffer when using M-p multiple times?)
Date: Mon, 10 Mar 2008 19:12:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-unknown-linux-gnu)

>> It also gets rid of all trickery used to read the first character
>> typed in the minibuffer (that removes another set of problems;
>> see related old bug reports).  It adds a new backward-compatible
>> command `isearch-edit-string-set-word' bound to C-w in the minibuffer
>> that calls `kill-region' when the mark is active, and otherwise does
>> word search after exiting `isearch-edit-string' (the mark is not active
>> when `isearch-edit-string' just created the minibuffer, and without
>> the mark `kill-region' would fail anyway).
>> This preserves the behavior described in the Emacs manual:
>> `C-s <RET> C-w WORDS <RET>'
>>      Search for WORDS, ignoring details of punctuation.
> This seems unrelated, right?

This is slightly related, but now I see it can be installed with
a separate patch.

> It looks like a good change.  But I wonder why we don't use an approach
> similar to the M-r binding to isearch-toggle-regexp.

Keeping C-w to specify word search in the minibuffer is necessary
for backward compatibility.  When we find a better method to toggle
word search, we could remove the description of the old method
from the manual, and remove its code in later releases.

> Of course, we'd rather not eat yet-another key (e.g. bind M-w to
> isearch-toggle-word), but maybe we could change isearch-toggle-regexp
> into isearch-cycle-regexp-word, such that the command cycles between
> plain/regexp/word searches.

One disadvantage of M-r is that it's not mnemonic to toggle word search.
OTOH, it is convenient to cycle between search types.

We could also add another keybinding to separately toggle only
word search `M-s w' and regexp search `M-s r'.  Their key sequences are
longer than `M-r' but they will allow specifying the exact search type.

Juri Linkov

reply via email to

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