unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Welsh Duggan <mwd@md5i.com>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: "Richard Copley" <rcopley@gmail.com>,
	"Mattias Engdegård" <mattiase@acm.org>,
	"Emacs developers" <emacs-devel@gnu.org>
Subject: Re: Regexp linting scan
Date: Wed, 04 Dec 2019 21:10:07 -0500	[thread overview]
Message-ID: <877e3bldz4.fsf@md5i.com> (raw)
In-Reply-To: <f25347d3-3350-26a1-432c-09656adbe8a0@cs.ucla.edu> (Paul Eggert's message of "Wed, 4 Dec 2019 16:57:10 -0800")

Paul Eggert <eggert@cs.ucla.edu> writes:

> Thanks for the scan; I installed the attached.
>
> diff --git a/lisp/mail/rfc2368.el b/lisp/mail/rfc2368.el
> index 05f27e4d99..b658ffab58 100644
> --- a/lisp/mail/rfc2368.el
> +++ b/lisp/mail/rfc2368.el
> @@ -61,7 +61,7 @@
>  ;; only an approximation?
>  ;; see rfc 1738
>  (defconst rfc2368-mailto-regexp
> -  "^\\(mailto:\\)\\([^?]+\\)*\\(\\?\\(.*\\)\\)*"
> +  "^\\(mailto:\\)\\([^?]+\\)?\\(\\?\\(.*\\)\\)*"
>    "Regular expression to match and aid in parsing a mailto url.")
>  
>  ;; describes 'mailto:'

Wouldn't "^\\(mailto:\\)\\([^?]*\\)\\(\\?\\(.*\\)\\)*" make more sense?
Maybe even without the grouping, as it doesn't seem to be used.  If I'm
not mistaken (and I might be) this matches "mailto:" followed by anything
as long as it contains at most one question mark.

> diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
> index 0afbdc3dd1..6ec8d995c1 100644
> --- a/lisp/progmodes/verilog-mode.el
> +++ b/lisp/progmodes/verilog-mode.el
> @@ -10973,7 +10973,7 @@ verilog-inject-inst
>  		(t
>  		 ;; Delete identical interconnect
>                   (let ((case-fold-search nil))  ; So we don't convert upper-to-lower, etc
> -		   (while (verilog-re-search-forward-quick "\\.\\s *\\([a-zA-Z0-9`_$]+\\)*\\s *(\\s *\\1\\s *)\\s *" end-pt t)
> +		   (while (verilog-re-search-forward-quick "\\.\\s *\\([a-zA-Z0-9`_$]+\\)?\\s *(\\s *\\1\\s *)\\s *" end-pt t)
>  		     (delete-region (match-beginning 0) (match-end 0))
>                       (setq end-pt (- end-pt (- (match-end 0) (match-beginning 0))))  ; Keep it correct
>  		     (while (or (looking-at "[ \t\n\f,]+")

Similarly, in this one I think you could also replace the `+' with a `*'
and leave out the `?'.

-- 
Michael Welsh Duggan
(md5i@md5i.com)



  reply	other threads:[~2019-12-05  2:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-01 22:20 Regexp linting scan Mattias Engdegård
2019-12-02 10:14 ` Richard Copley
2019-12-02 10:19   ` Mattias Engdegård
2019-12-05  0:57     ` Paul Eggert
2019-12-05  2:10       ` Michael Welsh Duggan [this message]
2019-12-05 11:38         ` Mattias Engdegård
2019-12-05 12:11           ` Mattias Engdegård
2019-12-06  3:34             ` Paul Eggert
2019-12-05 10:21       ` Mattias Engdegård
  -- strict thread matches above, loose matches on Subject: below --
2020-01-30 16:16 Mattias Engdegård
2020-02-20 15:13 ` Mattias Engdegård

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=877e3bldz4.fsf@md5i.com \
    --to=mwd@md5i.com \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=mattiase@acm.org \
    --cc=rcopley@gmail.com \
    /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).