emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111060: * lib-src/etags.c (Lisp_func


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111060: * lib-src/etags.c (Lisp_functions): Skip (defvar foo) declarations
Date: Sun, 02 Dec 2012 09:47:56 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111060
fixes bug: http://debbugs.gnu.org/5600
author: Kevin Ryde <address@hidden>
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2012-12-02 09:47:56 +0800
message:
  * 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.
modified:
  doc/emacs/ChangeLog
  doc/emacs/maintaining.texi
  doc/man/ChangeLog
  doc/man/etags.1
  lib-src/ChangeLog
  lib-src/etags.c
=== modified file 'doc/emacs/ChangeLog'
--- a/doc/emacs/ChangeLog       2012-12-01 01:22:28 +0000
+++ b/doc/emacs/ChangeLog       2012-12-02 01:47:56 +0000
@@ -1,3 +1,7 @@
+2012-12-02  Kevin Ryde  <address@hidden>
+
+       * maintaining.texi (Tag Syntax): Mention (defvar foo) handling.
+
 2012-12-01  Kevin Ryde  <address@hidden>
 
        * maintaining.texi (Tag Syntax): Mention Perl's "use constant".

=== modified file 'doc/emacs/maintaining.texi'
--- a/doc/emacs/maintaining.texi        2012-12-01 01:22:28 +0000
+++ b/doc/emacs/maintaining.texi        2012-12-02 01:47:56 +0000
@@ -1676,9 +1676,11 @@
 
 @item
 In Lisp code, any function defined with @code{defun}, any variable
-defined with @code{defvar} or @code{defconst}, and in general the first
-argument of any expression that starts with @samp{(def} in column zero is
-a tag.
+defined with @code{defvar} or @code{defconst}, and in general the
+first argument of any expression that starts with @samp{(def} in
+column zero is a tag.  As an exception, expressions of the form
address@hidden(defvar @var{foo})} are treated as declarations, and are only
+tagged if the @samp{--declarations} option is given.
 
 @item
 In Scheme code, tags include anything defined with @code{def} or with a

=== modified file 'doc/man/ChangeLog'
--- a/doc/man/ChangeLog 2012-08-28 16:01:59 +0000
+++ b/doc/man/ChangeLog 2012-12-02 01:47:56 +0000
@@ -1,3 +1,7 @@
+2012-12-02  Kevin Ryde  <address@hidden>
+
+       * etags.1: Mention effect of --declarations in Lisp.
+
 2012-06-03  Glenn Morris  <address@hidden>
 
        * rcs-checkin.1: Remove.

=== modified file 'doc/man/etags.1'
--- a/doc/man/etags.1   2012-01-05 09:44:36 +0000
+++ b/doc/man/etags.1   2012-12-02 01:47:56 +0000
@@ -88,6 +88,7 @@
 .B \-\-declarations
 In C and derived languages, create tags for function declarations,
 and create tags for extern variables unless \-\-no\-globals is used.
+In Lisp, create tags for (defvar foo) declarations.
 .TP
 .B \-D, \-\-no\-defines
 Do not create tag entries for C preprocessor constant definitions

=== modified file 'lib-src/ChangeLog'
--- a/lib-src/ChangeLog 2012-12-01 01:22:28 +0000
+++ b/lib-src/ChangeLog 2012-12-02 01:47:56 +0000
@@ -1,3 +1,10 @@
+2012-12-02  Kevin Ryde  <address@hidden>
+
+       * etags.c (Lisp_functions): Skip (defvar foo) declarations unless
+       the --declarations flag is enabled (Bug#5600).
+       (Lisp_help): Update.
+       (skip_name): New function.
+
 2012-12-01  Kevin Ryde  <address@hidden>
 
        * etags.c (Perl_functions): Support "use constant" (Bug#5055).

=== modified file 'lib-src/etags.c'
--- a/lib-src/etags.c   2012-12-01 01:22:28 +0000
+++ b/lib-src/etags.c   2012-12-02 01:47:56 +0000
@@ -353,6 +353,7 @@
 static char *concat (const char *, const char *, const char *);
 static char *skip_spaces (char *);
 static char *skip_non_spaces (char *);
+static char *skip_name (char *);
 static char *savenstr (const char *, int);
 static char *savestr (const char *);
 static char *etags_strchr (const char *, int);
@@ -619,7 +620,8 @@
 "In Lisp code, any function defined with `defun', any variable\n\
 defined with `defvar' or `defconst', and in general the first\n\
 argument of any expression that starts with `(def' in column zero\n\
-is a tag.";
+is a tag.\n\
+The `--declarations' option tags \"(defvar foo)\" constructs too.";
 
 static const char *Lua_suffixes [] =
   { "lua", "LUA", NULL };
@@ -4747,6 +4749,19 @@
       if (dbp[0] != '(')
        continue;
 
+      /* "(defvar foo)" is a declaration rather than a definition.  */
+      if (! declarations)
+       {
+         char *p = dbp + 1;
+         if (LOOKING_AT (p, "defvar"))
+           {
+             p = skip_name (p); /* past var name */
+             p = skip_spaces (p);
+             if (*p == ')')
+               continue;
+           }
+       }
+
       if (strneq (dbp+1, "def", 3) || strneq (dbp+1, "DEF", 3))
        {
          dbp = skip_non_spaces (dbp);
@@ -6307,6 +6322,16 @@
   return cp;
 }
 
+/* Skip any chars in the "name" class.*/
+static char *
+skip_name (char *cp)
+{
+  /* '\0' is a notinname() so loop stops there too */
+  while (! notinname (*cp))
+    cp++;
+  return cp;
+}
+
 /* Print error message and exit.  */
 void
 fatal (const char *s1, const char *s2)


reply via email to

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