瀏覽代碼

Backport commit 46394dff7 from Emacs

* lisp/ob-core.el (org-babel--string-to-number): Put hyphen last in
alternative.
* lisp/org-agenda.el (org-agenda-filter): Escape '+' correctly.

Follow good regexp practice
46394dff7f01e7fe4af06a6c344e151af5c3eef4
Mattias Engdegård
Fri Dec 18 14:35:09 2020 +0100
Mattias Engdegård 4 年之前
父節點
當前提交
4c934424d6
共有 2 個文件被更改,包括 4 次插入4 次删除
  1. 1 1
      lisp/ob-core.el
  2. 3 3
      lisp/org-agenda.el

+ 1 - 1
lisp/ob-core.el

@@ -2995,7 +2995,7 @@ situations in which is it not appropriate."
   "If STRING represents a number return its value.
 Otherwise return nil."
   (unless (or (string-match-p "\\s-" (org-trim string))
-	      (not (string-match-p "^[0-9-e.+ ]+$" string)))
+	      (not (string-match-p "^[0-9e.+ -]+$" string)))
     (let ((interned-string (ignore-errors (read string))))
       (when (numberp interned-string)
 	interned-string))))

+ 3 - 3
lisp/org-agenda.el

@@ -7734,9 +7734,9 @@ the variable `org-agenda-auto-exclude-function'."
 	   (negate (equal strip-or-accumulate '(4)))
 	   (cf (mapconcat #'identity org-agenda-category-filter ""))
 	   (tf (mapconcat #'identity org-agenda-tag-filter ""))
-	   (rpl-fn (lambda (c) (replace-regexp-in-string "^\+" "" (or (car c) ""))))
-	   (ef (replace-regexp-in-string "^\+" "" (or (car org-agenda-effort-filter) "")))
-	   (rf (replace-regexp-in-string "^\+" "" (or (car org-agenda-regexp-filter) "")))
+	   (rpl-fn (lambda (c) (replace-regexp-in-string "^\\+" "" (or (car c) ""))))
+	   (ef (replace-regexp-in-string "^\\+" "" (or (car org-agenda-effort-filter) "")))
+	   (rf (replace-regexp-in-string "^\\+" "" (or (car org-agenda-regexp-filter) "")))
 	   (ff (concat cf tf ef (when (not (equal rf "")) (concat "/" rf "/"))))
 	   (f-string (completing-read
 		      (concat