unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* ctags/etags: rc file?
@ 2014-11-20 11:47 Alfred M. Szmidt
  2014-11-20 12:07 ` Francesco Potortì
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Alfred M. Szmidt @ 2014-11-20 11:47 UTC (permalink / raw)
  To: emacs-devel

Would it be possible for ctags/etags to read a simple .etags (or
something) file that contains the command line arguments?  The reason
for it is that often projects have a bunch of default arguments that
are being passed to etags, which are not just regexps and it is
annoying to keep track of them at times.

If .etags (one argument per line) contains,

  --language=none
  --regex='/[ \t]*function.*=[ \t]*\([^ \t]*\)[ \t]*(/\1/'
  --regex='/###key \(.*\)/\1/'
  --regex='/[ \t]*global[ \t].*/'
  *.m

And then issuing "etags -Z" (or some other sensible short option) it
would be equivalent to running,

  etags --language=none --regex='/[ \t]*function.*=[ \t]*\([^ \t]*\)[ \t]*(/\1/' --regex='/###key \(.*\)/\1/' --regex='/[ \t]*global[ \t].*/' *.m



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

* Re: ctags/etags: rc file?
  2014-11-20 11:47 ctags/etags: rc file? Alfred M. Szmidt
@ 2014-11-20 12:07 ` Francesco Potortì
  2014-11-20 12:14   ` Alfred M. Szmidt
  2014-11-20 12:12 ` Ivan Shmakov
  2014-11-20 12:19 ` Masatake YAMATO
  2 siblings, 1 reply; 7+ messages in thread
From: Francesco Potortì @ 2014-11-20 12:07 UTC (permalink / raw)
  To: ams; +Cc: emacs-devel

>Would it be possible for ctags/etags to read a simple .etags (or
>something) file that contains the command line arguments?  The reason
>for it is that often projects have a bunch of default arguments that
>are being passed to etags, which are not just regexps and it is
>annoying to keep track of them at times.
>
>If .etags (one argument per line) contains,
>
>  --language=none
>  --regex='/[ \t]*function.*=[ \t]*\([^ \t]*\)[ \t]*(/\1/'
>  --regex='/###key \(.*\)/\1/'
>  --regex='/[ \t]*global[ \t].*/'
>  *.m
>
>And then issuing "etags -Z" (or some other sensible short option) it
>would be equivalent to running,
>
>  etags --language=none --regex='/[ \t]*function.*=[ \t]*\([^ \t]*\)[ \t]*(/\1/' --regex='/###key \(.*\)/\1/' --regex='/[ \t]*global[ \t].*/' *.m

You can put regular expressions for etags in a file.  Have a look at the
info file of Emacs (node Etags Regexps) or the output of `etags --help'
(look for REGEXFILE).

Note that if you call etags from a Makefile it is probably more clear
and less prone to error to just put the --regex arguments on the
command line in makefile itself.



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

* Re: ctags/etags: rc file?
  2014-11-20 11:47 ctags/etags: rc file? Alfred M. Szmidt
  2014-11-20 12:07 ` Francesco Potortì
@ 2014-11-20 12:12 ` Ivan Shmakov
  2014-11-20 12:19 ` Masatake YAMATO
  2 siblings, 0 replies; 7+ messages in thread
From: Ivan Shmakov @ 2014-11-20 12:12 UTC (permalink / raw)
  To: emacs-devel

>>>>> Alfred M Szmidt <ams@gnu.org> writes:

[…]

 > If .etags (one argument per line) contains,

 > --language=none
 > --regex='/[ \t]*function.*=[ \t]*\([^ \t]*\)[ \t]*(/\1/'
 > --regex='/###key \(.*\)/\1/'
 > --regex='/[ \t]*global[ \t].*/'
 > *.m

	Isn’t it already possible with xargs(1)?  Depending on the shell
	in use, it may be possible to, say:

$ etagx () { (cat < .etags ; printf %s\\n "$@") | xargs etags ; } 
$ etagx *.m 

 > And then issuing "etags -Z" (or some other sensible short option) it
 > would be equivalent to running,

 >   etags --language=none --regex='/[ \t]*function.*=[ \t]*\([^ \t]*\)[
 > \t]*(/\1/' --regex='/###key \(.*\)/\1/' --regex='/[ \t]*global[
 > \t].*/' *.m

	The last ‘*.m’ bit would require duplicating shell’s own
	wildcard expansion in Etags, and it doesn’t seem like an
	outright clever idea to me.

-- 
FSF associate member #7257  np. Afraid to Shoot Strangers — Iron Maiden



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

* Re: ctags/etags: rc file?
  2014-11-20 12:07 ` Francesco Potortì
@ 2014-11-20 12:14   ` Alfred M. Szmidt
  0 siblings, 0 replies; 7+ messages in thread
From: Alfred M. Szmidt @ 2014-11-20 12:14 UTC (permalink / raw)
  To: Francesco Potortì; +Cc: emacs-devel

   You can put regular expressions for etags in a file.  Have a look at the
   info file of Emacs (node Etags Regexps) or the output of `etags --help'
   (look for REGEXFILE).

