Fix two bugs in time regular expressions

* lisp/org.el (org-ts-regexp-both): Add "]" to class of characters that
should not be matched.
(org-ts-regexp0):
(org-ts-regexp1): Do not start a class with "^]-+", because that tries
to (not) match characters between "]" and "+".  Instead, move the "-"
to the end of the class where it causes no harm.
This commit is contained in:
Carsten Dominik 2011-04-03 12:25:31 +02:00
parent a9e6c07b6a
commit 5d5ea7bccc
1 changed files with 4 additions and 3 deletions

View File

@ -5003,13 +5003,13 @@ This should be called after the variable `org-link-types' has changed."
(defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)>" (defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)>"
"Regular expression for fast time stamp matching.") "Regular expression for fast time stamp matching.")
(defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)[]>]" (defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^]\r\n>]*?\\)[]>]"
"Regular expression for fast time stamp matching.") "Regular expression for fast time stamp matching.")
(defconst org-ts-regexp0 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) *\\([^]-+0-9>\r\n ]*\\)\\( \\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" (defconst org-ts-regexp0 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) *\\([^]+0-9>\r\n -]*\\)\\( \\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
"Regular expression matching time strings for analysis. "Regular expression matching time strings for analysis.
This one does not require the space after the date, so it can be used This one does not require the space after the date, so it can be used
on a string that terminates immediately after the date.") on a string that terminates immediately after the date.")
(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) +\\([^]-+0-9>\r\n ]*\\)\\( \\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" (defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) +\\([^]+0-9>\r\n -]*\\)\\( \\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
"Regular expression matching time strings for analysis.") "Regular expression matching time strings for analysis.")
(defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,16\\}>") (defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,16\\}>")
"Regular expression matching time stamps, with groups.") "Regular expression matching time stamps, with groups.")
@ -15402,6 +15402,7 @@ With prefix ARG, change that many days."
The date will be changed by N times WHAT. WHAT can be `day', `month', The date will be changed by N times WHAT. WHAT can be `day', `month',
`year', `minute', `second'. If WHAT is not given, the cursor position `year', `minute', `second'. If WHAT is not given, the cursor position
in the timestamp determines what will be changed." in the timestamp determines what will be changed."
(debug)
(let ((pos (point)) (let ((pos (point))
with-hm inactive with-hm inactive
(dm (max (nth 1 org-time-stamp-rounding-minutes) 1)) (dm (max (nth 1 org-time-stamp-rounding-minutes) 1))