all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Ryde <user42@zip.com.au>
To: 5600@debbugs.gnu.org
Subject: bug#5600: 23.1; etags don't tag (defvar foo) declaration
Date: Fri, 19 Feb 2010 11:00:40 +1100	[thread overview]
Message-ID: <87mxz6ayc7.fsf@blah.blah> (raw)

[-- Attachment #1: Type: text/plain, Size: 655 bytes --]

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  <user42@zip.com.au>

	* etags.c (Lisp_functions): Don't tag "(defvar foo)" declarations.
	(skip_name): New helper.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: etags.c.defvar.diff --]
[-- Type: text/x-diff, Size: 833 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 733 bytes --]




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=''

             reply	other threads:[~2010-02-19  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-19  0:00 Kevin Ryde [this message]
2010-02-19  9:25 ` bug#5600: 23.1; etags don't tag (defvar foo) declaration Francesco Potortì
2010-02-20  0:06   ` Kevin Ryde
2012-12-02  1:49     ` Chong Yidong
2010-02-19  9:32 ` Francesco Potortì

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mxz6ayc7.fsf@blah.blah \
    --to=user42@zip.com.au \
    --cc=5600@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.