aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/org
diff options
context:
space:
mode:
authorMattias EngdegÄrd2020-02-20 15:45:44 +0100
committerMattias EngdegÄrd2020-02-20 16:05:18 +0100
commit770f76f050376bbd77a3cc8cf44db57cf855a27c (patch)
tree9cfc115c6130b67939865c7e56d92075eff6484a /lisp/org
parent8dc4034ed6f86455c294f22a3d345b00cd4aa143 (diff)
downloademacs-770f76f050376bbd77a3cc8cf44db57cf855a27c.tar.gz
emacs-770f76f050376bbd77a3cc8cf44db57cf855a27c.zip
Remove subsumed repetitions in regexps
Make regexps smaller and faster by removing terms that are superfluous by virtue of standing next to another term that matches more. See https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00949.html for details. * lisp/bs.el (bs--make-header-match-string): * lisp/gnus/deuglify.el (gnus-outlook-repair-attribution-block): * lisp/gnus/message.el (message-subject-trailing-was-ask-regexp) (message-subject-trailing-was-regexp): * lisp/informat.el (Info-validate): * lisp/net/browse-url.el (browse-url-button-regexp): * lisp/net/rcirc.el (rcirc-url-regexp): * lisp/org/ob-core.el (org-babel-remove-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/org-capture.el (org-capture-set-target-location): * lisp/org/org-table.el (org-table-expand-lhs-ranges): * lisp/org/org.el (org-maybe-keyword-time-regexp, org-ts-regexp) (org-ts-regexp-inactive, org-ts-regexp-both): * lisp/play/gametree.el (gametree-hack-file-layout): * lisp/progmodes/cc-mode.el (c-Java-defun-prompt-regexp): * lisp/progmodes/idlw-shell.el (idlwave-shell-halting-error): * lisp/progmodes/ruby-mode.el (ruby-mode-set-encoding): * lisp/progmodes/verilog-mode.el (verilog-error-font-lock-keywords) (verilog-verilint-off, verilog-case-indent-level) (verilog-within-translate-off, verilog-start-translate-off) (verilog-back-to-start-translate-off, verilog-end-translate-off) (verilog-expand-dirnames): * lisp/term.el (term-control-seq-regexp): * lisp/textmodes/reftex-vars.el (featurep): * lisp/url/url-gw.el (url-open-telnet): * lisp/vc/ediff-ptch.el (ediff-context-diff-label-regexp): * lisp/vc/pcvs-parse.el (cvs-parse-status): * test/src/regex-emacs-tests.el (regex-tests-PCRE): Remove subsumed repetitions. * lisp/progmodes/sh-script.el (sh-syntax-propertize-function): Simplify repetition of a repetition.
Diffstat (limited to 'lisp/org')
-rw-r--r--lisp/org/ob-core.el2
-rw-r--r--lisp/org/ob-fortran.el2
-rw-r--r--lisp/org/org-capture.el2
-rw-r--r--lisp/org/org-table.el2
-rw-r--r--lisp/org/org.el8
5 files changed, 8 insertions, 8 deletions
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index 651561a2018..a5ad97a468b 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -2437,7 +2437,7 @@ INFO may provide the values of these header arguments (in the
2437 (when location 2437 (when location
2438 (save-excursion 2438 (save-excursion
2439 (goto-char location) 2439 (goto-char location)
2440 (when (looking-at (concat org-babel-result-regexp ".*$")) 2440 (when (looking-at org-babel-result-regexp)
2441 (delete-region 2441 (delete-region
2442 (if keep-keyword (line-beginning-position 2) 2442 (if keep-keyword (line-beginning-position 2)
2443 (save-excursion 2443 (save-excursion
diff --git a/lisp/org/ob-fortran.el b/lisp/org/ob-fortran.el
index 154465f28e1..149058f05f4 100644
--- a/lisp/org/ob-fortran.el
+++ b/lisp/org/ob-fortran.el
@@ -106,7 +106,7 @@ its header arguments."
106 106
107(defun org-babel-fortran-ensure-main-wrap (body params) 107(defun org-babel-fortran-ensure-main-wrap (body params)
108 "Wrap body in a \"program ... end program\" block if none exists." 108 "Wrap body in a \"program ... end program\" block if none exists."
109 (if (string-match "^[ \t]*program[ \t]*.*" (capitalize body)) 109 (if (string-match "^[ \t]*program\\>" (capitalize body))
110 (let ((vars (org-babel--get-vars params))) 110 (let ((vars (org-babel--get-vars params)))
111 (when vars (error "Cannot use :vars if `program' statement is present")) 111 (when vars (error "Cannot use :vars if `program' statement is present"))
112 body) 112 body)
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
index 003cbef1fdf..ace51270175 100644
--- a/lisp/org/org-capture.el
+++ b/lisp/org/org-capture.el
@@ -1021,7 +1021,7 @@ Store them in the capture property list."
1021 (apply #'encode-time 0 0 1021 (apply #'encode-time 0 0
1022 org-extend-today-until 1022 org-extend-today-until
1023 (cl-cdddr (decode-time prompt-time)))) 1023 (cl-cdddr (decode-time prompt-time))))
1024 ((string-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)" 1024 ((string-match "\\([^ ]+\\)-[^ ]+[ ]+\\(.*\\)"
1025 org-read-date-final-answer) 1025 org-read-date-final-answer)
1026 ;; Replace any time range by its start. 1026 ;; Replace any time range by its start.
1027 (apply #'encode-time 1027 (apply #'encode-time
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 469e01be5d2..98702feb375 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -3099,7 +3099,7 @@ function assumes the table is already analyzed (i.e., using
3099 (let ((lhs (car e)) 3099 (let ((lhs (car e))
3100 (rhs (cdr e))) 3100 (rhs (cdr e)))
3101 (cond 3101 (cond
3102 ((string-match-p "\\`@-?[-+0-9]+\\$-?[0-9]+\\'" lhs) 3102 ((string-match-p "\\`@[-+0-9]+\\$-?[0-9]+\\'" lhs)
3103 ;; This just refers to one fixed field. 3103 ;; This just refers to one fixed field.
3104 (push e res)) 3104 (push e res))
3105 ((string-match-p "\\`[a-zA-Z][_a-zA-Z0-9]*\\'" lhs) 3105 ((string-match-p "\\`[a-zA-Z][_a-zA-Z0-9]*\\'" lhs)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index e8e1ef99f26..52b72817650 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -460,7 +460,7 @@ Matched keyword is in group 1.")
460 org-clock-string) 460 org-clock-string)
461 t) 461 t)
462 "\\)?" 462 "\\)?"
463 " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^]\r\n>]*?[]>]" 463 " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^]\r\n>]*[]>]"
464 "\\|" 464 "\\|"
465 "<%%([^\r\n>]*>\\)") 465 "<%%([^\r\n>]*>\\)")
466 "Matches a timestamp, possibly preceded by a keyword.") 466 "Matches a timestamp, possibly preceded by a keyword.")
@@ -564,14 +564,14 @@ Effort estimates given in this property need to have the format H:MM.")
564 564
565;;;; Timestamp 565;;;; Timestamp
566 566
567(defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^\r\n>]*?\\)>" 567(defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*\\)>"
568 "Regular expression for fast time stamp matching.") 568 "Regular expression for fast time stamp matching.")
569 569
570(defconst org-ts-regexp-inactive 570(defconst org-ts-regexp-inactive
571 "\\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^\r\n>]*?\\)\\]" 571 "\\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*\\)\\]"
572 "Regular expression for fast inactive time stamp matching.") 572 "Regular expression for fast inactive time stamp matching.")
573 573
574(defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^]\r\n>]*?\\)[]>]" 574(defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^]\r\n>]*\\)[]>]"
575 "Regular expression for fast time stamp matching.") 575 "Regular expression for fast time stamp matching.")
576 576
577(defconst org-ts-regexp0 577(defconst org-ts-regexp0