|
@@ -5225,7 +5225,7 @@ This should be called after the variable `org-link-types' has changed."
|
|
|
(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.
|
|
|
This one does not require the space 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.")
|
|
|
(defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,16\\}>")
|
|
|
"Regular expression matching time stamps, with groups.")
|
|
@@ -18634,7 +18634,7 @@ in the timestamp determines what will be changed."
|
|
|
ts (match-string 0))
|
|
|
(replace-match "")
|
|
|
(if (string-match
|
|
|
- "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( [-+][0-9]+[dwmy]\\)*\\)[]>]"
|
|
|
+ "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( +[-+][0-9]+[dwmy]\\)*\\)[]>]"
|
|
|
ts)
|
|
|
(setq extra (match-string 1 ts)))
|
|
|
(if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts)
|
|
@@ -18655,7 +18655,7 @@ in the timestamp determines what will be changed."
|
|
|
(+ (if (eq org-ts-what 'year) n 0) (nth 5 time0))
|
|
|
(nthcdr 6 time0)))
|
|
|
(when (integerp org-ts-what)
|
|
|
- (setq extra (org-modify-ts-extra extra org-ts-what n)))
|
|
|
+ (setq extra (org-modify-ts-extra extra org-ts-what n dm)))
|
|
|
(if (eq what 'calendar)
|
|
|
(let ((cal-date (org-get-date-from-calendar)))
|
|
|
(setcar (nthcdr 4 time0) (nth 0 cal-date)) ; month
|
|
@@ -18676,11 +18676,11 @@ in the timestamp determines what will be changed."
|
|
|
(org-recenter-calendar (time-to-days time))))))
|
|
|
|
|
|
;; FIXME: does not yet work for lead times
|
|
|
-(defun org-modify-ts-extra (s pos n)
|
|
|
+(defun org-modify-ts-extra (s pos n dm)
|
|
|
"Change the different parts of the lead-time and repeat fields in timestamp."
|
|
|
(let ((idx '(("d" . 0) ("w" . 1) ("m" . 2) ("y" . 3) ("d" . -1) ("y" . 4)))
|
|
|
- ng h m new)
|
|
|
- (when (string-match "\\(-\\([012][0-9]\\):\\([0-5][0-9]\\)\\)?\\( \\+\\([0-9]+\\)\\([dmwy]\\)\\)?" s)
|
|
|
+ ng h m new rem)
|
|
|
+ (when (string-match "\\(-\\([012][0-9]\\):\\([0-5][0-9]\\)\\)?\\( +\\+\\([0-9]+\\)\\([dmwy]\\)\\)?\\( +-\\([0-9]+\\)\\([dmwy]\\)\\)?" s)
|
|
|
(cond
|
|
|
((or (org-pos-in-match-range pos 2)
|
|
|
(org-pos-in-match-range pos 3))
|
|
@@ -18688,6 +18688,9 @@ in the timestamp determines what will be changed."
|
|
|
h (string-to-number (match-string 2 s)))
|
|
|
(if (org-pos-in-match-range pos 2)
|
|
|
(setq h (+ h n))
|
|
|
+ (setq n (* dm (org-no-warnings (signum n))))
|
|
|
+ (when (not (= 0 (setq rem (% m dm))))
|
|
|
+ (setq m (+ m (if (> n 0) (- rem) (- dm rem)))))
|
|
|
(setq m (+ m n)))
|
|
|
(if (< m 0) (setq m (+ m 60) h (1- h)))
|
|
|
(if (> m 59) (setq m (- m 60) h (1+ h)))
|
|
@@ -18696,8 +18699,13 @@ in the timestamp determines what will be changed."
|
|
|
((org-pos-in-match-range pos 6)
|
|
|
(setq ng 6 new (car (rassoc (+ n (cdr (assoc (match-string 6 s) idx))) idx))))
|
|
|
((org-pos-in-match-range pos 5)
|
|
|
- (setq ng 5 new (format "%d" (max 1 (+ n (string-to-number (match-string 5 s))))))))
|
|
|
-
|
|
|
+ (setq ng 5 new (format "%d" (max 1 (+ n (string-to-number (match-string 5 s)))))))
|
|
|
+
|
|
|
+ ((org-pos-in-match-range pos 9)
|
|
|
+ (setq ng 9 new (car (rassoc (+ n (cdr (assoc (match-string 9 s) idx))) idx))))
|
|
|
+ ((org-pos-in-match-range pos 8)
|
|
|
+ (setq ng 8 new (format "%d" (max 0 (+ n (string-to-number (match-string 8 s))))))))
|
|
|
+
|
|
|
(when ng
|
|
|
(setq s (concat
|
|
|
(substring s 0 (match-beginning ng))
|