unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Ask etags to stop language auto-detection from falling back to Fortran and C?
@ 2018-01-11  0:07 Dmitry Gutov
  2018-01-11 16:41 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2018-01-11  0:07 UTC (permalink / raw)
  To: emacs-devel

So, I want auto-detection, but the list of files I'm passing to etags is 
very naively auto-generated (basically, all files in the project), and 
includes languages that etags doesn't know about (e.g. CSS).

How do I stop it from parsing them as Fortran files? Please add an option.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Ask etags to stop language auto-detection from falling back to Fortran and C?
  2018-01-11  0:07 Ask etags to stop language auto-detection from falling back to Fortran and C? Dmitry Gutov
@ 2018-01-11 16:41 ` Eli Zaretskii
  2018-01-11 21:49   ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2018-01-11 16:41 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Thu, 11 Jan 2018 03:07:39 +0300
> 
> So, I want auto-detection, but the list of files I'm passing to etags is 
> very naively auto-generated (basically, all files in the project), and 
> includes languages that etags doesn't know about (e.g. CSS).
> 
> How do I stop it from parsing them as Fortran files? Please add an option.

There is already such an option: --language=none.  If you have both
files that you do want etags to parse for some language and files that
you don't, then either put all the latter at the end of the list and
precede them with --language=none, or wrap each such file name with
"--language=none FILE --language=auto".  This works because --language
takes effect on files specified after it.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Ask etags to stop language auto-detection from falling back to Fortran and C?
  2018-01-11 16:41 ` Eli Zaretskii
@ 2018-01-11 21:49   ` Dmitry Gutov
  2018-01-12  8:16     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2018-01-11 21:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On 1/11/18 7:41 PM, Eli Zaretskii wrote:

> There is already such an option: --language=none.  If you have both
> files that you do want etags to parse for some language and files that
> you don't,

I want etags to detect the language, but without the ridiculous 
fallback. Like described in its help output:

     ... If no such sequence is found,
     Fortran is tried first; if no tags are found, C is tried next.

> then either put all the latter at the end of the list and
> precede them with --language=none, or wrap each such file name with
> "--language=none FILE --language=auto".  This works because --language
> takes effect on files specified after it.

Won't "--language=none" stop it detecting the language based on file 
extension and the sharp-bang declaration?




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Ask etags to stop language auto-detection from falling back to Fortran and C?
  2018-01-11 21:49   ` Dmitry Gutov
@ 2018-01-12  8:16     ` Eli Zaretskii
  2018-01-12  8:23       ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2018-01-12  8:16 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

> Cc: emacs-devel@gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Fri, 12 Jan 2018 00:49:36 +0300
> 
> On 1/11/18 7:41 PM, Eli Zaretskii wrote:
> 
> > There is already such an option: --language=none.  If you have both
> > files that you do want etags to parse for some language and files that
> > you don't,
> 
> I want etags to detect the language, but without the ridiculous 
> fallback.

I don't understand: if the file's language can be detected by means
known to etags, then it will never get to the fallbacks.  It will only
try the fallbacks if all the means to detect the language failed.  So
what do you mean by "detect, but without the fallbacks"?

> > then either put all the latter at the end of the list and
> > precede them with --language=none, or wrap each such file name with
> > "--language=none FILE --language=auto".  This works because --language
> > takes effect on files specified after it.
> 
> Won't "--language=none" stop it detecting the language based on file 
> extension and the sharp-bang declaration?

It will, for the files following --language=none on the command line
(but not for those that come before this switch).  But if the
extension and/or sharp-bang are in the file, the detection should not
have failed, and the fallbacks would not have been attempted.  So I
feel I'm missing something in your use case, because I don't
understand why you think --language=none is not what you want.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Ask etags to stop language auto-detection from falling back to Fortran and C?
  2018-01-12  8:16     ` Eli Zaretskii
@ 2018-01-12  8:23       ` Dmitry Gutov
  2018-01-12  9:41         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2018-01-12  8:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On 1/12/18 11:16 AM, Eli Zaretskii wrote:

>> I want etags to detect the language, but without the ridiculous
>> fallback.
> 
> I don't understand: if the file's language can be detected by means
> known to etags, then it will never get to the fallbacks.

OK, to *try to* detect the language.

> It will only
> try the fallbacks if all the means to detect the language failed.  So
> what do you mean by "detect, but without the fallbacks"?

I'm saying I don't want the fallbacks. If you've failed to detect the 
language based on the file extension or the sharp-bang, stop, don't try 
to parse the file with something that will most likely get wrong results.

> It will, for the files following --language=none on the command line
> (but not for those that come before this switch).  But if the
> extension and/or sharp-bang are in the file, the detection should not
> have failed,

It does if etags is unfamiliar with the file's language.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Ask etags to stop language auto-detection from falling back to Fortran and C?
  2018-01-12  8:23       ` Dmitry Gutov
