aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2019-04-12 19:43:16 -0700
committerPaul Eggert2019-04-12 19:43:41 -0700
commit7ddd08bd3ebc48998062a7d29274cf080256a48f (patch)
treeda54083040dc4675dc5b9084ab32a0ed4ec6a8f5
parent8635e011edd1c50678074a49cbbf857b35823e9d (diff)
downloademacs-7ddd08bd3ebc48998062a7d29274cf080256a48f.tar.gz
emacs-7ddd08bd3ebc48998062a7d29274cf080256a48f.zip
Omit/rewrite useless regexp repetitions
Problem reported by Mattias Engdegård in: https://lists.gnu.org/r/emacs-devel/2019-04/msg00527.html * lisp/align.el (align-rules-list): * lisp/cedet/srecode/srt-mode.el (srecode-font-lock-keywords): * lisp/emacs-lisp/copyright.el (copyright-regexp): * lisp/erc/erc-backend.el (JOIN): * lisp/erc/erc-goodies.el (erc-unmorse): * lisp/mail/mail-extr.el (mail-extr-telephone-extension-pattern): * lisp/net/tramp-adb.el (tramp-adb-prompt): * lisp/org/org-table.el (org-table-range-regexp): * lisp/progmodes/idlwave.el (idlwave-where): * lisp/progmodes/verilog-mode.el (verilog-declaration-re-2-no-macro) (verilog-declaration-re-2-macro, verilog-delete-auto-buffer) (verilog-auto-inst-port): * lisp/url/url-misc.el (url-data): Omit or rewrite useless repetitions that risk being very slow in the backtracking regexp engine in Emacs.
-rw-r--r--lisp/align.el2
-rw-r--r--lisp/cedet/srecode/srt-mode.el2
-rw-r--r--lisp/emacs-lisp/copyright.el2
-rw-r--r--lisp/erc/erc-backend.el2
-rw-r--r--lisp/erc/erc-goodies.el2
-rw-r--r--lisp/mail/mail-extr.el2
-rw-r--r--lisp/net/tramp-adb.el2
-rw-r--r--lisp/org/org-table.el4
-rw-r--r--lisp/progmodes/idlwave.el4
-rw-r--r--lisp/progmodes/verilog-mode.el8
-rw-r--r--lisp/url/url-misc.el2
11 files changed, 16 insertions, 16 deletions
diff --git a/lisp/align.el b/lisp/align.el
index fd88d0eda42..443237b451b 100644
--- a/lisp/align.el
+++ b/lisp/align.el
@@ -411,7 +411,7 @@ The possible settings for `align-region-separate' are:
411 (c-variable-declaration 411 (c-variable-declaration
412 (regexp . ,(concat "[*&0-9A-Za-z_]>?[&*]*\\(\\s-+[*&]*\\)" 412 (regexp . ,(concat "[*&0-9A-Za-z_]>?[&*]*\\(\\s-+[*&]*\\)"
413 "[A-Za-z_][0-9A-Za-z:_]*\\s-*\\(\\()\\|" 413 "[A-Za-z_][0-9A-Za-z:_]*\\s-*\\(\\()\\|"
414 "=[^=\n].*\\|(.*)\\|\\(\\[.*\\]\\)*\\)?" 414 "=[^=\n].*\\|(.*)\\|\\(\\[.*\\]\\)*\\)"
415 "\\s-*[;,]\\|)\\s-*$\\)")) 415 "\\s-*[;,]\\|)\\s-*$\\)"))
416 (group . 1) 416 (group . 1)
417 (modes . align-c++-modes) 417 (modes . align-c++-modes)
diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el
index 2ad7ffcdb87..6bf2d51ab41 100644
--- a/lisp/cedet/srecode/srt-mode.el
+++ b/lisp/cedet/srecode/srt-mode.el
@@ -64,7 +64,7 @@
64(defvar srecode-font-lock-keywords 64(defvar srecode-font-lock-keywords
65 '( 65 '(
66 ;; Template 66 ;; Template
67 ("^\\(template\\)\\s-+\\(\\w*\\)\\(\\( \\(:\\w+\\)\\|\\)+\\)$" 67 ("^\\(template\\)\\s-+\\(\\w*\\)\\(\\( \\(:\\w+\\)\\)*\\)$"
68 (1 font-lock-keyword-face) 68 (1 font-lock-keyword-face)
69 (2 font-lock-function-name-face) 69 (2 font-lock-function-name-face)
70 (3 font-lock-builtin-face )) 70 (3 font-lock-builtin-face ))
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index 2726bbc1f3f..be335838e33 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -52,7 +52,7 @@ This is useful for ChangeLogs."
52(defcustom copyright-regexp 52(defcustom copyright-regexp
53 "\\(©\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\ 53 "\\(©\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\
54\\|[Cc]opyright\\s *:?\\s *©\\)\ 54\\|[Cc]opyright\\s *:?\\s *©\\)\
55\\s *\\(?:[^0-9\n]*\\s *\\)?\ 55\\s *[^0-9\n]*\\s *\
56\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)" 56\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)"
57 "What your copyright notice looks like. 57 "What your copyright notice looks like.
58The second \\( \\) construct must match the years." 58The second \\( \\) construct must match the years."
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 2854cde19cc..210830a2b49 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -1285,7 +1285,7 @@ add things to `%s' instead."
1285 (pcase-let ((`(,nick ,login ,host) 1285 (pcase-let ((`(,nick ,login ,host)
1286 (erc-parse-user (erc-response.sender parsed)))) 1286 (erc-parse-user (erc-response.sender parsed))))
1287 ;; strip the stupid combined JOIN facility (IRC 2.9) 1287 ;; strip the stupid combined JOIN facility (IRC 2.9)
1288 (if (string-match "^\\(.*\\)?\^g.*$" chnl) 1288 (if (string-match "^\\(.*\\)\^g.*$" chnl)
1289 (setq chnl (match-string 1 chnl))) 1289 (setq chnl (match-string 1 chnl)))
1290 (save-excursion 1290 (save-excursion
1291 (let* ((str (cond 1291 (let* ((str (cond
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index 117b6783b8d..884c594b9ed 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -548,7 +548,7 @@ channel that has weird people talking in morse to each other.
548 548
549See also `unmorse-region'." 549See also `unmorse-region'."
550 (goto-char (point-min)) 550 (goto-char (point-min))
551 (when (re-search-forward "[.-]+\\([.-]*/? *\\)+[.-]+/?" nil t) 551 (when (re-search-forward "[.-]+[./ -]*[.-]/?" nil t)
552 (save-restriction 552 (save-restriction
553 (narrow-to-region (match-beginning 0) (match-end 0)) 553 (narrow-to-region (match-beginning 0) (match-end 0))
554 ;; Turn " / " into " " 554 ;; Turn " / " into " "
diff --git a/lisp/mail/mail-extr.el b/lisp/mail/mail-extr.el
index cb57d8ea016..a0b96886507 100644
--- a/lisp/mail/mail-extr.el
+++ b/lisp/mail/mail-extr.el
@@ -383,7 +383,7 @@ by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\"."
383;; Matches telephone extensions. 383;; Matches telephone extensions.
384(defconst mail-extr-telephone-extension-pattern 384(defconst mail-extr-telephone-extension-pattern
385 (purecopy 385 (purecopy
386 "\\(\\([Ee]xt\\|\\|[Tt]ph\\|[Tt]el\\|[Xx]\\).?\\)? *\\+?[0-9][- 0-9]+")) 386 "\\(\\([Ee]xt\\|[Tt]ph\\|[Tt]el\\|[Xx]\\).?\\)? *\\+?[0-9][- 0-9]+"))
387 387
388;; Matches ham radio call signs. 388;; Matches ham radio call signs.
389;; Help from: Mat Maessen N2NJZ <maessm@rpi.edu>, Mark Feit 389;; Help from: Mat Maessen N2NJZ <maessm@rpi.edu>, Mark Feit
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index db9acbfc631..f3aa55f16f5 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -53,7 +53,7 @@ It is used for TCP/IP devices."
53 "When this method name is used, forward all calls to Android Debug Bridge.") 53 "When this method name is used, forward all calls to Android Debug Bridge.")
54 54
55(defcustom tramp-adb-prompt 55(defcustom tramp-adb-prompt
56 "^\\(?:[[:digit:]]*|?\\)?\\(?:[[:alnum:]\e;[]*@?[[:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]" 56 "^[[:digit:]]*|?\\(?:[[:alnum:]\e;[]*@?[[:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]"
57 "Regexp used as prompt in almquist shell." 57 "Regexp used as prompt in almquist shell."
58 :type 'string 58 :type 'string
59 :version "24.4" 59 :version "24.4"
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index b6e864fc9c9..147527da1d3 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -484,8 +484,8 @@ Line numbers are counted from the beginning of the table. This
484variable is initialized with `org-table-analyze'.") 484variable is initialized with `org-table-analyze'.")
485 485
486(defconst org-table-range-regexp 486(defconst org-table-range-regexp
487 "@\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[0-9]+\\)?\\(\\.\\.@?\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[0-9]+\\)?\\)?" 487 "@\\([-+]?I*[-+]?[0-9]*\\)\\(\\$[-+]?[0-9]+\\)?\\(\\.\\.@?\\([-+]?I*[-+]?[0-9]*\\)\\(\\$[-+]?[0-9]+\\)?\\)?"
488 ;; 1 2 3 4 5 488 ;; 1 2 3 4 5
489 "Regular expression for matching ranges in formulas.") 489 "Regular expression for matching ranges in formulas.")
490 490
491(defconst org-table-range-regexp2 491(defconst org-table-range-regexp2
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index bded09d5038..6f56ce052a0 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -6454,10 +6454,10 @@ ARROW: Location of the arrow"
6454 ((string-match "\\`[ \t]*\\(pro\\|function\\)\\>" 6454 ((string-match "\\`[ \t]*\\(pro\\|function\\)\\>"
6455 match-string) 6455 match-string)
6456 nil) 6456 nil)
6457 ((string-match "OBJ_NEW([ \t]*['\"]\\([a-zA-Z0-9$_]*\\)?\\'" 6457 ((string-match "OBJ_NEW([ \t]*['\"][a-zA-Z0-9$_]*\\'"
6458 match-string) 6458 match-string)
6459 (setq cw 'class)) 6459 (setq cw 'class))
6460 ((string-match "\\<inherits\\s-+\\([a-zA-Z0-9$_]*\\)?\\'" 6460 ((string-match "\\<inherits\\s-+[a-zA-Z0-9$_]*\\'"
6461 match-string) 6461 match-string)
6462 (setq cw 'class)) 6462 (setq cw 'class))
6463 ((and func 6463 ((and func
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 9226291ffbb..e75e5845ef3 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -2761,12 +2761,12 @@ find the errors."
2761(defconst verilog-declaration-re-2-no-macro 2761(defconst verilog-declaration-re-2-no-macro
2762 (concat "\\s-*" verilog-declaration-re 2762 (concat "\\s-*" verilog-declaration-re
2763 "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" verilog-delay-re "\\)" 2763 "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" verilog-delay-re "\\)"
2764 "\\)?")) 2764 "\\)"))
2765(defconst verilog-declaration-re-2-macro 2765(defconst verilog-declaration-re-2-macro
2766 (concat "\\s-*" verilog-declaration-re 2766 (concat "\\s-*" verilog-declaration-re
2767 "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" verilog-delay-re "\\)" 2767 "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" verilog-delay-re "\\)"
2768 "\\|\\(" verilog-macroexp-re "\\)" 2768 "\\|\\(" verilog-macroexp-re "\\)"
2769 "\\)?")) 2769 "\\)"))
2770(defconst verilog-declaration-re-1-macro 2770(defconst verilog-declaration-re-1-macro
2771 (concat "^" verilog-declaration-re-2-macro)) 2771 (concat "^" verilog-declaration-re-2-macro))
2772 2772
@@ -10810,7 +10810,7 @@ Intended for internal use inside a `verilog-save-font-no-change-functions' block
10810 'verilog-delete-auto-star-all) 10810 'verilog-delete-auto-star-all)
10811 ;; Remove template comments ... anywhere in case was pasted after AUTOINST removed 10811 ;; Remove template comments ... anywhere in case was pasted after AUTOINST removed
10812 (goto-char (point-min)) 10812 (goto-char (point-min))
10813 (while (re-search-forward "\\s-*// \\(Templated\\|Implicit \\.\\*\\)\\([ \tLT0-9]*\\| LHS: .*\\)?$" nil t) 10813 (while (re-search-forward "\\s-*// \\(Templated\\|Implicit \\.\\*\\)\\([ \tLT0-9]*\\| LHS: .*\\)$" nil t)
10814 (replace-match "")) 10814 (replace-match ""))
10815 10815
10816 ;; Final customize 10816 ;; Final customize
@@ -11412,7 +11412,7 @@ If PAR-VALUES replace final strings with these parameter values."
11412 (when tpl-ass 11412 (when tpl-ass
11413 ;; Evaluate @"(lispcode)" 11413 ;; Evaluate @"(lispcode)"
11414 (when (string-match "@\".*[^\\]\"" tpl-net) 11414 (when (string-match "@\".*[^\\]\"" tpl-net)
11415 (while (string-match "@\"\\(\\([^\\\"]*\\(\\\\.\\)*\\)*\\)\"" tpl-net) 11415 (while (string-match "@\"\\(\\([^\\\"]\\|\\\\.\\)*\\)\"" tpl-net)
11416 (setq tpl-net 11416 (setq tpl-net
11417 (concat 11417 (concat
11418 (substring tpl-net 0 (match-beginning 0)) 11418 (substring tpl-net 0 (match-beginning 0))
diff --git a/lisp/url/url-misc.el b/lisp/url/url-misc.el
index 4969cba6688..aa44ea78a22 100644
--- a/lisp/url/url-misc.el
+++ b/lisp/url/url-misc.el
@@ -88,7 +88,7 @@
88 (encoding "8bit") 88 (encoding "8bit")
89 (data nil)) 89 (data nil))
90 (save-excursion 90 (save-excursion
91 (if (not (string-match "\\([^,]*\\)?," desc)) 91 (if (not (string-match "\\([^,]*\\)," desc))
92 (error "Malformed data URL: %s" desc) 92 (error "Malformed data URL: %s" desc)
93 (setq mediatype (match-string 1 desc) 93 (setq mediatype (match-string 1 desc)
94 data (url-unhex-string (substring desc (match-end 0)))) 94 data (url-unhex-string (substring desc (match-end 0))))