That solves part of the problem, it does not solve the other where one
wishes to pass other flags, like --include, --language,
--no-duplicates (for ctags).], etc.

   Note that if you call etags from a Makefile it is probably more
   clear and less prone to error to just put the --regex arguments on
   the command line in makefile itself.

Not all projects have a Makefile (sadly).



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

* Re: ctags/etags: rc file?
  2014-11-20 11:47 ctags/etags: rc file? Alfred M. Szmidt
  2014-11-20 12:07 ` Francesco Potortì
  2014-11-20 12:12 ` Ivan Shmakov
@ 2014-11-20 12:19 ` Masatake YAMATO
  2014-11-20 12:34   ` Alfred M. Szmidt
  2 siblings, 1 reply; 7+ messages in thread
From: Masatake YAMATO @ 2014-11-20 12:19 UTC (permalink / raw)
  To: ams; +Cc: emacs-devel

Hi,

Yes, ctags has such ability.

       --options=file
            Read additional options from file. The file should contain one
            option per line. As a special case, if --options=NONE is spec‐
            ified as the first option on the command line, it will disable
            the automatic reading of any configuration options from either
            a file or the environment (see FILES).

There is more advanced feature.
Look at my work at fishman/ctags:

     https://github.com/fishman/ctags/blob/master/docs/f-optlib.rst

Optlib may be the feature you want.
fishman/ctags was a branch of exuberant-ctags. However, these days
fishman/ctags people are talking about merging the result into
exuberant-ctags:

      https://github.com/fishman/ctags/issues/101

Masatake YAMATO


> Would it be possible for ctags/etags to read a simple .etags (or
> something) file that contains the command line arguments?  The reason
> for it is that often projects have a bunch of default arguments that
> are being passed to etags, which are not just regexps and it is
> annoying to keep track of them at times.
> 
> If .etags (one argument per line) contains,
> 
>   --language=none
>   --regex='/[ \t]*function.*=[ \t]*\([^ \t]*\)[ \t]*(/\1/'
>   --regex='/###key \(.*\)/\1/'
>   --regex='/[ \t]*global[ \t].*/'
>   *.m
> 
> And then issuing "etags -Z" (or some other sensible short option) it
> would be equivalent to running,
> 
>   etags --language=none --regex='/[ \t]*function.*=[ \t]*\([^ \t]*\)[ \t]*(/\1/' --regex='/###key \(.*\)/\1/' --regex='/[ \t]*global[ \t].*/' *.m
> 



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

* Re: ctags/etags: rc file?
  2014-11-20 12:19 ` Masatake YAMATO
@ 2014-11-20 12:34   ` Alfred M. Szmidt
  2014-11-21  2:26     ` Masatake YAMATO
  0 siblings, 1 reply; 7+ messages in thread
From: Alfred M. Szmidt @ 2014-11-20 12:34 UTC (permalink / raw)
  To: Masatake YAMATO; +Cc: emacs-devel

	  --options=file
	       Read additional options from file. The file should contain one
	       option per line. As a special case, if --options=NONE is spec^[$B!>^[(B
	       ified as the first option on the command line, it will disable
	       the automatic reading of any configuration options from either
	       a file or the environment (see FILES).

But ctags and etags, part of Emacs, do not have this functionality.  I
do not know where this option comes from, but it is exactly what I
would like to see (minus the odd behaviour of --options=NONE, NONE is
a fully legal file name) in etags/ctags.



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

* Re: ctags/etags: rc file?
  2014-11-20 12:34   ` Alfred M. Szmidt
@ 2014-11-21  2:26     ` Masatake YAMATO
  0 siblings, 0 replies; 7+ messages in thread
From: Masatake YAMATO @ 2014-11-21  2:26 UTC (permalink / raw)
  To: ams; +Cc: emacs-devel

> 	  --options=file
> 	       Read additional options from file. The file should contain one
> 	       option per line. As a special case, if --options=NONE is spec‐
> 	       ified as the first option on the command line, it will disable
> 	       the automatic reading of any configuration options from either
> 	       a file or the environment (see FILES).
> 
> But ctags and etags, part of Emacs, do not have this functionality.  I
> do not know where this option comes from, but it is exactly what I
> would like to see (minus the odd behaviour of --options=NONE, NONE is
> a fully legal file name) in etags/ctags.

I was talking about exuberant ctags(http://ctags.sourceforge.net/).
I'm not sure about ctags which is part of Emacs.

Masatake YAMATO




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

end of thread, other threads:[~2014-11-21  2:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-20 11:47 ctags/etags: rc file? Alfred M. Szmidt
2014-11-20 12:07 ` Francesco Potortì
2014-11-20 12:14   ` Alfred M. Szmidt
2014-11-20 12:12 ` Ivan Shmakov
2014-11-20 12:19 ` Masatake YAMATO
2014-11-20 12:34   ` Alfred M. Szmidt
2014-11-21  2:26     ` Masatake YAMATO

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).