all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Daniel Colascione <dan.colascione@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: RFC: [PATCH] isearch enhancements: symbol mode; syntactic filtering
Date: Fri, 08 Jul 2011 22:27:47 +0300	[thread overview]
Message-ID: <87fwmgzi6k.fsf@mail.jurta.org> (raw)
In-Reply-To: <4E165405.6010805@gmail.com> (Daniel Colascione's message of "Thu, 07 Jul 2011 17:49:09 -0700")

>>> - Syntactic filtering: control whether to match in comments, strings, and
>>> normal text.
>>
>> This is easier to implement using `isearch-filter-predicate' as shown in
>> http://thread.gmane.org/gmane.emacs.devel/34742
>
> It may be easier to implement that way, but the results aren't as
> good. Integrating the filtering mode into isearch allows it to be saved
> along with all other isearch state.  Also, my approach doesn't conflict
> with other uses of isearch-filter-predicate.

It would be bad design to implement all particular filter types
in isearch.el.  `isearch-filter-predicate' was intended to provide
modular approach where additional filters can be defined only by
changing the value of `isearch-filter-predicate'.

But I agree with you that in its current state `isearch-filter-predicate'
can cause conflicts with other uses of `isearch-filter-predicate'.
It should be improved to allow adding more filters.  This can be
implemented by supporting a list of filters.

`isearch-filter-predicate' also makes it easier to be saved along with
all other isearch state - you can just save its value.

>> Unfortunately, I failed to find a good keybinding for this feature,
>> so it sunk into obscurity.
>
> The ones I proposed should be reasonably accessible, and they don't
> conflict with anything useful directly from isearch.

When choosing a keybinding we need to anticipate the possibility of
adding more keybindings in the future.  Adding a key prefix will help, e.g.

`M-s f c' isearch-toggle-filter-comments
`M-s f s' isearch-toggle-filter-strings
`M-s f t' isearch-toggle-filter-text

where `f' is short for "filter".

>>> - Symbol search: like word search, but looks only at symbol boundaries
>>
>> This is much needed.  But I think it should have a keybinding separate
>> from word search.  Currently, `M-s w' toggles word search,
>> so a new keybinding `M-s _' could toggle symbol search.
>
> Adding symbol search as a new kind of word search makes sense because the
> new search mode is conceptually similar to, and mutually exclusive with,
> classic word search; having accepted this idea, it naturally follows to
> allow users to cycle through normal, word, and symbol searches makes sense.
> I have no objection to providing a way to go directly to symbol search,
> however: being able to cycle backwards with a prefix argument to M-s
> w would be sufficient, I think.

I remember seeing exactly the same arguments in support for cycling
through normal, word, and regexp searches with the same key because they
are conceptually similar (word search is implemented by regexp search)
and mutually exclusive.

If it was decided to put them on one key, then now adding symbol search
to the same key would make cycling longer.  This suggests that it's
better to activate all different search types with separate keys.

> I like the idea of using M-_ to refer to something having to do with
> symbols; in my patch, I bind this key to a function that both sets
> symbol-search mode _and_ filters out matches in comments and strings;
> I call it identifier-mode.  I find myself wanting exactly this behavior
> fairly frequently.  We can certainly bikeshed a bit about the
> actual keybindings.

`identifier-mode' is another search type that suggests that using
a separate key to enable it (e.g. `M-s i') is better than cycling.



  reply	other threads:[~2011-07-08 19:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-07 14:20 RFC: [PATCH] isearch enhancements: symbol mode; syntactic filtering Daniel Colascione
2011-07-07 14:53 ` Lennart Borgman
2011-07-07 20:51 ` Stefan Monnier
2011-07-07 21:39   ` Daniel Colascione
2011-07-08  0:20 ` Juri Linkov
2011-07-08  0:49   ` Daniel Colascione
2011-07-08 19:27     ` Juri Linkov [this message]
2011-07-08  3:23   ` Drew Adams
2011-07-08 13:04     ` Stefan Monnier
2011-07-08 21:05 ` Lennart Borgman
2011-07-08 21:19   ` Drew Adams
2011-07-08 21:50     ` Juri Linkov
2011-07-08 22:34       ` Drew Adams

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fwmgzi6k.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=dan.colascione@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.