diff options
| author | Kevin Ryde | 2012-12-02 09:47:56 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-12-02 09:47:56 +0800 |
| commit | 1cbaa705e733d496a6eab3a8f1521dec52953fcf (patch) | |
| tree | 2de3295ab62e7387d56e7e6ae3589138e77c978a | |
| parent | 3e5490f7a5d4f527cfc17b12a15a54774a3e3c19 (diff) | |
| download | emacs-1cbaa705e733d496a6eab3a8f1521dec52953fcf.tar.gz emacs-1cbaa705e733d496a6eab3a8f1521dec52953fcf.zip | |
* lib-src/etags.c (Lisp_functions): Skip (defvar foo) declarations
unless the --declarations flag is enabled.
(Lisp_help): Update.
(skip_name): New function.
* doc/emacs/maintaining.texi (Tag Syntax): Mention (defvar foo) handling.
* doc/man/etags.1: Mention effect of --declarations in Lisp.
Fixes: debbugs:5600
| -rw-r--r-- | doc/emacs/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/emacs/maintaining.texi | 8 | ||||
| -rw-r--r-- | doc/man/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/man/etags.1 | 1 | ||||
| -rw-r--r-- | lib-src/ChangeLog | 7 | ||||
| -rw-r--r-- | lib-src/etags.c | 27 |
6 files changed, 47 insertions, 4 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index fd543789751..c90f6d4b712 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-12-02 Kevin Ryde <user42@zip.com.au> | ||
| 2 | |||
| 3 | * maintaining.texi (Tag Syntax): Mention (defvar foo) handling. | ||
| 4 | |||
| 1 | 2012-12-01 Kevin Ryde <user42@zip.com.au> | 5 | 2012-12-01 Kevin Ryde <user42@zip.com.au> |
| 2 | 6 | ||
| 3 | * maintaining.texi (Tag Syntax): Mention Perl's "use constant". | 7 | * maintaining.texi (Tag Syntax): Mention Perl's "use constant". |
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 06680a6b4e3..555409f6be6 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi | |||
| @@ -1676,9 +1676,11 @@ specifies (using Bourne shell syntax) that the commands | |||
| 1676 | 1676 | ||
| 1677 | @item | 1677 | @item |
| 1678 | In Lisp code, any function defined with @code{defun}, any variable | 1678 | In Lisp code, any function defined with @code{defun}, any variable |
| 1679 | defined with @code{defvar} or @code{defconst}, and in general the first | 1679 | defined with @code{defvar} or @code{defconst}, and in general the |
| 1680 | argument of any expression that starts with @samp{(def} in column zero is | 1680 | first argument of any expression that starts with @samp{(def} in |
| 1681 | a tag. | 1681 | column zero is a tag. As an exception, expressions of the form |
| 1682 | @code{(defvar @var{foo})} are treated as declarations, and are only | ||
| 1683 | tagged if the @samp{--declarations} option is given. | ||
| 1682 | 1684 | ||
| 1683 | @item | 1685 | @item |
| 1684 | In Scheme code, tags include anything defined with @code{def} or with a | 1686 | In Scheme code, tags include anything defined with @code{def} or with a |
diff --git a/doc/man/ChangeLog b/doc/man/ChangeLog index cc54cd254b5..afd6b7b6051 100644 --- a/doc/man/ChangeLog +++ b/doc/man/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-12-02 Kevin Ryde <user42@zip.com.au> | ||
| 2 | |||
| 3 | * etags.1: Mention effect of --declarations in Lisp. | ||
| 4 | |||
| 1 | 2012-06-03 Glenn Morris <rgm@gnu.org> | 5 | 2012-06-03 Glenn Morris <rgm@gnu.org> |
| 2 | 6 | ||
| 3 | * rcs-checkin.1: Remove. | 7 | * rcs-checkin.1: Remove. |
diff --git a/doc/man/etags.1 b/doc/man/etags.1 index a1291829665..3f22364a194 100644 --- a/doc/man/etags.1 +++ b/doc/man/etags.1 | |||
| @@ -88,6 +88,7 @@ Only \fBctags\fP accepts this option. | |||
| 88 | .B \-\-declarations | 88 | .B \-\-declarations |
| 89 | In C and derived languages, create tags for function declarations, | 89 | In C and derived languages, create tags for function declarations, |
| 90 | and create tags for extern variables unless \-\-no\-globals is used. | 90 | and create tags for extern variables unless \-\-no\-globals is used. |
| 91 | In Lisp, create tags for (defvar foo) declarations. | ||
| 91 | .TP | 92 | .TP |
| 92 | .B \-D, \-\-no\-defines | 93 | .B \-D, \-\-no\-defines |
| 93 | Do not create tag entries for C preprocessor constant definitions | 94 | Do not create tag entries for C preprocessor constant definitions |
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 294661a6cb3..480ddabd44a 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-12-02 Kevin Ryde <user42@zip.com.au> | ||
| 2 | |||
| 3 | * etags.c (Lisp_functions): Skip (defvar foo) declarations unless | ||
| 4 | the --declarations flag is enabled (Bug#5600). | ||
| 5 | (Lisp_help): Update. | ||
| 6 | (skip_name): New function. | ||
| 7 | |||
| 1 | 2012-12-01 Kevin Ryde <user42@zip.com.au> | 8 | 2012-12-01 Kevin Ryde <user42@zip.com.au> |
| 2 | 9 | ||
| 3 | * etags.c (Perl_functions): Support "use constant" (Bug#5055). | 10 | * etags.c (Perl_functions): Support "use constant" (Bug#5055). |
diff --git a/lib-src/etags.c b/lib-src/etags.c index ec185c9819f..d393c4d2e4a 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -353,6 +353,7 @@ static void put_entries (node *); | |||
| 353 | static char *concat (const char *, const char *, const char *); | 353 | static char *concat (const char *, const char *, const char *); |
| 354 | static char *skip_spaces (char *); | 354 | static char *skip_spaces (char *); |
| 355 | static char *skip_non_spaces (char *); | 355 | static char *skip_non_spaces (char *); |
| 356 | static char *skip_name (char *); | ||
| 356 | static char *savenstr (const char *, int); | 357 | static char *savenstr (const char *, int); |
| 357 | static char *savestr (const char *); | 358 | static char *savestr (const char *); |
| 358 | static char *etags_strchr (const char *, int); | 359 | static char *etags_strchr (const char *, int); |
| @@ -619,7 +620,8 @@ static const char Lisp_help [] = | |||
| 619 | "In Lisp code, any function defined with `defun', any variable\n\ | 620 | "In Lisp code, any function defined with `defun', any variable\n\ |
| 620 | defined with `defvar' or `defconst', and in general the first\n\ | 621 | defined with `defvar' or `defconst', and in general the first\n\ |
| 621 | argument of any expression that starts with `(def' in column zero\n\ | 622 | argument of any expression that starts with `(def' in column zero\n\ |
| 622 | is a tag."; | 623 | is a tag.\n\ |
| 624 | The `--declarations' option tags \"(defvar foo)\" constructs too."; | ||
| 623 | 625 | ||
| 624 | static const char *Lua_suffixes [] = | 626 | static const char *Lua_suffixes [] = |
| 625 | { "lua", "LUA", NULL }; | 627 | { "lua", "LUA", NULL }; |
| @@ -4747,6 +4749,19 @@ Lisp_functions (FILE *inf) | |||
| 4747 | if (dbp[0] != '(') | 4749 | if (dbp[0] != '(') |
| 4748 | continue; | 4750 | continue; |
| 4749 | 4751 | ||
| 4752 | /* "(defvar foo)" is a declaration rather than a definition. */ | ||
| 4753 | if (! declarations) | ||
| 4754 | { | ||
| 4755 | char *p = dbp + 1; | ||
| 4756 | if (LOOKING_AT (p, "defvar")) | ||
| 4757 | { | ||
| 4758 | p = skip_name (p); /* past var name */ | ||
| 4759 | p = skip_spaces (p); | ||
| 4760 | if (*p == ')') | ||
| 4761 | continue; | ||
| 4762 | } | ||
| 4763 | } | ||
| 4764 | |||
| 4750 | if (strneq (dbp+1, "def", 3) || strneq (dbp+1, "DEF", 3)) | 4765 | if (strneq (dbp+1, "def", 3) || strneq (dbp+1, "DEF", 3)) |
| 4751 | { | 4766 | { |
| 4752 | dbp = skip_non_spaces (dbp); | 4767 | dbp = skip_non_spaces (dbp); |
| @@ -6307,6 +6322,16 @@ skip_non_spaces (char *cp) | |||
| 6307 | return cp; | 6322 | return cp; |
| 6308 | } | 6323 | } |
| 6309 | 6324 | ||
| 6325 | /* Skip any chars in the "name" class.*/ | ||
| 6326 | static char * | ||
| 6327 | skip_name (char *cp) | ||
| 6328 | { | ||
| 6329 | /* '\0' is a notinname() so loop stops there too */ | ||
| 6330 | while (! notinname (*cp)) | ||
| 6331 | cp++; | ||
| 6332 | return cp; | ||
| 6333 | } | ||
| 6334 | |||
| 6310 | /* Print error message and exit. */ | 6335 | /* Print error message and exit. */ |
| 6311 | void | 6336 | void |
| 6312 | fatal (const char *s1, const char *s2) | 6337 | fatal (const char *s1, const char *s2) |