From bd1a22fe245c5e2e33979b4b351bfb4564e83825 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki
Date: Tue, 27 Mar 2012 22:55:39 +0200 Subject: [PATCH 1/2] Support hour in repeated task cookie Basically, this patch changes all occurrence of "[dwmy]" with "[hdwmy]" and adds "("h" . hour)" to whata of org-auto-repeat-maybe. --- lisp/org.el | 38 +++++++++++++++++++------------------- 1 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 04c5c62..2981b0f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -683,7 +683,7 @@ An entry can be toggled between QUOTE and normal with :type 'string) (defconst org-repeat-re - "<[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^>\n]*?\\([.+]?\\+[0-9]+[dwmy]\\(/[0-9]+[dwmy]\\)?\\)" + "<[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^>\n]*?\\([.+]?\\+[0-9]+[hdwmy]\\(/[0-9]+[hdwmy]\\)?\\)" "Regular expression for specifying repeated events. After a match, group 1 contains the repeat expression.") @@ -7919,7 +7919,7 @@ and still retain the repeater to cover future instances of the task." (if (not (and (integerp n) (> n 0))) (error "Invalid number of replications %s" n)) (if (and (setq doshift (and (stringp shift) (string-match "\\S-" shift))) - (not (string-match "\\`[ \t]*\\+?\\([0-9]+\\)\\([dwmy]\\)[ \t]*\\'" + (not (string-match "\\`[ \t]*\\+?\\([0-9]+\\)\\([hdwmy]\\)[ \t]*\\'" shift))) (error "Invalid shift specification %s" shift)) (when doshift @@ -7937,7 +7937,7 @@ and still retain the repeater to cover future instances of the task." (setq end (point)) (setq template (buffer-substring beg end)) (when (and doshift - (string-match "<[^<>\n]+ [.+]?\\+[0-9]+[dwmy][^<>\n]*>" template)) + (string-match "<[^<>\n]+ [.+]?\\+[0-9]+[hdwmy][^<>\n]*>" template)) (delete-region beg end) (setq end beg) (setq nmin 0 nmax (1+ nmax) n-no-remove nmax)) @@ -7968,7 +7968,7 @@ and still retain the repeater to cover future instances of the task." (while (re-search-forward org-ts-regexp nil t) (save-excursion (goto-char (match-beginning 0)) - (if (looking-at "<[^<>\n]+\\( +[.+]?\\+[0-9]+[dwmy]\\)") + (if (looking-at "<[^<>\n]+\\( +[.+]?\\+[0-9]+[hdwmy]\\)") (delete-region (match-beginning 1) (match-end 1))))))) (setq task (buffer-string))) (insert task)) @@ -11870,7 +11870,7 @@ This function is run automatically after each state change to a DONE state." (aa (assoc last-state org-todo-kwd-alist)) (interpret (nth 1 aa)) (head (nth 2 aa)) - (whata '(("d" . day) ("m" . month) ("y" . year))) + (whata '(("h" . hour) ("d" . day) ("m" . month) ("y" . year))) (msg "Entry repeats: ") (org-log-done nil) (org-todo-log-states nil) @@ -11906,7 +11906,7 @@ This function is run automatically after each state change to a DONE state." (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)))) - (when (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([dwmy]\\)" ts) + (when (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts) (setq n (string-to-number (match-string 2 ts)) what (match-string 3 ts)) (if (equal what "w") (setq n (* n 7) what "d")) @@ -11935,7 +11935,7 @@ This function is run automatically after each state change to a DONE state." ;; rematch, so that we have everything in place for the real shift (org-at-timestamp-p t) (setq ts (match-string 1)) - (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([dwmy]\\)" ts)))) + (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts)))) (org-timestamp-change n (cdr (assoc what whata))) (setq msg (concat msg type " " org-last-changed-timestamp " ")))) (setq org-log-post-message msg) @@ -11982,7 +11982,7 @@ can either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." (let* ((old-date (org-entry-get nil "DEADLINE")) (repeater (and old-date (string-match - "\\([.+-]+[0-9]+[dwmy]\\(?:[/ ][-+]?[0-9]+[dwmy]\\)?\\) ?" + "\\([.+-]+[0-9]+[hdwmy]\\(?:[/ ][-+]?[0-9]+[hdwmy]\\)?\\) ?" old-date) (match-string 1 old-date)))) (if remove @@ -12030,7 +12030,7 @@ either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." (let* ((old-date (org-entry-get nil "SCHEDULED")) (repeater (and old-date (string-match - "\\([.+-]+[0-9]+[dwmy]\\(?:[/ ][-+]?[0-9]+[dwmy]\\)?\\) ?" + "\\([.+-]+[0-9]+[hdwmy]\\(?:[/ ][-+]?[0-9]+[hdwmy]\\)?\\) ?" old-date) (match-string 1 old-date)))) (if remove @@ -13161,7 +13161,7 @@ epoch to the beginning of today (00:00)." ((string= s "