From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.bugs Subject: bug#5600: 23.1; etags don't tag (defvar foo) declaration Date: Sat, 20 Feb 2010 11:06:17 +1100 Message-ID: <87d400rcsm.fsf@blah.blah> References: <87mxz6ayc7.fsf@blah.blah> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1266625388 31206 80.91.229.12 (20 Feb 2010 00:23:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Feb 2010 00:23:08 +0000 (UTC) Cc: 5600@debbugs.gnu.org To: Francesco =?UTF-8?Q?Potort=C3=AC?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 20 01:23:05 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nid7h-0005s7-6x for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 Feb 2010 01:23:05 +0100 Original-Received: from localhost ([127.0.0.1]:58362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nid7g-0003Gi-AN for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Feb 2010 19:23:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nid7b-0003Ed-A9 for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2010 19:22:59 -0500 Original-Received: from [140.186.70.92] (port=47232 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nid7a-0003CM-60 for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2010 19:22:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nid7Z-0005kv-Hn for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2010 19:22:58 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47089) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nid7Y-0005kp-WA for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2010 19:22:57 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Nics9-0001D7-JW; Fri, 19 Feb 2010 19:07:01 -0500 X-Loop: bug-gnu-emacs@gnu.org In-Reply-To: <87mxz6ayc7.fsf@blah.blah> Resent-From: Kevin Ryde Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Feb 2010 00:07:01 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: followup 5600 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 5600-submit@debbugs.gnu.org id=B5600.12666243964640 (code B ref 5600); Sat, 20 Feb 2010 00:07:01 +0000 Original-Received: (at 5600) by debbugs.gnu.org; 20 Feb 2010 00:06:36 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nicrj-0001Cn-C7 for submit@debbugs.gnu.org; Fri, 19 Feb 2010 19:06:35 -0500 Original-Received: from mailout2-2.pacific.net.au ([61.8.2.225] helo=mailout2.pacific.net.au) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nicrg-0001Ce-Ni for 5600@debbugs.gnu.org; Fri, 19 Feb 2010 19:06:34 -0500 Original-Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.2.162]) by mailout2.pacific.net.au (Postfix) with ESMTP id 245191F3CC7; Sat, 20 Feb 2010 11:06:28 +1100 (EST) Original-Received: from blah.blah (ppp2048.dyn.pacific.net.au [61.8.32.72]) by mailproxy1.pacific.net.au (Postfix) with ESMTP id 321B78C05; Sat, 20 Feb 2010 11:06:25 +1100 (EST) Original-Received: from gg by blah.blah with local (Exim 4.71) (envelope-from ) id 1NicrS-0001Ea-0D; Sat, 20 Feb 2010 11:06:18 +1100 User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 19 Feb 2010 19:07:01 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:35204 Archived-At: --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Francesco Potort=EC writes: > > Lisp_functions should distinguish between defvar and other (def* > constructs, and tag the former only if --declarations. Sounds likely. I didn't know about that option, new diff below. I suppose it could tag `declare-function' and the like too, but start with untagging the defvar ones. (The bloat of bizaar has made the tree inaccessible for me, so excuse three separate diff files.) 2010-02-19 Kevin Ryde * etags.c (skip_name): New helper. (Lisp_functions): Tag "(defvar foo)" only under --declarations. (Lisp_help): Describe this --declarations. 2010-02-19 Kevin Ryde * maintaining.texi (Tag Syntax): Add Lisp --declarations for (defvar foo). 2010-02-19 Kevin Ryde * doc/man/etags.1 (--declarations): Add Lisp (defvar foo). --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=etags.c.defvar-2.diff --- etags.c.~3.93.~ 2009-11-29 08:42:32.000000000 +1100 +++ etags.c 2010-02-20 10:14:45.000000000 +1100 @@ -433,6 +433,7 @@ static char *concat __P((char *, char *, char *)); static char *skip_spaces __P((char *)); static char *skip_non_spaces __P((char *)); +static char *skip_name __P((char *)); static char *savenstr __P((char *, int)); static char *savestr __P((char *)); static char *etags_strchr __P((const char *, int)); @@ -699,7 +700,9 @@ "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\ +`--declarations' tags declarations \"(defvar foo)\" as well as\n\ +definitions."; static char *Lua_suffixes [] = { "lua", "LUA", NULL }; @@ -4858,6 +4861,19 @@ if (dbp[0] != '(') continue; + /* "(defvar foo)" is a declaration rather than a definition. + ENHANCE-ME: Maybe also Elisp (declare-function funcname ...), + and/or CL and Elisp (declare (special varname)), or (proclaim). */ + 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); @@ -6510,6 +6526,16 @@ cp++; return cp; } + +/* Skip past any chars at cp which are "name" class, meaning not notinname().*/ +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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=maintaining.texi.defvar-2.diff --- maintaining.texi.~1.22.~ 2009-11-29 08:42:21.000000000 +1100 +++ maintaining.texi 2010-02-20 10:32:11.000000000 +1100 @@ -1593,7 +1593,8 @@ 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. +a tag. The @option{--declarations} option tags declarations +@code{(defvar foo)} as well as definitions. @item In Scheme code, tags include anything defined with @code{def} or with a --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=etags.1.defvar-2.diff --- etags.1.~1.8.~ 2009-01-12 11:01:43.000000000 +1100 +++ etags.1 2010-02-20 10:28:25.000000000 +1100 @@ -88,6 +88,8 @@ .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 declarations (defvar foo). .TP .B \-D, \-\-no\-defines Do not create tag entries for C preprocessor constant definitions --=-=-=--