all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: pot@gnu.org
Cc: 73771-done@debbugs.gnu.org, morgan@ice9.digital
Subject: bug#73771: 30.0.91; etags generates broken TAGS file for multi-line regex match
Date: Sat, 19 Oct 2024 11:20:37 +0300	[thread overview]
Message-ID: <86sessld0q.fsf@gnu.org> (raw)
In-Reply-To: <86ldystb0b.fsf@gnu.org> (message from Eli Zaretskii on Sun, 13 Oct 2024 15:58:44 +0300)

> Cc: 73771@debbugs.gnu.org, morgan@ice9.digital
> Date: Sun, 13 Oct 2024 15:58:44 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: Francesco Potortì <pot@gnu.org>
> > Date: Sun, 13 Oct 2024 12:48:40 +0200
> > Cc: 73771@debbugs.gnu.org,
> > 	Morgan Willcock <morgan@ice9.digital>
> > 
> > >This is because etags always records one extra character with the
> > >regexp match, which is harmless, unless that extra character is a
> > >newline.  The patch below fixes it:
> > >
> > >diff --git a/lib-src/etags.c b/lib-src/etags.c
> > >index a822a82..848d8ea 100644
> > >--- a/lib-src/etags.c
> > >+++ b/lib-src/etags.c
> > >@@ -7420,7 +7420,7 @@ regex_tag_multiline (void)
> > > 
> > > 	      /* Force explicit tag name, if a name is there. */
> > > 	      pfnote (name, true, buffer + linecharno,
> > >-		      charno - linecharno + 1, lineno, linecharno);
> > >+		      charno - linecharno, lineno, linecharno);
> > > 
> > > 	      if (debug)
> > > 		fprintf (stderr, "%s on %s:%"PRIdMAX": %s\n",
> > >
> > >Francesco, why does the code add one more character there?
> > 
> > While I can't remember the reason, I am sure it was not done by chance.
> > 
> > Sure, I may have been wrong at that time, or maybe that reason is now obsolete.  To check, one should run the etags regression test and check the results.
> 
> I already did.  The only differences I see are in that 1 extra
> character, which is now no longer written to TAGS in the tests which
> use multi-line regexps.
> 
> Note that the change is only in this single call to pfnote, from the
> code that is part of generating tags from multi-line regexp matches.
> 
> > Off the top of my head, it may have to do with implicitly named tags that are initial substring of a different tag, but this may be a fake reconstruction of my mind,
> 
> The tags we produce from regexp matches are norally explicitly named,
> AFAICT:
> 
> 	      /* Match occurred.  Construct a tag. */
> 	      while (charno < rp->regs.end[0])
> 		if (buffer[charno++] == '\n')
> 		  lineno++, linecharno = charno;
> 	      name = rp->name;
> 	      if (name[0] == '\0')
> 		name = NULL;
> 	      else /* make a named tag */
> 		name = substitute (buffer, rp->name, &rp->regs);
> 
> 	      /* Force explicit tag name, if a name is there. */
> 	      pfnote (name, true, buffer + linecharno,
> 		      charno - linecharno, lineno, linecharno);
> 
> But if you say that we should add that offset of 1 when 'name' is
> NULL, I'm okay with doing that.

I've decided to install the change on the master branch.  Let's see
what, if anything, it will break.

I'm closing the bug with this message.





      reply	other threads:[~2024-10-19  8:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-12 14:39 bug#73771: 30.0.91; etags generates broken TAGS file for multi-line regex match Morgan Willcock
2024-10-12 16:22 ` Eli Zaretskii
2024-10-13 10:48   ` Francesco Potortì
2024-10-13 12:58     ` Eli Zaretskii
2024-10-19  8:20       ` Eli Zaretskii [this message]

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=86sessld0q.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73771-done@debbugs.gnu.org \
    --cc=morgan@ice9.digital \
    --cc=pot@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.