Advertisement
Guest User

Untitled

a guest
Aug 12th, 2018
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 62.12 KB | None | 0 0
  1. Debugger entered--Lisp error: (error "Invalid time zone specification" (nil nil nil))
  2.   encode-time(0 0 0 12 8 2018 (nil nil nil))
  3.   (setq time (encode-time (or (car time0) 0) (+ (if (eq org-ts-what 'minute) n 0) (nth 1 time0)) (+ (if (eq org-ts-what 'hour) n 0) (nth 2 time0)) (+ (if (eq org-ts-what 'day) n 0) (nth 3 time0)) (+ (if (eq org-ts-what 'month) n 0) (nth 4 time0)) (+ (if (eq org-ts-what 'year) n 0) (nth 5 time0)) (nthcdr 6 time0)))
  4.   (if (and (not what) (eq org-ts-what 'bracket)) (org-toggle-timestamp-type) (setq origin-cat org-ts-what) (if (and (not what) (not (eq org-ts-what 'day)) org-display-custom-times (get-text-property (point) 'display) (not (get-text-property (1- (point)) 'display))) (setq org-ts-what 'day)) (setq org-ts-what (or what org-ts-what) inactive (= (char-after (match-beginning 0)) 91) ts (match-string 0)) (replace-match "") (if (string-match "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( +[.+]?-?[-+][0-9]+[hdwmy]\\(/[0-9]+[hdwmy]\\)?\\)*\\)[]>]" ts) (progn (setq extra (match-string 1 ts)) (if suppress-tmp-delay (setq extra (replace-regexp-in-string " --[0-9]+[hdwmy]" "" extra))))) (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts) (setq with-hm t)) (setq time0 (org-parse-time-string ts)) (if (and updown (eq org-ts-what 'minute) (not current-prefix-arg)) (progn (setq n (* dm (cond ((> n 0) 1) ((< n 0) -1) (t 0)))) (if (not (= 0 (setq rem (% (nth 1 time0) dm)))) (progn (setcar (cdr time0) (+ (nth 1 time0) (if (> n 0) (- rem) (- dm rem)))))))) (setq time (encode-time (or (car time0) 0) (+ (if (eq org-ts-what 'minute) n 0) (nth 1 time0)) (+ (if (eq org-ts-what 'hour) n 0) (nth 2 time0)) (+ (if (eq org-ts-what 'day) n 0) (nth 3 time0)) (+ (if (eq org-ts-what 'month) n 0) (nth 4 time0)) (+ (if (eq org-ts-what 'year) n 0) (nth 5 time0)) (nthcdr 6 time0))) (if (and (member org-ts-what '(hour minute)) extra (string-match "-\\([012][0-9]\\):\\([0-5][0-9]\\)" extra)) (progn (setq extra (org-modify-ts-extra extra (if (eq org-ts-what 'hour) 2 5) n dm)))) (if (integerp org-ts-what) (progn (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)) (setcar (nthcdr 3 time0) (nth 1 cal-date)) (setcar (nthcdr 5 time0) (nth 2 cal-date)) (setcar time0 (or (car time0) 0)) (setcar (nthcdr 1 time0) (or (nth 1 time0) 0)) (setcar (nthcdr 2 time0) (or (nth 2 time0) 0)) (setq time (apply 'encode-time time0)))) (let ((pos (point))) (setq org-last-changed-timestamp (org-insert-time-stamp time with-hm inactive nil nil extra)) (goto-char pos)) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (looking-at org-ts-regexp3) (goto-char (cond ((eq origin-cat 'day) (min (or (match-beginning 7) (1- (match-end 5))) origin)) ((eq origin-cat 'hour) (min (match-end 7) origin)) ((eq origin-cat 'minute) (min (1- (match-end 8)) origin)) ((integerp origin-cat) (min (1- (match-end 0)) origin)) (t origin)))) (set-match-data save-match-data-internal 'evaporate))) (org-clock-update-time-maybe) (if org-clock-adjust-closest (progn (if (not (and (org-at-clock-log-p) (< 1 (length (delq nil (mapcar 'marker-position org-clock-history)))))) (message "No clock to adjust") (cond ((save-excursion (re-search-backward org-ts-regexp0 nil t) (org-looking-back (concat org-clock-string " \\[") (line-beginning-position))) (setq fixnext 1 clrgx (concat org-ts-regexp0 "\\] =>.*$"))) ((save-excursion (re-search-backward org-ts-regexp0 nil t) (looking-at (concat org-ts-regexp0 "\\] =>"))) (setq fixnext -1 clrgx (concat org-clock-string " \\[" org-ts-regexp0)))) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (let* ((p (save-excursion (org-back-to-heading t))) (cl (mapcar (function (lambda (c) (abs (- (marker-position c) p)))) org-clock-history)) (clfixnth (+ fixnext (- (length cl) (or (length (member (apply 'min cl) cl)) 100)))) (clfixpos (if (> 0 clfixnth) nil (nth clfixnth org-clock-history)))) (if (not clfixpos) (message "No clock to adjust") (save-excursion (org-goto-marker-or-bmk clfixpos) (org-show-subtree) (if (re-search-forward clrgx nil t) (progn (goto-char (match-beginning 1)) (let (org-clock-adjust-closest) (org-timestamp-change n org-ts-what updown)) (message "Clock adjusted in %s for heading: %s" (file-name-nondirectory (buffer-file-name)) (org-get-heading t t)))))))) (set-window-configuration wconfig)))))) (if (and org-calendar-follow-timestamp-change (get-buffer-window "*Calendar*" t) (memq org-ts-what '(day month year))) (org-recenter-calendar (time-to-days time))))
  5.   (let ((origin (point)) origin-cat with-hm inactive (dm (max (nth 1 org-time-stamp-rounding-minutes) 1)) org-ts-what extra rem ts time time0 fixnext clrgx) (if (not (org-at-timestamp-p t)) (user-error "Not at a timestamp")) (if (and (not what) (eq org-ts-what 'bracket)) (org-toggle-timestamp-type) (setq origin-cat org-ts-what) (if (and (not what) (not (eq org-ts-what 'day)) org-display-custom-times (get-text-property (point) 'display) (not (get-text-property (1- (point)) 'display))) (setq org-ts-what 'day)) (setq org-ts-what (or what org-ts-what) inactive (= (char-after (match-beginning 0)) 91) ts (match-string 0)) (replace-match "") (if (string-match "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( +[.+]?-?[-+][0-9]+[hdwmy]\\(/[0-9]+[hdwmy]\\)?\\)*\\)[]>]" ts) (progn (setq extra (match-string 1 ts)) (if suppress-tmp-delay (setq extra (replace-regexp-in-string " --[0-9]+[hdwmy]" "" extra))))) (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts) (setq with-hm t)) (setq time0 (org-parse-time-string ts)) (if (and updown (eq org-ts-what 'minute) (not current-prefix-arg)) (progn (setq n (* dm (cond ((> n 0) 1) ((< n 0) -1) (t 0)))) (if (not (= 0 (setq rem (% (nth 1 time0) dm)))) (progn (setcar (cdr time0) (+ (nth 1 time0) (if (> n 0) (- rem) (- dm rem)))))))) (setq time (encode-time (or (car time0) 0) (+ (if (eq org-ts-what 'minute) n 0) (nth 1 time0)) (+ (if (eq org-ts-what 'hour) n 0) (nth 2 time0)) (+ (if (eq org-ts-what 'day) n 0) (nth 3 time0)) (+ (if (eq org-ts-what 'month) n 0) (nth 4 time0)) (+ (if (eq org-ts-what 'year) n 0) (nth 5 time0)) (nthcdr 6 time0))) (if (and (member org-ts-what '(hour minute)) extra (string-match "-\\([012][0-9]\\):\\([0-5][0-9]\\)" extra)) (progn (setq extra (org-modify-ts-extra extra (if (eq org-ts-what 'hour) 2 5) n dm)))) (if (integerp org-ts-what) (progn (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)) (setcar (nthcdr 3 time0) (nth 1 cal-date)) (setcar (nthcdr 5 time0) (nth 2 cal-date)) (setcar time0 (or (car time0) 0)) (setcar (nthcdr 1 time0) (or (nth 1 time0) 0)) (setcar (nthcdr 2 time0) (or (nth 2 time0) 0)) (setq time (apply 'encode-time time0)))) (let ((pos (point))) (setq org-last-changed-timestamp (org-insert-time-stamp time with-hm inactive nil nil extra)) (goto-char pos)) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (looking-at org-ts-regexp3) (goto-char (cond ((eq origin-cat 'day) (min (or (match-beginning 7) (1- (match-end 5))) origin)) ((eq origin-cat 'hour) (min (match-end 7) origin)) ((eq origin-cat 'minute) (min (1- (match-end 8)) origin)) ((integerp origin-cat) (min (1- (match-end 0)) origin)) (t origin)))) (set-match-data save-match-data-internal 'evaporate))) (org-clock-update-time-maybe) (if org-clock-adjust-closest (progn (if (not (and (org-at-clock-log-p) (< 1 (length (delq nil (mapcar 'marker-position org-clock-history)))))) (message "No clock to adjust") (cond ((save-excursion (re-search-backward org-ts-regexp0 nil t) (org-looking-back (concat org-clock-string " \\[") (line-beginning-position))) (setq fixnext 1 clrgx (concat org-ts-regexp0 "\\] =>.*$"))) ((save-excursion (re-search-backward org-ts-regexp0 nil t) (looking-at (concat org-ts-regexp0 "\\] =>"))) (setq fixnext -1 clrgx (concat org-clock-string " \\[" org-ts-regexp0)))) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (let* ((p (save-excursion (org-back-to-heading t))) (cl (mapcar (function (lambda (c) (abs (- (marker-position c) p)))) org-clock-history)) (clfixnth (+ fixnext (- (length cl) (or (length (member (apply 'min cl) cl)) 100)))) (clfixpos (if (> 0 clfixnth) nil (nth clfixnth org-clock-history)))) (if (not clfixpos) (message "No clock to adjust") (save-excursion (org-goto-marker-or-bmk clfixpos) (org-show-subtree) (if (re-search-forward clrgx nil t) (progn (goto-char (match-beginning 1)) (let (org-clock-adjust-closest) (org-timestamp-change n org-ts-what updown)) (message "Clock adjusted in %s for heading: %s" (file-name-nondirectory (buffer-file-name)) (org-get-heading t t)))))))) (set-window-configuration wconfig)))))) (if (and org-calendar-follow-timestamp-change (get-buffer-window "*Calendar*" t) (memq org-ts-what '(day month year))) (org-recenter-calendar (time-to-days time)))))
  6.   org-timestamp-change(1 day)
  7.   (cond ((equal (match-string 1 ts) ".") (org-timestamp-change (- (org-today) (time-to-days time)) 'day)) ((equal (match-string 1 ts) "+") (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) (<= (time-to-days time) (time-to-days (current-time)))) (if (= (setq nshift (1+ nshift)) nshiftmax) (progn (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today.  Continue? " nshift)) (user-error "Abort")))) (org-timestamp-change n (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))))) (org-timestamp-change (- n) (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts)))
  8.   (progn (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))) (cond ((equal (match-string 1 ts) ".") (org-timestamp-change (- (org-today) (time-to-days time)) 'day)) ((equal (match-string 1 ts) "+") (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) (<= (time-to-days time) (time-to-days (current-time)))) (if (= (setq nshift (1+ nshift)) nshiftmax) (progn (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today.  Continue? " nshift)) (user-error "Abort")))) (org-timestamp-change n (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))))) (org-timestamp-change (- n) (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts))))
  9.   (if (match-end 1) (progn (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))) (cond ((equal (match-string 1 ts) ".") (org-timestamp-change (- (org-today) (time-to-days time)) 'day)) ((equal (match-string 1 ts) "+") (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) (<= (time-to-days time) (time-to-days (current-time)))) (if (= (setq nshift (1+ nshift)) nshiftmax) (progn (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today.  Continue? " nshift)) (user-error "Abort")))) (org-timestamp-change n (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))))) (org-timestamp-change (- n) (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts)))))
  10.   (progn (setq n (string-to-number (match-string 2 ts)) what (match-string 3 ts)) (if (equal what "w") (setq n (* n 7) what "d")) (if (and (equal what "h") (not (string-match "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts))) (user-error "Cannot repeat in Repeat in %d hour(s) because no hour has been set" n)) (if (match-end 1) (progn (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))) (cond ((equal (match-string 1 ts) ".") (org-timestamp-change (- (org-today) (time-to-days time)) 'day)) ((equal (match-string 1 ts) "+") (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) (<= (time-to-days time) (time-to-days (current-time)))) (if (= (setq nshift (1+ nshift)) nshiftmax) (progn (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today.  Continue? " nshift)) (user-error "Abort")))) (org-timestamp-change n (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))))) (org-timestamp-change (- n) (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts))))) (save-excursion (org-timestamp-change n (cdr (assoc what whata)) nil t)) (setq msg (concat msg type " " org-last-changed-timestamp " ")))
  11.   (if (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts) (progn (setq n (string-to-number (match-string 2 ts)) what (match-string 3 ts)) (if (equal what "w") (setq n (* n 7) what "d")) (if (and (equal what "h") (not (string-match "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts))) (user-error "Cannot repeat in Repeat in %d hour(s) because no hour has been set" n)) (if (match-end 1) (progn (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))) (cond ((equal (match-string 1 ts) ".") (org-timestamp-change (- (org-today) (time-to-days time)) 'day)) ((equal (match-string 1 ts) "+") (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) (<= (time-to-days time) (time-to-days (current-time)))) (if (= (setq nshift (1+ nshift)) nshiftmax) (progn (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today.  Continue? " nshift)) (user-error "Abort")))) (org-timestamp-change n (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))))) (org-timestamp-change (- n) (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts))))) (save-excursion (org-timestamp-change n (cdr (assoc what whata)) nil t)) (setq msg (concat msg type " " org-last-changed-timestamp " "))))
  12.   (while (re-search-forward re (save-excursion (outline-next-heading) (point)) t) (setq type (if (match-end 1) org-scheduled-string (if (match-end 3) org-deadline-string "Plain:")) ts (match-string (if (match-end 2) 2 (if (match-end 4) 4 0)))) (if (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts) (progn (setq n (string-to-number (match-string 2 ts)) what (match-string 3 ts)) (if (equal what "w") (setq n (* n 7) what "d")) (if (and (equal what "h") (not (string-match "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts))) (user-error "Cannot repeat in Repeat in %d hour(s) because no hour has been set" n)) (if (match-end 1) (progn (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))) (cond ((equal (match-string 1 ts) ".") (org-timestamp-change (- (org-today) (time-to-days time)) 'day)) ((equal (match-string 1 ts) "+") (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) (<= (time-to-days time) (time-to-days (current-time)))) (if (= (setq nshift (1+ nshift)) nshiftmax) (progn (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today.  Continue? " nshift)) (user-error "Abort")))) (org-timestamp-change n (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))))) (org-timestamp-change (- n) (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts))))) (save-excursion (org-timestamp-change n (cdr (assoc what whata)) nil t)) (setq msg (concat msg type " " org-last-changed-timestamp " ")))))
  13.   (progn (if (eq org-log-repeat t) (setq org-log-repeat 'state)) (setq to-state (or (org-entry-get nil "REPEAT_TO_STATE") org-todo-repeat-to-state)) (if (and to-state (member to-state org-todo-keywords-1)) nil (setq to-state (if (eq interpret 'type) org-last-state head))) (org-todo to-state) (if (or org-log-repeat (org-entry-get nil "CLOCK")) (progn (org-entry-put nil "LAST_REPEAT" (format-time-string (org-time-stamp-format t t))))) (if org-log-repeat (progn (if (or (memq 'org-add-log-note (default-value 'post-command-hook)) (memq 'org-add-log-note post-command-hook)) (if (eq org-log-repeat 'note) (setq org-log-note-how 'note)) (org-add-log-setup 'state (or done-word (car org-done-keywords)) org-last-state 'findpos org-log-repeat)))) (org-back-to-heading t) (org-add-planning-info nil nil 'closed) (setq re (concat "\\(" org-scheduled-time-regexp "\\)\\|\\(" org-deadline-time-regexp "\\)\\|\\(" org-ts-regexp "\\)")) (while (re-search-forward re (save-excursion (outline-next-heading) (point)) t) (setq type (if (match-end 1) org-scheduled-string (if (match-end 3) org-deadline-string "Plain:")) ts (match-string (if (match-end 2) 2 (if (match-end 4) 4 0)))) (if (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts) (progn (setq n (string-to-number (match-string 2 ts)) what (match-string 3 ts)) (if (equal what "w") (setq n (* n 7) what "d")) (if (and (equal what "h") (not (string-match "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts))) (user-error "Cannot repeat in Repeat in %d hour(s) because no hour has been set" n)) (if (match-end 1) (progn (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))) (cond ((equal (match-string 1 ts) ".") (org-timestamp-change (- (org-today) (time-to-days time)) 'day)) ((equal (match-string 1 ts) "+") (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) (<= (time-to-days time) (time-to-days (current-time)))) (if (= (setq nshift (1+ nshift)) nshiftmax) (progn (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today.  Continue? " nshift)) (user-error "Abort")))) (org-timestamp-change n (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))))) (org-timestamp-change (- n) (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts))))) (save-excursion (org-timestamp-change n (cdr (assoc what whata)) nil t)) (setq msg (concat msg type " " org-last-changed-timestamp " "))))) (setq org-log-post-message msg) (message "%s" msg))
  14.   (if (and repeat (not (= 0 (string-to-number (substring repeat 1))))) (progn (if (eq org-log-repeat t) (setq org-log-repeat 'state)) (setq to-state (or (org-entry-get nil "REPEAT_TO_STATE") org-todo-repeat-to-state)) (if (and to-state (member to-state org-todo-keywords-1)) nil (setq to-state (if (eq interpret 'type) org-last-state head))) (org-todo to-state) (if (or org-log-repeat (org-entry-get nil "CLOCK")) (progn (org-entry-put nil "LAST_REPEAT" (format-time-string (org-time-stamp-format t t))))) (if org-log-repeat (progn (if (or (memq 'org-add-log-note (default-value 'post-command-hook)) (memq 'org-add-log-note post-command-hook)) (if (eq org-log-repeat 'note) (setq org-log-note-how 'note)) (org-add-log-setup 'state (or done-word (car org-done-keywords)) org-last-state 'findpos org-log-repeat)))) (org-back-to-heading t) (org-add-planning-info nil nil 'closed) (setq re (concat "\\(" org-scheduled-time-regexp "\\)\\|\\(" org-deadline-time-regexp "\\)\\|\\(" org-ts-regexp "\\)")) (while (re-search-forward re (save-excursion (outline-next-heading) (point)) t) (setq type (if (match-end 1) org-scheduled-string (if (match-end 3) org-deadline-string "Plain:")) ts (match-string (if (match-end 2) 2 (if (match-end 4) 4 0)))) (if (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts) (progn (setq n (string-to-number (match-string 2 ts)) what (match-string 3 ts)) (if (equal what "w") (setq n (* n 7) what "d")) (if (and (equal what "h") (not (string-match "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts))) (user-error "Cannot repeat in Repeat in %d hour(s) because no hour has been set" n)) (if (match-end 1) (progn (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))) (cond ((equal (match-string 1 ts) ".") (org-timestamp-change (- (org-today) (time-to-days time)) 'day)) ((equal (match-string 1 ts) "+") (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) (<= (time-to-days time) (time-to-days (current-time)))) (if (= (setq nshift (1+ nshift)) nshiftmax) (progn (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today.  Continue? " nshift)) (user-error "Abort")))) (org-timestamp-change n (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))))) (org-timestamp-change (- n) (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts))))) (save-excursion (org-timestamp-change n (cdr (assoc what whata)) nil t)) (setq msg (concat msg type " " org-last-changed-timestamp " "))))) (setq org-log-post-message msg) (message "%s" msg)))
  15.   (let* ((repeat (org-get-repeat)) (aa (assoc org-last-state org-todo-kwd-alist)) (interpret (nth 1 aa)) (head (nth 2 aa)) (whata '(("h" . hour) ("d" . day) ("m" . month) ("y" . year))) (msg "Entry repeats: ") (org-log-done nil) (org-todo-log-states nil) re type n what ts time to-state) (if (and repeat (not (= 0 (string-to-number (substring repeat 1))))) (progn (if (eq org-log-repeat t) (setq org-log-repeat 'state)) (setq to-state (or (org-entry-get nil "REPEAT_TO_STATE") org-todo-repeat-to-state)) (if (and to-state (member to-state org-todo-keywords-1)) nil (setq to-state (if (eq interpret 'type) org-last-state head))) (org-todo to-state) (if (or org-log-repeat (org-entry-get nil "CLOCK")) (progn (org-entry-put nil "LAST_REPEAT" (format-time-string (org-time-stamp-format t t))))) (if org-log-repeat (progn (if (or (memq 'org-add-log-note (default-value 'post-command-hook)) (memq 'org-add-log-note post-command-hook)) (if (eq org-log-repeat 'note) (setq org-log-note-how 'note)) (org-add-log-setup 'state (or done-word (car org-done-keywords)) org-last-state 'findpos org-log-repeat)))) (org-back-to-heading t) (org-add-planning-info nil nil 'closed) (setq re (concat "\\(" org-scheduled-time-regexp "\\)\\|\\(" org-deadline-time-regexp "\\)\\|\\(" org-ts-regexp "\\)")) (while (re-search-forward re (save-excursion (outline-next-heading) (point)) t) (setq type (if (match-end 1) org-scheduled-string (if (match-end 3) org-deadline-string "Plain:")) ts (match-string (if (match-end 2) 2 (if (match-end 4) 4 0)))) (if (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts) (progn (setq n (string-to-number (match-string 2 ts)) what (match-string 3 ts)) (if (equal what "w") (setq n (* n 7) what "d")) (if (and (equal what "h") (not (string-match "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts))) (user-error "Cannot repeat in Repeat in %d hour(s) because no hour has been set" n)) (if (match-end 1) (progn (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))) (cond ((equal (match-string 1 ts) ".") (org-timestamp-change (- (org-today) (time-to-days time)) 'day)) ((equal (match-string 1 ts) "+") (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) (<= (time-to-days time) (time-to-days (current-time)))) (if (= (setq nshift (1+ nshift)) nshiftmax) (progn (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today.  Continue? " nshift)) (user-error "Abort")))) (org-timestamp-change n (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (setq time (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-time-string-to-time ts)) (set-match-data save-match-data-internal 'evaporate)))))) (org-timestamp-change (- n) (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts))))) (save-excursion (org-timestamp-change n (cdr (assoc what whata)) nil t)) (setq msg (concat msg type " " org-last-changed-timestamp " "))))) (setq org-log-post-message msg) (message "%s" msg))))
  16.   org-auto-repeat-maybe(#("DONE" 0 4 (face (:foreground "forest green" :weight bold))))
  17.   (progn (if (boundp 'org-agenda-headline-snapshot-before-repeat) (progn (let ((save-match-data-internal (match-data))) (unwind-protect (progn (setq org-agenda-headline-snapshot-before-repeat (org-get-heading))) (set-match-data save-match-data-internal 'evaporate))))) (org-auto-repeat-maybe org-state))
  18.   (if now-done-p (progn (if (boundp 'org-agenda-headline-snapshot-before-repeat) (progn (let ((save-match-data-internal (match-data))) (unwind-protect (progn (setq org-agenda-headline-snapshot-before-repeat (org-get-heading))) (set-match-data save-match-data-internal 'evaporate))))) (org-auto-repeat-maybe org-state)))
  19.   (let* ((match-data (match-data)) (startpos (point-at-bol)) (logging (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-entry-get nil "LOGGING" t t)) (set-match-data save-match-data-internal 'evaporate)))) (org-log-done org-log-done) (org-log-repeat org-log-repeat) (org-todo-log-states org-todo-log-states) (org-inhibit-logging (if (equal arg 0) (progn (setq arg nil) 'note) org-inhibit-logging)) (this (match-string 1)) (hl-pos (match-beginning 0)) (head (org-get-todo-sequence-head this)) (ass (assoc head org-todo-kwd-alist)) (interpret (nth 1 ass)) (done-word (nth 3 ass)) (final-done-word (nth 4 ass)) (org-last-state (or this "")) (completion-ignore-case t) (member (member this org-todo-keywords-1)) (tail (cdr member)) (org-state (cond ((and org-todo-key-trigger (or (and (equal arg '(4)) (eq org-use-fast-todo-selection 'prefix)) (and (not arg) org-use-fast-todo-selection (not (eq org-use-fast-todo-selection 'prefix))))) (org-fast-todo-selection)) ((and (equal arg '(4)) (or (not org-use-fast-todo-selection) (not org-todo-key-trigger))) (org-icompleting-read "State: " (mapcar 'list org-todo-keywords-1) nil t)) ((eq arg 'right) (if this (if tail (car tail) nil) (car org-todo-keywords-1))) ((eq arg 'left) (if (equal member org-todo-keywords-1) nil (if this (nth (- (length org-todo-keywords-1) (length tail) 2) org-todo-keywords-1) (org-last org-todo-keywords-1)))) ((and (eq org-use-fast-todo-selection t) (equal arg '(4)) (setq arg nil))) (arg (cond ((equal arg "") nil) ((eq arg 'none) nil) ((eq arg 'done) (or done-word (car org-done-keywords))) ((eq arg 'nextset) (or (car (cdr (member head org-todo-heads))) (car org-todo-heads))) ((eq arg 'previousset) (let ((org-todo-heads (reverse org-todo-heads))) (or (car (cdr (member head org-todo-heads))) (car org-todo-heads)))) ((car (member arg org-todo-keywords-1))) ((stringp arg) (user-error "State `%s' not valid in this file" arg)) ((nth (1- (prefix-numeric-value arg)) org-todo-keywords-1)))) ((null member) (or head (car org-todo-keywords-1))) ((equal this final-done-word) nil) ((null tail) nil) ((memq interpret '(type priority)) (if (eq this-command last-command) (car tail) (if (> (length tail) 0) (or done-word (car org-done-keywords)) nil))) (t (car tail)))) (org-state (or (run-hook-with-args-until-success 'org-todo-get-default-hook org-state org-last-state) org-state)) (next (if org-state (concat " " org-state " ") " ")) (change-plist (list :type 'todo-state-change :from this :to org-state :position startpos)) dolog now-done-p) (if org-blocker-hook (progn (setq org-last-todo-state-is-todo (not (member this org-done-keywords))) (if (save-excursion (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-excursion (save-restriction (widen) (run-hook-with-args-until-failure 'org-blocker-hook change-plist)))) (set-match-data save-match-data-internal 'evaporate)))) nil (if (with-no-warnings (called-interactively-p 'interactive)) (user-error "TODO state change from %s to %s blocked (by \"%s\")" this org-state org-block-entry-blocking) (message "TODO state change from %s to %s blocked (by \"%s\")" this org-state org-block-entry-blocking) (throw 'exit nil))))) (store-match-data match-data) (replace-match next t t) (cond ((equal this org-state) (message "TODO state was already %s" (org-trim next))) ((pos-visible-in-window-p hl-pos) (message "TODO state changed to %s" (org-trim next)))) (if head nil (setq head (org-get-todo-sequence-head org-state) ass (assoc head org-todo-kwd-alist) interpret (nth 1 ass) done-word (nth 3 ass) final-done-word (nth 4 ass))) (if (memq arg '(nextset previousset)) (progn (message "Keyword-Set %d/%d: %s" (- (length org-todo-sets) -1 (length (memq (assoc org-state org-todo-sets) org-todo-sets))) (length org-todo-sets) (mapconcat 'identity (assoc org-state org-todo-sets) " ")))) (setq org-last-todo-state-is-todo (not (member org-state org-done-keywords))) (setq now-done-p (and (member org-state org-done-keywords) (not (member this org-done-keywords)))) (and logging (org-local-logging logging)) (if (and (or org-todo-log-states org-log-done) (not (eq org-inhibit-logging t)) (not (memq arg '(nextset previousset)))) (progn (setq dolog (or (nth 1 (assoc org-state org-todo-log-states)) (nth 2 (assoc this org-todo-log-states)))) (if (and (eq dolog 'note) (eq org-inhibit-logging 'note)) (setq dolog 'time)) (if (or (and (not org-state) (not org-closed-keep-when-no-todo)) (and org-state (member org-state org-not-done-keywords) (not (member this org-not-done-keywords)))) (progn (org-add-planning-info nil nil 'closed))) (if (and now-done-p org-log-done) (progn (org-add-planning-info 'closed (org-current-effective-time)) (if (and (not dolog) (eq 'note org-log-done)) (org-add-log-setup 'done org-state this 'findpos 'note)))) (if (and org-state dolog) (progn (org-add-log-setup 'state org-state this 'findpos dolog))))) (org-todo-trigger-tag-changes org-state) (and org-auto-align-tags (not org-setting-tags) (org-set-tags nil t)) (if org-provide-todo-statistics (progn (org-update-parent-todo-statistics))) (run-hooks 'org-after-todo-state-change-hook) (if (and arg (not (member org-state org-done-keywords))) (setq head (org-get-todo-sequence-head org-state))) (put-text-property (point-at-bol) (point-at-eol) 'org-todo-head head) (if now-done-p (progn (if (boundp 'org-agenda-headline-snapshot-before-repeat) (progn (let ((save-match-data-internal (match-data))) (unwind-protect (progn (setq org-agenda-headline-snapshot-before-repeat (org-get-heading))) (set-match-data save-match-data-internal 'evaporate))))) (org-auto-repeat-maybe org-state))) (if (and (outline-on-heading-p) (not (bolp)) (save-excursion (beginning-of-line 1) (looking-at org-todo-line-regexp)) (< (point) (+ 2 (or (match-end 2) (match-end 1))))) (progn (goto-char (or (match-end 2) (match-end 1))) (and (looking-at " ") (just-one-space)))) (if org-trigger-hook (progn (save-excursion (run-hook-with-args 'org-trigger-hook change-plist)))) (if commentp (progn (org-toggle-comment))))
  20.   (catch 'exit (org-back-to-heading t) (if (org-in-commented-heading-p t) (progn (org-toggle-comment) (setq commentp t))) (if (looking-at org-outline-regexp) (goto-char (1- (match-end 0)))) (or (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \011]*$\\)")) (looking-at "\\(?: *\\|[ \011]*$\\)")) (let* ((match-data (match-data)) (startpos (point-at-bol)) (logging (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-entry-get nil "LOGGING" t t)) (set-match-data save-match-data-internal 'evaporate)))) (org-log-done org-log-done) (org-log-repeat org-log-repeat) (org-todo-log-states org-todo-log-states) (org-inhibit-logging (if (equal arg 0) (progn (setq arg nil) 'note) org-inhibit-logging)) (this (match-string 1)) (hl-pos (match-beginning 0)) (head (org-get-todo-sequence-head this)) (ass (assoc head org-todo-kwd-alist)) (interpret (nth 1 ass)) (done-word (nth 3 ass)) (final-done-word (nth 4 ass)) (org-last-state (or this "")) (completion-ignore-case t) (member (member this org-todo-keywords-1)) (tail (cdr member)) (org-state (cond ((and org-todo-key-trigger (or (and (equal arg '(4)) (eq org-use-fast-todo-selection 'prefix)) (and (not arg) org-use-fast-todo-selection (not (eq org-use-fast-todo-selection 'prefix))))) (org-fast-todo-selection)) ((and (equal arg '(4)) (or (not org-use-fast-todo-selection) (not org-todo-key-trigger))) (org-icompleting-read "State: " (mapcar 'list org-todo-keywords-1) nil t)) ((eq arg 'right) (if this (if tail (car tail) nil) (car org-todo-keywords-1))) ((eq arg 'left) (if (equal member org-todo-keywords-1) nil (if this (nth (- (length org-todo-keywords-1) (length tail) 2) org-todo-keywords-1) (org-last org-todo-keywords-1)))) ((and (eq org-use-fast-todo-selection t) (equal arg '(4)) (setq arg nil))) (arg (cond ((equal arg "") nil) ((eq arg 'none) nil) ((eq arg 'done) (or done-word (car org-done-keywords))) ((eq arg 'nextset) (or (car (cdr (member head org-todo-heads))) (car org-todo-heads))) ((eq arg 'previousset) (let ((org-todo-heads (reverse org-todo-heads))) (or (car (cdr (member head org-todo-heads))) (car org-todo-heads)))) ((car (member arg org-todo-keywords-1))) ((stringp arg) (user-error "State `%s' not valid in this file" arg)) ((nth (1- (prefix-numeric-value arg)) org-todo-keywords-1)))) ((null member) (or head (car org-todo-keywords-1))) ((equal this final-done-word) nil) ((null tail) nil) ((memq interpret '(type priority)) (if (eq this-command last-command) (car tail) (if (> (length tail) 0) (or done-word (car org-done-keywords)) nil))) (t (car tail)))) (org-state (or (run-hook-with-args-until-success 'org-todo-get-default-hook org-state org-last-state) org-state)) (next (if org-state (concat " " org-state " ") " ")) (change-plist (list :type 'todo-state-change :from this :to org-state :position startpos)) dolog now-done-p) (if org-blocker-hook (progn (setq org-last-todo-state-is-todo (not (member this org-done-keywords))) (if (save-excursion (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-excursion (save-restriction (widen) (run-hook-with-args-until-failure 'org-blocker-hook change-plist)))) (set-match-data save-match-data-internal 'evaporate)))) nil (if (with-no-warnings (called-interactively-p 'interactive)) (user-error "TODO state change from %s to %s blocked (by \"%s\")" this org-state org-block-entry-blocking) (message "TODO state change from %s to %s blocked (by \"%s\")" this org-state org-block-entry-blocking) (throw 'exit nil))))) (store-match-data match-data) (replace-match next t t) (cond ((equal this org-state) (message "TODO state was already %s" (org-trim next))) ((pos-visible-in-window-p hl-pos) (message "TODO state changed to %s" (org-trim next)))) (if head nil (setq head (org-get-todo-sequence-head org-state) ass (assoc head org-todo-kwd-alist) interpret (nth 1 ass) done-word (nth 3 ass) final-done-word (nth 4 ass))) (if (memq arg '(nextset previousset)) (progn (message "Keyword-Set %d/%d: %s" (- (length org-todo-sets) -1 (length (memq (assoc org-state org-todo-sets) org-todo-sets))) (length org-todo-sets) (mapconcat 'identity (assoc org-state org-todo-sets) " ")))) (setq org-last-todo-state-is-todo (not (member org-state org-done-keywords))) (setq now-done-p (and (member org-state org-done-keywords) (not (member this org-done-keywords)))) (and logging (org-local-logging logging)) (if (and (or org-todo-log-states org-log-done) (not (eq org-inhibit-logging t)) (not (memq arg '(nextset previousset)))) (progn (setq dolog (or (nth 1 (assoc org-state org-todo-log-states)) (nth 2 (assoc this org-todo-log-states)))) (if (and (eq dolog 'note) (eq org-inhibit-logging 'note)) (setq dolog 'time)) (if (or (and (not org-state) (not org-closed-keep-when-no-todo)) (and org-state (member org-state org-not-done-keywords) (not (member this org-not-done-keywords)))) (progn (org-add-planning-info nil nil 'closed))) (if (and now-done-p org-log-done) (progn (org-add-planning-info 'closed (org-current-effective-time)) (if (and (not dolog) (eq 'note org-log-done)) (org-add-log-setup 'done org-state this 'findpos 'note)))) (if (and org-state dolog) (progn (org-add-log-setup 'state org-state this 'findpos dolog))))) (org-todo-trigger-tag-changes org-state) (and org-auto-align-tags (not org-setting-tags) (org-set-tags nil t)) (if org-provide-todo-statistics (progn (org-update-parent-todo-statistics))) (run-hooks 'org-after-todo-state-change-hook) (if (and arg (not (member org-state org-done-keywords))) (setq head (org-get-todo-sequence-head org-state))) (put-text-property (point-at-bol) (point-at-eol) 'org-todo-head head) (if now-done-p (progn (if (boundp 'org-agenda-headline-snapshot-before-repeat) (progn (let ((save-match-data-internal (match-data))) (unwind-protect (progn (setq org-agenda-headline-snapshot-before-repeat (org-get-heading))) (set-match-data save-match-data-internal 'evaporate))))) (org-auto-repeat-maybe org-state))) (if (and (outline-on-heading-p) (not (bolp)) (save-excursion (beginning-of-line 1) (looking-at org-todo-line-regexp)) (< (point) (+ 2 (or (match-end 2) (match-end 1))))) (progn (goto-char (or (match-end 2) (match-end 1))) (and (looking-at " ") (just-one-space)))) (if org-trigger-hook (progn (save-excursion (run-hook-with-args 'org-trigger-hook change-plist)))) (if commentp (progn (org-toggle-comment)))))
  21.   (save-excursion (catch 'exit (org-back-to-heading t) (if (org-in-commented-heading-p t) (progn (org-toggle-comment) (setq commentp t))) (if (looking-at org-outline-regexp) (goto-char (1- (match-end 0)))) (or (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \011]*$\\)")) (looking-at "\\(?: *\\|[ \011]*$\\)")) (let* ((match-data (match-data)) (startpos (point-at-bol)) (logging (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-entry-get nil "LOGGING" t t)) (set-match-data save-match-data-internal 'evaporate)))) (org-log-done org-log-done) (org-log-repeat org-log-repeat) (org-todo-log-states org-todo-log-states) (org-inhibit-logging (if (equal arg 0) (progn (setq arg nil) 'note) org-inhibit-logging)) (this (match-string 1)) (hl-pos (match-beginning 0)) (head (org-get-todo-sequence-head this)) (ass (assoc head org-todo-kwd-alist)) (interpret (nth 1 ass)) (done-word (nth 3 ass)) (final-done-word (nth 4 ass)) (org-last-state (or this "")) (completion-ignore-case t) (member (member this org-todo-keywords-1)) (tail (cdr member)) (org-state (cond ((and org-todo-key-trigger (or (and (equal arg '(4)) (eq org-use-fast-todo-selection 'prefix)) (and (not arg) org-use-fast-todo-selection (not (eq org-use-fast-todo-selection 'prefix))))) (org-fast-todo-selection)) ((and (equal arg '(4)) (or (not org-use-fast-todo-selection) (not org-todo-key-trigger))) (org-icompleting-read "State: " (mapcar 'list org-todo-keywords-1) nil t)) ((eq arg 'right) (if this (if tail (car tail) nil) (car org-todo-keywords-1))) ((eq arg 'left) (if (equal member org-todo-keywords-1) nil (if this (nth (- (length org-todo-keywords-1) (length tail) 2) org-todo-keywords-1) (org-last org-todo-keywords-1)))) ((and (eq org-use-fast-todo-selection t) (equal arg '(4)) (setq arg nil))) (arg (cond ((equal arg "") nil) ((eq arg 'none) nil) ((eq arg 'done) (or done-word (car org-done-keywords))) ((eq arg 'nextset) (or (car (cdr (member head org-todo-heads))) (car org-todo-heads))) ((eq arg 'previousset) (let ((org-todo-heads (reverse org-todo-heads))) (or (car (cdr (member head org-todo-heads))) (car org-todo-heads)))) ((car (member arg org-todo-keywords-1))) ((stringp arg) (user-error "State `%s' not valid in this file" arg)) ((nth (1- (prefix-numeric-value arg)) org-todo-keywords-1)))) ((null member) (or head (car org-todo-keywords-1))) ((equal this final-done-word) nil) ((null tail) nil) ((memq interpret '(type priority)) (if (eq this-command last-command) (car tail) (if (> (length tail) 0) (or done-word (car org-done-keywords)) nil))) (t (car tail)))) (org-state (or (run-hook-with-args-until-success 'org-todo-get-default-hook org-state org-last-state) org-state)) (next (if org-state (concat " " org-state " ") " ")) (change-plist (list :type 'todo-state-change :from this :to org-state :position startpos)) dolog now-done-p) (if org-blocker-hook (progn (setq org-last-todo-state-is-todo (not (member this org-done-keywords))) (if (save-excursion (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-excursion (save-restriction (widen) (run-hook-with-args-until-failure 'org-blocker-hook change-plist)))) (set-match-data save-match-data-internal 'evaporate)))) nil (if (with-no-warnings (called-interactively-p 'interactive)) (user-error "TODO state change from %s to %s blocked (by \"%s\")" this org-state org-block-entry-blocking) (message "TODO state change from %s to %s blocked (by \"%s\")" this org-state org-block-entry-blocking) (throw 'exit nil))))) (store-match-data match-data) (replace-match next t t) (cond ((equal this org-state) (message "TODO state was already %s" (org-trim next))) ((pos-visible-in-window-p hl-pos) (message "TODO state changed to %s" (org-trim next)))) (if head nil (setq head (org-get-todo-sequence-head org-state) ass (assoc head org-todo-kwd-alist) interpret (nth 1 ass) done-word (nth 3 ass) final-done-word (nth 4 ass))) (if (memq arg '(nextset previousset)) (progn (message "Keyword-Set %d/%d: %s" (- (length org-todo-sets) -1 (length (memq (assoc org-state org-todo-sets) org-todo-sets))) (length org-todo-sets) (mapconcat 'identity (assoc org-state org-todo-sets) " ")))) (setq org-last-todo-state-is-todo (not (member org-state org-done-keywords))) (setq now-done-p (and (member org-state org-done-keywords) (not (member this org-done-keywords)))) (and logging (org-local-logging logging)) (if (and (or org-todo-log-states org-log-done) (not (eq org-inhibit-logging t)) (not (memq arg '(nextset previousset)))) (progn (setq dolog (or (nth 1 (assoc org-state org-todo-log-states)) (nth 2 (assoc this org-todo-log-states)))) (if (and (eq dolog 'note) (eq org-inhibit-logging 'note)) (setq dolog 'time)) (if (or (and (not org-state) (not org-closed-keep-when-no-todo)) (and org-state (member org-state org-not-done-keywords) (not (member this org-not-done-keywords)))) (progn (org-add-planning-info nil nil 'closed))) (if (and now-done-p org-log-done) (progn (org-add-planning-info 'closed (org-current-effective-time)) (if (and (not dolog) (eq 'note org-log-done)) (org-add-log-setup 'done org-state this 'findpos 'note)))) (if (and org-state dolog) (progn (org-add-log-setup 'state org-state this 'findpos dolog))))) (org-todo-trigger-tag-changes org-state) (and org-auto-align-tags (not org-setting-tags) (org-set-tags nil t)) (if org-provide-todo-statistics (progn (org-update-parent-todo-statistics))) (run-hooks 'org-after-todo-state-change-hook) (if (and arg (not (member org-state org-done-keywords))) (setq head (org-get-todo-sequence-head org-state))) (put-text-property (point-at-bol) (point-at-eol) 'org-todo-head head) (if now-done-p (progn (if (boundp 'org-agenda-headline-snapshot-before-repeat) (progn (let ((save-match-data-internal (match-data))) (unwind-protect (progn (setq org-agenda-headline-snapshot-before-repeat (org-get-heading))) (set-match-data save-match-data-internal 'evaporate))))) (org-auto-repeat-maybe org-state))) (if (and (outline-on-heading-p) (not (bolp)) (save-excursion (beginning-of-line 1) (looking-at org-todo-line-regexp)) (< (point) (+ 2 (or (match-end 2) (match-end 1))))) (progn (goto-char (or (match-end 2) (match-end 1))) (and (looking-at " ") (just-one-space)))) (if org-trigger-hook (progn (save-excursion (run-hook-with-args 'org-trigger-hook change-plist)))) (if commentp (progn (org-toggle-comment))))))
  22.   (let ((org-blocker-hook org-blocker-hook) commentp case-fold-search) (if (equal arg '(64)) (progn (setq arg nil org-blocker-hook nil))) (if (and org-blocker-hook (or org-inhibit-blocking (org-entry-get nil "NOBLOCKING"))) (progn (setq org-blocker-hook nil))) (save-excursion (catch 'exit (org-back-to-heading t) (if (org-in-commented-heading-p t) (progn (org-toggle-comment) (setq commentp t))) (if (looking-at org-outline-regexp) (goto-char (1- (match-end 0)))) (or (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \011]*$\\)")) (looking-at "\\(?: *\\|[ \011]*$\\)")) (let* ((match-data (match-data)) (startpos (point-at-bol)) (logging (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-entry-get nil "LOGGING" t t)) (set-match-data save-match-data-internal 'evaporate)))) (org-log-done org-log-done) (org-log-repeat org-log-repeat) (org-todo-log-states org-todo-log-states) (org-inhibit-logging (if (equal arg 0) (progn (setq arg nil) 'note) org-inhibit-logging)) (this (match-string 1)) (hl-pos (match-beginning 0)) (head (org-get-todo-sequence-head this)) (ass (assoc head org-todo-kwd-alist)) (interpret (nth 1 ass)) (done-word (nth 3 ass)) (final-done-word (nth 4 ass)) (org-last-state (or this "")) (completion-ignore-case t) (member (member this org-todo-keywords-1)) (tail (cdr member)) (org-state (cond ((and org-todo-key-trigger (or (and (equal arg '(4)) (eq org-use-fast-todo-selection 'prefix)) (and (not arg) org-use-fast-todo-selection (not (eq org-use-fast-todo-selection 'prefix))))) (org-fast-todo-selection)) ((and (equal arg '(4)) (or (not org-use-fast-todo-selection) (not org-todo-key-trigger))) (org-icompleting-read "State: " (mapcar 'list org-todo-keywords-1) nil t)) ((eq arg 'right) (if this (if tail (car tail) nil) (car org-todo-keywords-1))) ((eq arg 'left) (if (equal member org-todo-keywords-1) nil (if this (nth (- (length org-todo-keywords-1) (length tail) 2) org-todo-keywords-1) (org-last org-todo-keywords-1)))) ((and (eq org-use-fast-todo-selection t) (equal arg '(4)) (setq arg nil))) (arg (cond ((equal arg "") nil) ((eq arg 'none) nil) ((eq arg 'done) (or done-word (car org-done-keywords))) ((eq arg 'nextset) (or (car (cdr (member head org-todo-heads))) (car org-todo-heads))) ((eq arg 'previousset) (let ((org-todo-heads (reverse org-todo-heads))) (or (car (cdr (member head org-todo-heads))) (car org-todo-heads)))) ((car (member arg org-todo-keywords-1))) ((stringp arg) (user-error "State `%s' not valid in this file" arg)) ((nth (1- (prefix-numeric-value arg)) org-todo-keywords-1)))) ((null member) (or head (car org-todo-keywords-1))) ((equal this final-done-word) nil) ((null tail) nil) ((memq interpret '(type priority)) (if (eq this-command last-command) (car tail) (if (> (length tail) 0) (or done-word (car org-done-keywords)) nil))) (t (car tail)))) (org-state (or (run-hook-with-args-until-success 'org-todo-get-default-hook org-state org-last-state) org-state)) (next (if org-state (concat " " org-state " ") " ")) (change-plist (list :type 'todo-state-change :from this :to org-state :position startpos)) dolog now-done-p) (if org-blocker-hook (progn (setq org-last-todo-state-is-todo (not (member this org-done-keywords))) (if (save-excursion (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-excursion (save-restriction (widen) (run-hook-with-args-until-failure 'org-blocker-hook change-plist)))) (set-match-data save-match-data-internal 'evaporate)))) nil (if (with-no-warnings (called-interactively-p 'interactive)) (user-error "TODO state change from %s to %s blocked (by \"%s\")" this org-state org-block-entry-blocking) (message "TODO state change from %s to %s blocked (by \"%s\")" this org-state org-block-entry-blocking) (throw 'exit nil))))) (store-match-data match-data) (replace-match next t t) (cond ((equal this org-state) (message "TODO state was already %s" (org-trim next))) ((pos-visible-in-window-p hl-pos) (message "TODO state changed to %s" (org-trim next)))) (if head nil (setq head (org-get-todo-sequence-head org-state) ass (assoc head org-todo-kwd-alist) interpret (nth 1 ass) done-word (nth 3 ass) final-done-word (nth 4 ass))) (if (memq arg '(nextset previousset)) (progn (message "Keyword-Set %d/%d: %s" (- (length org-todo-sets) -1 (length (memq (assoc org-state org-todo-sets) org-todo-sets))) (length org-todo-sets) (mapconcat 'identity (assoc org-state org-todo-sets) " ")))) (setq org-last-todo-state-is-todo (not (member org-state org-done-keywords))) (setq now-done-p (and (member org-state org-done-keywords) (not (member this org-done-keywords)))) (and logging (org-local-logging logging)) (if (and (or org-todo-log-states org-log-done) (not (eq org-inhibit-logging t)) (not (memq arg '(nextset previousset)))) (progn (setq dolog (or (nth 1 (assoc org-state org-todo-log-states)) (nth 2 (assoc this org-todo-log-states)))) (if (and (eq dolog 'note) (eq org-inhibit-logging 'note)) (setq dolog 'time)) (if (or (and (not org-state) (not org-closed-keep-when-no-todo)) (and org-state (member org-state org-not-done-keywords) (not (member this org-not-done-keywords)))) (progn (org-add-planning-info nil nil 'closed))) (if (and now-done-p org-log-done) (progn (org-add-planning-info 'closed (org-current-effective-time)) (if (and (not dolog) (eq 'note org-log-done)) (org-add-log-setup 'done org-state this 'findpos 'note)))) (if (and org-state dolog) (progn (org-add-log-setup 'state org-state this 'findpos dolog))))) (org-todo-trigger-tag-changes org-state) (and org-auto-align-tags (not org-setting-tags) (org-set-tags nil t)) (if org-provide-todo-statistics (progn (org-update-parent-todo-statistics))) (run-hooks 'org-after-todo-state-change-hook) (if (and arg (not (member org-state org-done-keywords))) (setq head (org-get-todo-sequence-head org-state))) (put-text-property (point-at-bol) (point-at-eol) 'org-todo-head head) (if now-done-p (progn (if (boundp 'org-agenda-headline-snapshot-before-repeat) (progn (let ((save-match-data-internal (match-data))) (unwind-protect (progn (setq org-agenda-headline-snapshot-before-repeat (org-get-heading))) (set-match-data save-match-data-internal 'evaporate))))) (org-auto-repeat-maybe org-state))) (if (and (outline-on-heading-p) (not (bolp)) (save-excursion (beginning-of-line 1) (looking-at org-todo-line-regexp)) (< (point) (+ 2 (or (match-end 2) (match-end 1))))) (progn (goto-char (or (match-end 2) (match-end 1))) (and (looking-at " ") (just-one-space)))) (if org-trigger-hook (progn (save-excursion (run-hook-with-args 'org-trigger-hook change-plist)))) (if commentp (progn (org-toggle-comment)))))))
  23.   (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level) 'region-start-level 'region)) org-loop-over-headlines-in-active-region) (org-map-entries (list 'org-todo arg) org-loop-over-headlines-in-active-region cl (if (outline-invisible-p) (org-end-of-subtree nil t)))) (if (equal arg '(16)) (setq arg 'nextset)) (if (equal arg -1) (progn (org-cancel-repeater) (setq arg nil))) (let ((org-blocker-hook org-blocker-hook) commentp case-fold-search) (if (equal arg '(64)) (progn (setq arg nil org-blocker-hook nil))) (if (and org-blocker-hook (or org-inhibit-blocking (org-entry-get nil "NOBLOCKING"))) (progn (setq org-blocker-hook nil))) (save-excursion (catch 'exit (org-back-to-heading t) (if (org-in-commented-heading-p t) (progn (org-toggle-comment) (setq commentp t))) (if (looking-at org-outline-regexp) (goto-char (1- (match-end 0)))) (or (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \011]*$\\)")) (looking-at "\\(?: *\\|[ \011]*$\\)")) (let* ((match-data (match-data)) (startpos (point-at-bol)) (logging (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-entry-get nil "LOGGING" t t)) (set-match-data save-match-data-internal 'evaporate)))) (org-log-done org-log-done) (org-log-repeat org-log-repeat) (org-todo-log-states org-todo-log-states) (org-inhibit-logging (if (equal arg 0) (progn (setq arg nil) 'note) org-inhibit-logging)) (this (match-string 1)) (hl-pos (match-beginning 0)) (head (org-get-todo-sequence-head this)) (ass (assoc head org-todo-kwd-alist)) (interpret (nth 1 ass)) (done-word (nth 3 ass)) (final-done-word (nth 4 ass)) (org-last-state (or this "")) (completion-ignore-case t) (member (member this org-todo-keywords-1)) (tail (cdr member)) (org-state (cond ((and org-todo-key-trigger (or (and (equal arg '(4)) (eq org-use-fast-todo-selection 'prefix)) (and (not arg) org-use-fast-todo-selection (not (eq org-use-fast-todo-selection 'prefix))))) (org-fast-todo-selection)) ((and (equal arg '(4)) (or (not org-use-fast-todo-selection) (not org-todo-key-trigger))) (org-icompleting-read "State: " (mapcar 'list org-todo-keywords-1) nil t)) ((eq arg 'right) (if this (if tail (car tail) nil) (car org-todo-keywords-1))) ((eq arg 'left) (if (equal member org-todo-keywords-1) nil (if this (nth (- (length org-todo-keywords-1) (length tail) 2) org-todo-keywords-1) (org-last org-todo-keywords-1)))) ((and (eq org-use-fast-todo-selection t) (equal arg '(4)) (setq arg nil))) (arg (cond ((equal arg "") nil) ((eq arg 'none) nil) ((eq arg 'done) (or done-word (car org-done-keywords))) ((eq arg 'nextset) (or (car (cdr (member head org-todo-heads))) (car org-todo-heads))) ((eq arg 'previousset) (let ((org-todo-heads (reverse org-todo-heads))) (or (car (cdr (member head org-todo-heads))) (car org-todo-heads)))) ((car (member arg org-todo-keywords-1))) ((stringp arg) (user-error "State `%s' not valid in this file" arg)) ((nth (1- (prefix-numeric-value arg)) org-todo-keywords-1)))) ((null member) (or head (car org-todo-keywords-1))) ((equal this final-done-word) nil) ((null tail) nil) ((memq interpret '(type priority)) (if (eq this-command last-command) (car tail) (if (> (length tail) 0) (or done-word (car org-done-keywords)) nil))) (t (car tail)))) (org-state (or (run-hook-with-args-until-success 'org-todo-get-default-hook org-state org-last-state) org-state)) (next (if org-state (concat " " org-state " ") " ")) (change-plist (list :type 'todo-state-change :from this :to org-state :position startpos)) dolog now-done-p) (if org-blocker-hook (progn (setq org-last-todo-state-is-todo (not (member this org-done-keywords))) (if (save-excursion (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-excursion (save-restriction (widen) (run-hook-with-args-until-failure 'org-blocker-hook change-plist)))) (set-match-data save-match-data-internal 'evaporate)))) nil (if (with-no-warnings (called-interactively-p 'interactive)) (user-error "TODO state change from %s to %s blocked (by \"%s\")" this org-state org-block-entry-blocking) (message "TODO state change from %s to %s blocked (by \"%s\")" this org-state org-block-entry-blocking) (throw 'exit nil))))) (store-match-data match-data) (replace-match next t t) (cond ((equal this org-state) (message "TODO state was already %s" (org-trim next))) ((pos-visible-in-window-p hl-pos) (message "TODO state changed to %s" (org-trim next)))) (if head nil (setq head (org-get-todo-sequence-head org-state) ass (assoc head org-todo-kwd-alist) interpret (nth 1 ass) done-word (nth 3 ass) final-done-word (nth 4 ass))) (if (memq arg '(nextset previousset)) (progn (message "Keyword-Set %d/%d: %s" (- (length org-todo-sets) -1 (length (memq (assoc org-state org-todo-sets) org-todo-sets))) (length org-todo-sets) (mapconcat 'identity (assoc org-state org-todo-sets) " ")))) (setq org-last-todo-state-is-todo (not (member org-state org-done-keywords))) (setq now-done-p (and (member org-state org-done-keywords) (not (member this org-done-keywords)))) (and logging (org-local-logging logging)) (if (and (or org-todo-log-states org-log-done) (not (eq org-inhibit-logging t)) (not (memq arg '(nextset previousset)))) (progn (setq dolog (or (nth 1 (assoc org-state org-todo-log-states)) (nth 2 (assoc this org-todo-log-states)))) (if (and (eq dolog 'note) (eq org-inhibit-logging 'note)) (setq dolog 'time)) (if (or (and (not org-state) (not org-closed-keep-when-no-todo)) (and org-state (member org-state org-not-done-keywords) (not (member this org-not-done-keywords)))) (progn (org-add-planning-info nil nil 'closed))) (if (and now-done-p org-log-done) (progn (org-add-planning-info 'closed (org-current-effective-time)) (if (and (not dolog) (eq 'note org-log-done)) (org-add-log-setup 'done org-state this 'findpos 'note)))) (if (and org-state dolog) (progn (org-add-log-setup 'state org-state this 'findpos dolog))))) (org-todo-trigger-tag-changes org-state) (and org-auto-align-tags (not org-setting-tags) (org-set-tags nil t)) (if org-provide-todo-statistics (progn (org-update-parent-todo-statistics))) (run-hooks 'org-after-todo-state-change-hook) (if (and arg (not (member org-state org-done-keywords))) (setq head (org-get-todo-sequence-head org-state))) (put-text-property (point-at-bol) (point-at-eol) 'org-todo-head head) (if now-done-p (progn (if (boundp 'org-agenda-headline-snapshot-before-repeat) (progn (let ((save-match-data-internal (match-data))) (unwind-protect (progn (setq org-agenda-headline-snapshot-before-repeat (org-get-heading))) (set-match-data save-match-data-internal 'evaporate))))) (org-auto-repeat-maybe org-state))) (if (and (outline-on-heading-p) (not (bolp)) (save-excursion (beginning-of-line 1) (looking-at org-todo-line-regexp)) (< (point) (+ 2 (or (match-end 2) (match-end 1))))) (progn (goto-char (or (match-end 2) (match-end 1))) (and (looking-at " ") (just-one-space)))) (if org-trigger-hook (progn (save-excursion (run-hook-with-args 'org-trigger-hook change-plist)))) (if commentp (progn (org-toggle-comment))))))))
  24.   org-todo(nil)
  25.   funcall-interactively(org-todo nil)
  26.   call-interactively(org-todo)
  27.   (let ((current-prefix-arg arg)) (call-interactively 'org-todo))
  28.   (save-current-buffer (set-buffer buffer) (widen) (goto-char pos) (org-show-context 'agenda) (save-excursion (and (outline-next-heading) (org-flag-heading nil))) (let ((current-prefix-arg arg)) (call-interactively 'org-todo)) (and (bolp) (forward-char 1)) (setq newhead (org-get-heading)) (if (and (and (boundp 'org-agenda-headline-snapshot-before-repeat) org-agenda-headline-snapshot-before-repeat) (not (equal org-agenda-headline-snapshot-before-repeat newhead)) todayp) (progn (setq newhead org-agenda-headline-snapshot-before-repeat just-one t))) (save-excursion (org-back-to-heading) (move-marker org-last-heading-marker (point))))
  29.   (let ((--cline (org-current-line)) (--cmd this-command) (--buf1 (current-buffer)) (--buf2 buffer) (--undo1 buffer-undo-list) (--undo2 (save-current-buffer (set-buffer buffer) buffer-undo-list)) --c1 --c2) (save-current-buffer (set-buffer buffer) (widen) (goto-char pos) (org-show-context 'agenda) (save-excursion (and (outline-next-heading) (org-flag-heading nil))) (let ((current-prefix-arg arg)) (call-interactively 'org-todo)) (and (bolp) (forward-char 1)) (setq newhead (org-get-heading)) (if (and (and (boundp 'org-agenda-headline-snapshot-before-repeat) org-agenda-headline-snapshot-before-repeat) (not (equal org-agenda-headline-snapshot-before-repeat newhead)) todayp) (progn (setq newhead org-agenda-headline-snapshot-before-repeat just-one t))) (save-excursion (org-back-to-heading) (move-marker org-last-heading-marker (point)))) (beginning-of-line 1) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (org-agenda-change-all-lines newhead hdmarker 'fixface just-one)) (set-window-configuration wconfig))) (if (and (boundp 'org-clock-out-when-done) org-clock-out-when-done) (progn (string-match (concat "^" (regexp-opt org-done-keywords-for-agenda)) newhead) (org-agenda-unmark-clocking-task))) (org-move-to-column col) (org-agenda-mark-clocking-task) (if org-agenda-allow-remote-undo (progn (setq --c1 (org-verify-change-for-undo --undo1 (save-current-buffer (set-buffer --buf1) buffer-undo-list)) --c2 (org-verify-change-for-undo --undo2 (save-current-buffer (set-buffer --buf2) buffer-undo-list))) (if (or --c1 --c2) (progn (and --c1 (save-current-buffer (set-buffer --buf1) (undo-boundary))) (and --c2 (save-current-buffer (set-buffer --buf2) (undo-boundary))) (setq org-agenda-undo-list (cons (list --cmd --cline --buf1 --c1 --buf2 --c2) org-agenda-undo-list)))))))
  30.   (let* ((col (current-column)) (marker (or (org-get-at-bol 'org-marker) (org-agenda-error))) (buffer (marker-buffer marker)) (pos (marker-position marker)) (hdmarker (org-get-at-bol 'org-hd-marker)) (todayp (org-agenda-todayp (org-get-at-bol 'day))) (inhibit-read-only t) org-agenda-headline-snapshot-before-repeat newhead just-one) (let ((--cline (org-current-line)) (--cmd this-command) (--buf1 (current-buffer)) (--buf2 buffer) (--undo1 buffer-undo-list) (--undo2 (save-current-buffer (set-buffer buffer) buffer-undo-list)) --c1 --c2) (save-current-buffer (set-buffer buffer) (widen) (goto-char pos) (org-show-context 'agenda) (save-excursion (and (outline-next-heading) (org-flag-heading nil))) (let ((current-prefix-arg arg)) (call-interactively 'org-todo)) (and (bolp) (forward-char 1)) (setq newhead (org-get-heading)) (if (and (and (boundp 'org-agenda-headline-snapshot-before-repeat) org-agenda-headline-snapshot-before-repeat) (not (equal org-agenda-headline-snapshot-before-repeat newhead)) todayp) (progn (setq newhead org-agenda-headline-snapshot-before-repeat just-one t))) (save-excursion (org-back-to-heading) (move-marker org-last-heading-marker (point)))) (beginning-of-line 1) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (org-agenda-change-all-lines newhead hdmarker 'fixface just-one)) (set-window-configuration wconfig))) (if (and (boundp 'org-clock-out-when-done) org-clock-out-when-done) (progn (string-match (concat "^" (regexp-opt org-done-keywords-for-agenda)) newhead) (org-agenda-unmark-clocking-task))) (org-move-to-column col) (org-agenda-mark-clocking-task) (if org-agenda-allow-remote-undo (progn (setq --c1 (org-verify-change-for-undo --undo1 (save-current-buffer (set-buffer --buf1) buffer-undo-list)) --c2 (org-verify-change-for-undo --undo2 (save-current-buffer (set-buffer --buf2) buffer-undo-list))) (if (or --c1 --c2) (progn (and --c1 (save-current-buffer (set-buffer --buf1) (undo-boundary))) (and --c2 (save-current-buffer (set-buffer --buf2) (undo-boundary))) (setq org-agenda-undo-list (cons (list --cmd --cline --buf1 --c1 --buf2 --c2) org-agenda-undo-list))))))))
  31.   org-agenda-todo(nil)
  32.   funcall-interactively(org-agenda-todo nil)
  33.   call-interactively(org-agenda-todo nil nil)
  34.   command-execute(org-agenda-todo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement