all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex <agrambot@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 5624@debbugs.gnu.org, user42@zip.com.au
Subject: bug#5624: 23.1; etags elisp and scheme "=" in names
Date: Mon, 12 Jun 2017 21:31:57 -0600	[thread overview]
Message-ID: <87mv9c36mq.fsf@gmail.com> (raw)
In-Reply-To: <83fuf55m6a.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 12 Jun 2017 17:13:17 +0300")

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

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alex <agrambot@gmail.com>
>> Cc: user42@zip.com.au,  5624@debbugs.gnu.org
>> Date: Sun, 11 Jun 2017 20:44:29 -0600
>> 
>> One issue is that the Lisp and Scheme functions use get_tag, which uses
>> notinname. What do you think about the following diff? It adds a wrapper
>> to notinname which get_tag uses.
>
> I think it would be much cleaner not to use get_tag for these
> languages, but instead either call make_tag directly or write a
> get_lispy_tag function which will DTRT for Lisp-like languages.
>
> Thanks.

I wanted to reduce duplicated code, but I suppose it is cleaner that
way.

I've attached a patch below.


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

From a0a5881f654baefef53128e43ac0fe6791643e15 Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
Date: Mon, 12 Jun 2017 21:28:39 -0600
Subject: [PATCH] Include '=' in Scheme and Lisp tags in etags

* lib-src/etags.c (get_lispy_tag): New function.
(L_getit, Scheme_functions): Use get_lispy_tag (Bug#5624).
---
 lib-src/etags.c | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/lib-src/etags.c b/lib-src/etags.c
index 6f280d8ab4..7e082dd276 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -372,6 +372,7 @@ static void readline (linebuffer *, FILE *);
 static long readline_internal (linebuffer *, FILE *, char const *);
 static bool nocase_tail (const char *);
 static void get_tag (char *, char **);
+static void get_lispy_tag (char *, char **);
 
 static void analyze_regex (char *);
 static void free_regexps (void);
@@ -5346,7 +5347,7 @@ L_getit (void)
       /* Ok, then skip "(" before name in (defstruct (foo)) */
       dbp = skip_spaces (dbp);
   }
-  get_tag (dbp, NULL);
+  get_lispy_tag (dbp, NULL);
 }
 
 static void
@@ -5548,14 +5549,14 @@ Scheme_functions (FILE *inf)
       if (strneq (bp, "(def", 4) || strneq (bp, "(DEF", 4))
 	{
 	  bp = skip_non_spaces (bp+4);
-	  /* Skip over open parens and white space.  Don't continue past
-	     '\0'. */
-	  while (*bp && notinname (*bp))
+	  /* Skip over open parens and white space.
+	     Don't continue past '\0' or '='. */
+	  while (*bp && notinname (*bp) && *bp != '=')
 	    bp++;
-	  get_tag (bp, NULL);
+	  get_lispy_tag (bp, NULL);
 	}
       if (LOOKING_AT (bp, "(SET!") || LOOKING_AT (bp, "(set!"))
-	get_tag (bp, NULL);
+	get_lispy_tag (bp, NULL);
     }
 }
 
@@ -6590,6 +6591,25 @@ get_tag (register char *bp, char **namepp)
     *namepp = savenstr (bp, cp - bp);
 }
 
+/* Similar to get_tag, but include '=' as part of the tag. */
+static void
+get_lispy_tag (register char *bp, char **namepp)
+{
+  register char *cp = bp;
+
+  if (*bp != '\0')
+    {
+      /* Go till you get to white space or a syntactic break */
+      for (cp = bp + 1; !notinname (*cp) || *cp == '='; cp++)
+	continue;
+      make_tag (bp, cp - bp, true,
+		lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
+    }
+
+  if (namepp != NULL)
+    *namepp = savenstr (bp, cp - bp);
+}
+
 /*
  * Read a line of text from `stream' into `lbp', excluding the
  * newline or CR-NL, if any.  Return the number of characters read from
-- 
2.11.0


  reply	other threads:[~2017-06-13  3:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-22 22:09 bug#5624: 23.1; etags elisp and scheme "=" in names Kevin Ryde
2017-06-11  1:37 ` Alex
2017-06-11 14:52   ` Eli Zaretskii
2017-06-12  2:44     ` Alex
2017-06-12 14:13       ` Eli Zaretskii
2017-06-13  3:31         ` Alex [this message]
2017-06-13 14:28           ` Eli Zaretskii
2017-06-14 22:10             ` Alex
2017-07-08  8:28               ` Eli Zaretskii

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=87mv9c36mq.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=5624@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=user42@zip.com.au \
    /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.