all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Konstantin Kharlamov <hi-angel@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH 2/3] lisp/progmodes/etags.el don't (forward-char) as it's overriden next line
Date: Mon, 18 Mar 2019 22:25:35 +0300	[thread overview]
Message-ID: <1552937135.7027.1@yandex.ru> (raw)
In-Reply-To: <1552936527.7027.0@yandex.ru>



В Пн, мар 18, 2019 at 10:15 ПП (PM), Konstantin Kharlamov 
<hi-angel@yandex.ru> написал:
> 
> 
> В Пн, мар 18, 2019 at 8:00 ПП (PM), Eli Zaretskii 
> <eliz@gnu.org> написал:
>>>  Date: Mon, 18 Mar 2019 12:43:16 +0300
>>>  From: Konstantin Kharlamov <hi-angel@yandex.ru>
>>>  Cc: emacs-devel@gnu.org
>>> 
>>>  > I'm not talking about whitespace.  I'm talking about a tags 
>>> table \x7f\x7ffile
>>>  > that names a symbol 'foobar', say.  If you search for a tag 
>>> "bar" \x7f\x7fand
>>>  > do not anchor the search at the beginning of a line, you will 
>>> \x7f\x7fdecide
>>>  > that "bar" is present on the "foobar" line, although it really 
>>> \x7f\x7fisn't.
>>>  > Right?
>>> 
>>>  Not exactly. Here's an alternative bad situation: let's say you do
>>>  anchor the text, and you search for tag 'foo'. And… you still 
>>> \x7f\x7fmatch
>>>  'foobar'!
>> 
>> That's expected, and how etags.el should work: it finds tags that
>> _begin_ with the specified text.  Partial matches are filtered out by
>> higher-level routines, if needed.
>> 
>> But with your proposed change the match will be in the middle of a
>> symbol as well, something the callers don't expect.
>> 
>>>  	#define FOO
>>>  	#define FOO_BAR
>>> 
>>>  If source code is intact, you should get FOO. But if code changed, 
>>> \x7f\x7fthen
>>>  emacs tries to find where did it go, and may as well stumble upon
>>>  FOO_BAR.
>> 
>> That's okay, that's how this low-level stuff is supposed to work.
>> 
>>>  So, I suggest an improvement to my patch: how about we
>>> 
>>>  1. anchor the regexp to the end of the line also
>>>  2. replace trailing space with "any whitespace" regex '\s-*'
>>> 
>>>  ?
>> 
>> etags.el is used by/supports many major modes, and in general I don't
>> think we want to assume that whitespace in a tag is insignificant,
>> certainly not as a global change in behavior.
>> 
>> So I would actually suggest to make one step back and describe in 
>> more
>> detail the actual problem you had with the current code.  The anjuta
>> issue to which you pointed doesn't have enough details, like why the
>> change in leading whitespace was deemed a problem, and so I cannot
>> make up my mind what is the actual problem and why it should be fixed
>> in etags.el.
>> 
>> Can you provide those additional details?
> 
> I'm not sure what additional details you want. I found a usecase 
> where heuristic for finding a tag can be improved. I can make even 
> stronger statement: all whitespace within a tag is insignificant, not 
> only the trailing part.

…as long of course as word and symbols boundaries preserved. Just to 
make it more clear.

> Let's make it the other way around: please, provide any language 
> example, where having the trailing space may be significant for 
> unambigiously determining the tag.





  reply	other threads:[~2019-03-18 19:25 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-16  1:53 [PATCH 1/3] lisp/progmodes/etags.el clean up code by removing a temporary Konstantin Kharlamov
2019-03-16  1:53 ` [PATCH 2/3] lisp/progmodes/etags.el don't (forward-char) as it's overriden next line Konstantin Kharlamov
2019-03-16 12:43   ` Eli Zaretskii
2019-03-16 15:42     ` Konstantin Kharlamov
2019-03-16 16:00       ` Stefan Monnier
2019-03-16 16:26       ` Eli Zaretskii
2019-03-16 21:12         ` Konstantin Kharlamov
2019-03-16 21:47           ` Konstantin Kharlamov
2019-03-17  3:36           ` Eli Zaretskii
2019-03-17  3:41             ` Konstantin Kharlamov
2019-03-17 15:17               ` Eli Zaretskii
2019-03-17 15:52                 ` Stefan Monnier
2019-03-17 16:13                   ` Eli Zaretskii
2019-03-17 17:36                     ` Stefan Monnier
2019-03-17 21:14                       ` Eradicating selective-display == t (was: [PATCH 2/3] lisp/progmodes/etags.el don't (forward-char) as it's overriden next line) Stefan Monnier
2019-03-17 21:32                         ` Konstantin Kharlamov
2019-03-18  1:12                           ` Eradicating selective-display == t Stefan Monnier
2019-03-18  9:16                             ` Konstantin Kharlamov
2019-03-18 12:10                               ` Stefan Monnier
2019-03-17 19:06                 ` [PATCH 2/3] lisp/progmodes/etags.el don't (forward-char) as it's overriden next line Konstantin Kharlamov
2019-03-17 19:22                   ` Eli Zaretskii
2019-03-17 19:29                     ` Konstantin Kharlamov
2019-03-17 20:21                       ` Eli Zaretskii
2019-03-17 20:27                         ` Konstantin Kharlamov
2019-03-17 20:40                           ` Eli Zaretskii
2019-03-17 20:44                             ` Konstantin Kharlamov
2019-03-18  3:34                               ` Eli Zaretskii
2019-03-18  9:43                                 ` Konstantin Kharlamov
2019-03-18  9:57                                   ` Konstantin Kharlamov
2019-03-18 17:00                                   ` Eli Zaretskii
2019-03-18 19:15                                     ` Konstantin Kharlamov
2019-03-18 19:25                                       ` Konstantin Kharlamov [this message]
2019-03-18 20:16                                       ` Eli Zaretskii
2019-03-18 21:45                                         ` Konstantin Kharlamov
2019-03-18 23:13                                           ` Konstantin Kharlamov
2019-03-18 23:38                                             ` Konstantin Kharlamov
2019-03-19  1:46                                               ` Stefan Monnier
2019-03-19  6:47                                           ` Eli Zaretskii
2019-03-16  1:53 ` [PATCH 3/3] lisp/progmodes/etags.el improve match by string trimming Konstantin Kharlamov
2019-03-16  2:13   ` [PATCH v2] " Konstantin Kharlamov
2019-03-16 12:46     ` Eli Zaretskii
2019-03-16 15:38       ` Konstantin Kharlamov
2019-03-16 16:29         ` Eli Zaretskii
2019-03-17  2:38     ` [PATCH v3] " Konstantin Kharlamov
2019-03-19  6:55 ` [PATCH v2] lisp/progmodes/etags.el clean up code by removing a temporary Konstantin Kharlamov

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=1552937135.7027.1@yandex.ru \
    --to=hi-angel@yandex.ru \
    --cc=eliz@gnu.org \
    --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.