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: Fri, 19 Feb 2010 11:00:40 +1100 Message-ID: <87mxz6ayc7.fsf@blah.blah> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1266538994 6989 80.91.229.12 (19 Feb 2010 00:23:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Feb 2010 00:23:14 +0000 (UTC) To: 5600@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 19 01:23:11 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 1NiGeF-0001LT-3n for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Feb 2010 01:23:11 +0100 Original-Received: from localhost ([127.0.0.1]:57804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NiGeE-0004Bl-HL for geb-bug-gnu-emacs@m.gmane.org; Thu, 18 Feb 2010 19:23:10 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NiGe8-0004AY-V9 for bug-gnu-emacs@gnu.org; Thu, 18 Feb 2010 19:23:05 -0500 Original-Received: from [140.186.70.92] (port=38736 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NiGe4-00047T-52 for bug-gnu-emacs@gnu.org; Thu, 18 Feb 2010 19:23:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NiGdz-0003l3-KU for bug-gnu-emacs@gnu.org; Thu, 18 Feb 2010 19:22:59 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59850) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NiGdz-0003kz-J2 for bug-gnu-emacs@gnu.org; Thu, 18 Feb 2010 19:22:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NiGKj-0000qj-S6; Thu, 18 Feb 2010 19:03:01 -0500 X-Loop: bug-gnu-emacs@gnu.org 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: Fri, 19 Feb 2010 00:03:01 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: report 5600 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.12665377263226 (code B ref -1); Fri, 19 Feb 2010 00:03:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Feb 2010 00:02:06 +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 1NiGJq-0000pz-43 for submit@debbugs.gnu.org; Thu, 18 Feb 2010 19:02:06 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NiGJo-0000pZ-DF for submit@debbugs.gnu.org; Thu, 18 Feb 2010 19:02:05 -0500 Original-Received: from mail.gnu.org ([199.232.76.166]:36223 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NiGJk-0000RC-In for submit@debbugs.gnu.org; Thu, 18 Feb 2010 19:02:00 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NiGIz-0004Wf-1b for submit@debbugs.gnu.org; Thu, 18 Feb 2010 19:01:14 -0500 Original-Received: from lists.gnu.org ([199.232.76.165]:57689) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NiGIy-0004WZ-SQ for submit@debbugs.gnu.org; Thu, 18 Feb 2010 19:01:12 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NiGIy-0005q3-FV for bug-gnu-emacs@gnu.org; Thu, 18 Feb 2010 19:01:12 -0500 Original-Received: from [140.186.70.92] (port=51836 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NiGIs-0005pj-Qq for bug-gnu-emacs@gnu.org; Thu, 18 Feb 2010 19:01:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NiGIn-0001ul-L1 for bug-gnu-emacs@gnu.org; Thu, 18 Feb 2010 19:01:06 -0500 Original-Received: from mailout1-14.pacific.net.au ([125.255.80.133]:42456 helo=mailout1.pacific.net.au) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NiGIn-0001uX-2g for bug-gnu-emacs@gnu.org; Thu, 18 Feb 2010 19:01:01 -0500 Original-Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout1.pacific.net.au (Postfix) with ESMTP id 0D71152DD1E for ; Fri, 19 Feb 2010 11:00:57 +1100 (EST) Original-Received: from blah.blah (ppp24EF.dyn.pacific.net.au [61.8.36.239]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id 0EF4027420 for ; Fri, 19 Feb 2010 11:00:56 +1100 (EST) Original-Received: from gg by blah.blah with local (Exim 4.71) (envelope-from ) id 1NiGIS-0000hZ-NF for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2010 11:00:40 +1100 User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 18 Feb 2010 19:03: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:35181 Archived-At: --=-=-= It'd be good if etags didn't tag defvar declaration forms, only actual variable definitions. For example it picks up (defvar message-indent-citation-function) in longlines.el ahead of that variable's actual definition in message.el, so M-. of that var goes to longlines.el first. Perhaps something along the lines below. I found the tripe-negative of while(!noninname) hard to follow and thought a skip_name() could be clearer. It might be shared by Perl_functions, PHP_functions and Makefile_functions. 2010-02-18 Kevin Ryde * etags.c (Lisp_functions): Don't tag "(defvar foo)" declarations. (skip_name): New helper. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=etags.c.defvar.diff --- etags.c.~3.93.~ 2009-11-29 08:42:32.000000000 +1100 +++ etags.c 2010-02-19 10:53:57.000000000 +1100 @@ -4849,6 +4849,16 @@ get_tag (dbp, NULL); } +/* skip past any chars at cp which are "name" class */ +static char * +skip_name (char *cp) +{ + /* '\0' is a notinname() so loop stops there too */ + while (! notinname (*cp)) + cp++; + return cp; +} + static void Lisp_functions (inf) FILE *inf; @@ -4858,6 +4868,17 @@ if (dbp[0] != '(') continue; + /* ignore declaration "(defvar foo)", it's not a definition */ + { + 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); --=-=-= In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5) of 2009-09-14 on raven, modified by Debian configured using `configure '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' --=-=-=--