Fix speed regression introduced in change about repeated timestamps
* lisp/org.el (org-auto-repeat-maybe): Fix speed regression introduced in "Also obey to repeaters in inactive time stamps". Reported-by: Marco Wahl <marcowahlsoft@gmail.com> <http://lists.gnu.org/r/emacs-orgmode/2018-11/msg00078.html>
This commit is contained in:
parent
feb44212b5
commit
7bf3c10819
29
lisp/org.el
29
lisp/org.el
|
@ -12766,20 +12766,25 @@ This function is run automatically after each state change to a DONE state."
|
||||||
(or done-word (car org-done-keywords))
|
(or done-word (car org-done-keywords))
|
||||||
org-last-state
|
org-last-state
|
||||||
org-log-repeat)))
|
org-log-repeat)))
|
||||||
|
;; Time-stamps without a repeater are usually skipped. However,
|
||||||
|
;; a SCHEDULED time-stamp without one is removed, as they are no
|
||||||
|
;; longer relevant.
|
||||||
|
(save-excursion
|
||||||
|
(let ((scheduled (org-entry-get (point) "SCHEDULED")))
|
||||||
|
(when (and scheduled (not (string-match-p org-repeat-re scheduled)))
|
||||||
|
(org-remove-timestamp-with-keyword org-scheduled-string))))
|
||||||
|
;; Update every time-stamp with a repeater in the entry.
|
||||||
(let ((planning-re (regexp-opt
|
(let ((planning-re (regexp-opt
|
||||||
(list org-scheduled-string org-deadline-string))))
|
(list org-scheduled-string org-deadline-string))))
|
||||||
(while (re-search-forward org-ts-regexp-both end t)
|
(while (re-search-forward org-repeat-re end t)
|
||||||
(let* ((ts (match-string 0))
|
(let* ((ts (match-string 0))
|
||||||
(planning? (org-at-planning-p))
|
(type (if (not (org-at-planning-p)) "Plain:"
|
||||||
(type (if (not planning?) "Plain:"
|
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(re-search-backward
|
(re-search-backward
|
||||||
planning-re (line-beginning-position) t)
|
planning-re (line-beginning-position) t)
|
||||||
(match-string 0)))))
|
(match-string 0)))))
|
||||||
(cond
|
(when (and (org-at-timestamp-p 'agenda)
|
||||||
;; Ignore fake time-stamps (e.g., within comments).
|
(string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts))
|
||||||
((not (org-at-timestamp-p 'agenda)))
|
|
||||||
((string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts)
|
|
||||||
(let ((n (string-to-number (match-string 2 ts)))
|
(let ((n (string-to-number (match-string 2 ts)))
|
||||||
(what (match-string 3 ts)))
|
(what (match-string 3 ts)))
|
||||||
(when (equal what "w") (setq n (* n 7) what "d"))
|
(when (equal what "w") (setq n (* n 7) what "d"))
|
||||||
|
@ -12826,15 +12831,9 @@ enough to shift date past today. Continue? "
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(org-timestamp-change n (cdr (assoc what whata)) nil t))
|
(org-timestamp-change n (cdr (assoc what whata)) nil t))
|
||||||
(setq msg
|
(setq msg
|
||||||
(concat msg type " " org-last-changed-timestamp " "))))
|
(concat msg type " " org-last-changed-timestamp " ")))))))
|
||||||
(t
|
|
||||||
;; Time-stamps without a repeater are usually skipped.
|
|
||||||
;; However, a SCHEDULED time-stamp without one is
|
|
||||||
;; removed, as they are no longer relevant.
|
|
||||||
(when (equal type org-scheduled-string)
|
|
||||||
(org-remove-timestamp-with-keyword type)))))))
|
|
||||||
(setq org-log-post-message msg)
|
(setq org-log-post-message msg)
|
||||||
(message "%s" msg))))
|
(message msg))))
|
||||||
|
|
||||||
(defun org-show-todo-tree (arg)
|
(defun org-show-todo-tree (arg)
|
||||||
"Make a compact tree which shows all headlines marked with TODO.
|
"Make a compact tree which shows all headlines marked with TODO.
|
||||||
|
|
Loading…
Reference in New Issue