emacs-devel
[Top][All Lists]
Advanced

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

Re: [ETAGS] Entries on non-existing files


From: Francesco Potorti`
Subject: Re: [ETAGS] Entries on non-existing files
Date: Fri, 18 May 2007 19:18:20 +0200

I am really sorry I could not follow up on this sooner.

Speaking about etags seeing a #line directive in a file, that points to
a nonexisting file.  As a consequence, searching for some tags gives an
error from etags.el.

>The parsed files are in fact 'configure' files that contain #line 
>directive into calls to 'cat'.
>
>But, by reproducing the same case by tagging a documentation file (.txt)
>that explains the behavior of the #line directive, you might have the
>same problem.

This is the sequence used by etags to decide a language:

  If no language is specified and no matching suffix is found,
  the first line of the file is read for a sharp-bang (#!) sequence
  followed by the name of an interpreter.  If no such sequence is found,
  Fortran is tried first; if no tags are found, C is tried next.
  When parsing any C file, a "class" or "template" keyword
  switches to C++.

Your particular problem is easily solved, I think, by specifying a
language for etags, using the --lang=none switch or else by caring not
to give etags the file name to parse.  A common way of invoking etags is
by doing
 etags *.[ch]
or
 find -name '*.[ch]' | etags -

In fact, there is no particular reason why etags should treat a file
such as "configure", or "note.txt", as a C file, other than backward
compatibility, and even this reason is weak.  Etags expects that the
user does not give feeds it with random file names.

So I would say, in preference order, that
- nothing should be changed;
- etags should not consider #line directives pointing to a nonexisting
  file, as you suggested;
- etags should not fall back on C, but on "none";
- etags should make some checks before falling back on C, like looking
  for a comment or a brace or something like that in the first lines;
- when falling back, #line directives should be disabled.

>In any case, I think you have good arguments and I respect your position.
>However, maybe the idea to implement a variable in the 'etags.el' file 
>that says "skip unexisting files" will solve the problems for any case 
>of files not found (moved, deleted, unlinked, etc.).

This is one more way to cope with the problem:

- nothing should be changed in etags, but etags.el should ignore
  nonexisting files instead of generating an error.

I am submitting these reasonings to the Emacs developers' list so that
others may help us finding a solution.  Thank for your input, and again
sorry for the huge delay.




reply via email to

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