[Top][All Lists]

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

Re: Some further ideas for Isearch

From: Juri Linkov
Subject: Re: Some further ideas for Isearch
Date: Sun, 25 Apr 2021 20:36:25 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> Here are some further ideas for Isearch, partially inspired by the
> alternative buffer search packages out there:

Thanks for more ideas that hopefully will find a path to isearch.

> Future history
> --------------
> Pressing `C-s M-n M-n ...' could present a few useful search
> candidates, controlled for instance by the
> `isearch-forward-thing-at-point' variable.  This would be more
> flexible and more mnemonic than the recently introduced
> `isearch-forward-thing-at-point' command.

The problem is that the isearch history is a ring,
so maybe the users already expect that typing 'C-s M-n'
should get the top element of the isearch ring.

This is what 'M-n' bound to 'isearch-ring-advance' currently does
to search for the next item in the search ring.

> Resume canceled searches
> ------------------------
> `C-s C-s' recovers the last history element, so it's more or less
> equivalent to `C-s M-p'.  It would be nice to have the ability to
> resume a canceled search, i.e., make `C-s C-s' look into
> `isearch-cmds' instead.

This feature was proposed in https://debbugs.gnu.org/11378#71

> Fuzzy search
> ------------
> By this I mean a search mode where `search-whitespace-regexp' is set
> to ".*?".
> Implementing this wouldn't be completely trivial because, unlike case
> sensitivity, the whitespace laxness settings are not local to each
> Isearch session.  (As a quick check, note that `M-s c' changes
> case-sensitivity for the current search only, but `M-s SPC' changes
> whitespace laxness for future searches as well.)
> The whitespace regexp should also be saved as a property in the
> search-ring elements.

As the first step, this regexp could be added as a new option to
the search-whitespace-regexp defcustom.  Then later `M-s SPC'
could cycle between different options.

> Whole words vs lax whitespace
> -----------------------------
> The word search mode (M-s w) does two things at once: it wraps the
> search string around "\\< ... \\>" and treats whitespace as "\\W+".  It
> would be nice to make these two aspects orthogonal.
> Sometimes, one might want to search whole words with literal spaces.
> Much more often, however, one might want "\\W+" whitespace but not the
> whole-word restriction.
> I'm not sure what a good UI would be, but one idea is to make `M-s SPC'
> cycle between a few useful whitespace regexps (e.g., nil, "\\s-+",
> "\\W+" and ".*?").

Maybe not `M-s SPC', but `M-s w' could cycle between different versions
of 'word-search-regexp' assigned to 'isearch-regexp-function'?

reply via email to

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