all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Bastian Beischer <bastian.beischer@gmail.com>
Cc: 22589@debbugs.gnu.org
Subject: bug#22589: 25.0.90; First match found by isearch-forward-symbol is not necessarily a symbol.
Date: Wed, 10 Feb 2016 02:54:54 +0200	[thread overview]
Message-ID: <87io1x5ptd.fsf@mail.linkov.net> (raw)
In-Reply-To: <CAK9AuB_cmUGdP7O3Y0juMyiZo-zhXN3JJDC8sR1kQ9VziunHkA@mail.gmail.com> (Bastian Beischer's message of "Mon, 8 Feb 2016 12:34:01 +0100")

> What you are saying makes sense, but the bug I outlined above is more
> severe.
>
> For example: In this line:
>
> unsigned int i = 0;
>
> when searching for the symbol "i". Taking your comment into account I can
> see why the first match would be "int", although that's actually not a
> match for "\_<i\_>", because if we would match "i" directly, then there
> would be no way to go back to match "int" should the user enter more
> characters. However, what happens is that the "i" in unsIgned is matched,
> which is surely never going to be a symbol...

Thank you for the detailed test case.  The reason why “i” matches
in the middle of the symbol by not adding an anchor “\_<” is because
we need to support the symbol search backwards as well.  This means
that the symbol search should add “\_<” for searching forward,
and “\_>” for a backward search.  The same applies to the word search.

We could do this by adding an optional argument ‘backward’ to both
‘word-search-regexp’ and ‘isearch-symbol-regexp’.  One complication is that
this change is not backward-compatible.  Instead of this, I propose to use
different values of the existing arg ‘lax’, e.g. values ‘nil’
for a forward search, and ‘backward’ otherwise.

Then it will match at the beginning of the symbol for a forward search,
and at the end for a backward search.  Same for the word search.





  reply	other threads:[~2016-02-10  0:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-07 20:41 bug#22589: 25.0.90; First match found by isearch-forward-symbol is not necessarily a symbol Bastian Beischer
2016-02-08  0:09 ` Bastian Beischer
2016-02-08  0:54 ` Juri Linkov
2016-02-08 11:30   ` Michael Heerdegen
2016-02-10  0:55     ` Juri Linkov
2016-02-10 11:30       ` Michael Heerdegen
2016-02-08 11:34   ` Bastian Beischer
2016-02-10  0:54     ` Juri Linkov [this message]
2017-02-05 23:39       ` Juri Linkov
2017-02-06 11:10         ` Michael Heerdegen
2017-02-07  0:11           ` Juri Linkov
2017-02-07 19:19             ` Michael Heerdegen

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=87io1x5ptd.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=22589@debbugs.gnu.org \
    --cc=bastian.beischer@gmail.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.
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.