unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Regexp error scan (March 26)
Date: Wed, 27 Mar 2019 13:09:07 +0100	[thread overview]
Message-ID: <D87FC517-93D0-4898-AE3F-04A250B9D0B9@acm.org> (raw)
In-Reply-To: <77419a89-ce9f-919b-c221-c7a3b938587a@cs.ucla.edu>

27 mars 2019 kl. 03.10 skrev Paul Eggert <eggert@cs.ucla.edu>:
> 
> Thanks, I installed the attached patch to try to fix those issues.

Thank you, that was quick!

-  (concat (nth 2 (or (assq footnote-style footnote-style-alist)
-		     (nth 0 footnote-style-alist)))
-	  "*"))
+  (let ((regexp (nth 2 (or (assq footnote-style footnote-style-alist)
+			   (nth 0 footnote-style-alist)))))
+    (concat
+     ;; Hack to avoid repetition of repetition.
+     (if (string-match "[^\\]\\\\\\{2\\}*[*+?]\\'" regexp)
+	 (substring regexp 0 -1)
+       regexp)
+     "*")))
 
The repetition-of-repetition check is useful and has caught several
actual errors; this may be the first true false positive that has to
be hacked around. We could suppress the complaint if the inner
repetition is wrapped in brackets, like \(?:a+\)*, but it would reduce
the error-finding power of the check.

In this case I'm not sure the added * makes sense at all; there is
always a single number within the footnote-{start,end}-tag pairs.
Worse, the code goes on and adds yet another + later on, in
footnote-refresh-footnotes, just in case. That makes even less sense.
Likely, both the * and the extra + should go away.

-    ("^[ \t]*\\(:root\\)\\(?:[\n \t]*\\)*{" (1 'css-selector keep))
+    ("^[ \t]*\\(:root\\)\\(?:[\n \t]*\\){" (1 'css-selector keep))

Those brackets around the [\n \t] could go away, too.




      parent reply	other threads:[~2019-03-27 12:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-26 17:38 Regexp error scan (March 26) Mattias Engdegård
2019-03-27  2:10 ` Paul Eggert
2019-03-27  3:43   ` Basil L. Contovounesios
2019-03-27  9:14     ` Mattias Engdegård
2019-03-27 13:55       ` Andy Moreton
2019-03-27 14:36         ` Stefan Monnier
2019-03-27 14:41           ` Mattias Engdegård
2019-03-27 14:45             ` Stefan Monnier
2019-03-27 14:49               ` Noam Postavsky
2019-03-27 15:45                 ` Mattias Engdegård
2019-03-27 15:48                 ` Stefan Monnier
2019-03-27 18:50                   ` Paul Eggert
2019-03-27 15:28             ` Damien Collard
2019-03-27 12:09   ` Mattias Engdegård [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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=D87FC517-93D0-4898-AE3F-04A250B9D0B9@acm.org \
    --to=mattiase@acm.org \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).