@ 2018-01-12  9:41         ` Eli Zaretskii
  2018-01-12 10:03           ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2018-01-12  9:41 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

> Cc: emacs-devel@gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Fri, 12 Jan 2018 11:23:46 +0300
> 
> > It will only
> > try the fallbacks if all the means to detect the language failed.  So
> > what do you mean by "detect, but without the fallbacks"?
> 
> I'm saying I don't want the fallbacks. If you've failed to detect the 
> language based on the file extension or the sharp-bang, stop, don't try 
> to parse the file with something that will most likely get wrong results.
> 
> > It will, for the files following --language=none on the command line
> > (but not for those that come before this switch).  But if the
> > extension and/or sharp-bang are in the file, the detection should not
> > have failed,
> 
> It does if etags is unfamiliar with the file's language.

OK, so next question: why do you care about the fallbacks?  At worst,
they will generate tags that no one will ever try to find, right?

IOW, can you present a real-life use case where these fallbacks do any
harm?



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Ask etags to stop language auto-detection from falling back to Fortran and C?
  2018-01-12  9:41         ` Eli Zaretskii
@ 2018-01-12 10:03           ` Dmitry Gutov
  2018-01-12 10:41             ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2018-01-12 10:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On 1/12/18 12:41 PM, Eli Zaretskii wrote:

> OK, so next question: why do you care about the fallbacks?  At worst,
> they will generate tags that no one will ever try to find, right?
> 
> IOW, can you present a real-life use case where these fallbacks do any
> harm?

a) That increases the parsing time. Like, makes in 2-3 times longer in 
one example I had.

b) It creates very weird entries, like some multiline undisplayable byte 
sequence in one example (an OTF file, IIRC), and those do show up in the 
completions list, for xref-find-references. Or C-u xref-find-definitions.

c) It does create false positives for real names. For instance, I can 
search for the definition of 'push' (a method in Ruby or JS), and it 
will show me these as possible destinations:

/home/dgutov/xxx/yyy/zzz/public/app/less/bs-less/mixins/grid.less
  33: .make-xs-column-push(
  57: .make-sm-column-push(
  85: .make-md-column-push(
113: .make-lg-column-push(



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Ask etags to stop language auto-detection from falling back to Fortran and C?
  2018-01-12 10:03           ` Dmitry Gutov
@ 2018-01-12 10:41             ` Eli Zaretskii
  2018-01-12 12:06               ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2018-01-12 10:41 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

> Cc: emacs-devel@gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Fri, 12 Jan 2018 13:03:44 +0300
> 
> a) That increases the parsing time. Like, makes in 2-3 times longer in 
> one example I had.
> 
> b) It creates very weird entries, like some multiline undisplayable byte 
> sequence in one example (an OTF file, IIRC), and those do show up in the 
> completions list, for xref-find-references. Or C-u xref-find-definitions.
> 
> c) It does create false positives for real names. For instance, I can 
> search for the definition of 'push' (a method in Ruby or JS), and it 
> will show me these as possible destinations:
> 
> /home/dgutov/xxx/yyy/zzz/public/app/less/bs-less/mixins/grid.less
>   33: .make-xs-column-push(
>   57: .make-sm-column-push(
>   85: .make-md-column-push(
> 113: .make-lg-column-push(

Thanks.  I consider these weak reasons, so it doesn't look a very
urgent issue, especially since running etags on all the files in a
tree is not a very wise thing to do anyway (as mentioned in
http://lists.gnu.org/archive/html/emacs-devel/2018-01/msg00383.html).

However, feel free to file a feature request on debbugs, the
implementation shouldn't be hard.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Ask etags to stop language auto-detection from falling back to Fortran and C?
  2018-01-12 10:41             ` Eli Zaretskii
@ 2018-01-12 12:06               ` Dmitry Gutov
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Gutov @ 2018-01-12 12:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On 1/12/18 1:41 PM, Eli Zaretskii wrote:

> Thanks.  I consider these weak reasons, so it doesn't look a very
> urgent issue, especially since running etags on all the files in a
> tree is not a very wise thing to do anyway (as mentioned in
> http://lists.gnu.org/archive/html/emacs-devel/2018-01/msg00383.html).

Like I mentioned in the same thread, Emacs development is not the 
primary target of that feature. Nor are the projects that support 'make 
tags'.

Not urgent, like "not for emacs-26"? With that I agree, of course.

> However, feel free to file a feature request on debbugs, the
> implementation shouldn't be hard.

Done.



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-01-12 12:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-11  0:07 Ask etags to stop language auto-detection from falling back to Fortran and C? Dmitry Gutov
2018-01-11 16:41 ` Eli Zaretskii
2018-01-11 21:49   ` Dmitry Gutov
2018-01-12  8:16     ` Eli Zaretskii
2018-01-12  8:23       ` Dmitry Gutov
2018-01-12  9:41         ` Eli Zaretskii
2018-01-12 10:03           ` Dmitry Gutov
2018-01-12 10:41             ` Eli Zaretskii
2018-01-12 12:06               ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).