summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2020-02-20 15:45:44 +0100
committerKyle Meyer <kyle@kyleam.com>2020-03-15 22:51:31 -0400
commitb78583a1c172009b25552e0f6c5d3f644eb888ce (patch)
treeb203ddd59c5700a83fc17c8823c91f10abda5db9
parent0c046aecf0a1550f1c2bbc31d6641b65ebb478aa (diff)
downloadorg-mode-b78583a1c172009b25552e0f6c5d3f644eb888ce.tar.gz
Backport commit 770f76f05 from Emacs
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/ob-core.el (org-babel-remove-result): * lisp/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org-capture.el (org-capture-set-target-location): * lisp/org-compat.el (org-maybe-keyword-time-regexp): * lisp/org-table.el (org-table-expand-lhs-ranges): Remove subsumed repetitions. Remove subsumed repetitions in regexps 770f76f050376bbd77a3cc8cf44db57cf855a27c Mattias EngdegÄrd Thu Feb 20 16:05:18 2020 +0100
-rw-r--r--lisp/ob-core.el2
-rw-r--r--lisp/ob-fortran.el2
-rw-r--r--lisp/org-capture.el2
-rw-r--r--lisp/org-compat.el2
-rw-r--r--lisp/org-table.el2
5 files changed, 5 insertions, 5 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index b9f2746..10aed1f 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2439,7 +2439,7 @@ INFO may provide the values of these header arguments (in the
(when location
(save-excursion
(goto-char location)
- (when (looking-at (concat org-babel-result-regexp ".*$"))
+ (when (looking-at org-babel-result-regexp)
(delete-region
(if keep-keyword (line-beginning-position 2)
(save-excursion
diff --git a/lisp/ob-fortran.el b/lisp/ob-fortran.el
index 7e15022..279ca6c 100644
--- a/lisp/ob-fortran.el
+++ b/lisp/ob-fortran.el
@@ -107,7 +107,7 @@ its header arguments."
(defun org-babel-fortran-ensure-main-wrap (body params)
"Wrap body in a \"program ... end program\" block if none exists."
- (if (string-match "^[ \t]*program[ \t]*.*" (capitalize body))
+ (if (string-match "^[ \t]*program\\>" (capitalize body))
(let ((vars (org-babel--get-vars params)))
(when vars (error "Cannot use :vars if `program' statement is present"))
body)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 87d4a25..d292def 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1034,7 +1034,7 @@ Store them in the capture property list."
(apply #'encode-time 0 0
org-extend-today-until
(cl-cdddr (decode-time prompt-time))))
- ((string-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)"
+ ((string-match "\\([^ ]+\\)-[^ ]+[ ]+\\(.*\\)"
org-read-date-final-answer)
;; Replace any time range by its start.
(apply #'encode-time
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index e3cccdb..26eb0f9 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -639,7 +639,7 @@ use of this function is for the stuck project list."
(defconst org-maybe-keyword-time-regexp
(concat "\\(\\<\\(\\(?:CLO\\(?:CK\\|SED\\)\\|DEADLINE\\|SCHEDULED\\):\\)\\)?"
- " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^]\r\n>]*?[]>]"
+ " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^]\r\n>]*[]>]"
"\\|"
"<%%([^\r\n>]*>\\)")
"Matches a timestamp, possibly preceded by a keyword.")
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 644d6b6..866abc2 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3163,7 +3163,7 @@ function assumes the table is already analyzed (i.e., using
(let ((lhs (car e))
(rhs (cdr e)))
(cond
- ((string-match-p "\\`@-?[-+0-9]+\\$-?[0-9]+\\'" lhs)
+ ((string-match-p "\\`@[-+0-9]+\\$-?[0-9]+\\'" lhs)
;; This just refers to one fixed field.
(push e res))
((string-match-p "\\`[a-zA-Z][_a-zA-Z0-9]*\\'" lhs)