emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Apply patch for hour/minute repeater support
@ 2010-09-14 17:06 Andrew J. Korty
  2010-09-15 16:10 ` Martin Pohlack
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andrew J. Korty @ 2010-09-14 17:06 UTC (permalink / raw)
  To: emacs-orgmode

This patch adds hour and minute granularity to repeaters.  Let me know 
if there's interest in incorporating it, and I'll start the FSF 
paperwork process.

Andrew Korty

---
 doc/org.texi       |    4 ++--
 lisp/org-agenda.el |    2 +-
 lisp/org.el        |   27 +++++++++++++++------------
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index d6ea141..e9ede5a 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -5006,8 +5006,8 @@ plain timestamp will be shown exactly on that date.
 @cindex timestamp, with repeater interval
 A timestamp may contain a @emph{repeater interval}, indicating that it
 applies not only on the given date, but again and again after a certain
-interval of N days (d), weeks (w), months (m), or years (y).  The
-following will show up in the agenda every Wednesday:
+interval of N minutes(M), hours(H), days (d), weeks (w), months (m), or
+years (y).  The following will show up in the agenda every Wednesday:
 
 @example
 * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 9f94fa6..176c8f0 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4385,7 +4385,7 @@ the documentation of `org-diary'."
 	      (apply 'encode-time  ; DATE bound by calendar
 		     (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
 	     1 11))
-	   "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[dwmy]>\\)"
+	   "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[MHdwmy]>\\)"
 	   "\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
 	 marker hdmarker deadlinep scheduledp clockp closedp inactivep
 	 donep tmp priority category ee txt timestr tags b0 b3 e3 head
diff --git a/lisp/org.el b/lisp/org.el
index 70dd482..ace8291 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -621,7 +621,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]+[MHdwmy]\\(/[0-9]+[dwmy]\\)?\\)"
   "Regular expression for specifying repeated events.
 After a match, group 1 contains the repeat expression.")
 
@@ -11392,7 +11392,8 @@ 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 '(("M" . minute) ("H" . hour) ("d" . day) ("m" . month)
+                  ("y" . year)))
 	 (msg "Entry repeats: ")
 	 (org-log-done nil)
 	 (org-todo-log-states nil)
@@ -11429,7 +11430,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]+\\)\\([MHdwmy]\\)" 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"))
@@ -11438,13 +11439,15 @@ This function is run automatically after each state change to a DONE state."
 	    (setq time (save-match-data (org-time-string-to-time ts)))
 	    (cond
 	     ((equal (match-string 1 ts) ".")
-	      ;; Shift starting date to today
+	      ;; Shift starting date to now
 	      (org-timestamp-change
-	       (- (time-to-days (current-time)) (time-to-days time))
-	       'day))
+               (truncate (/ (- (time-to-seconds (current-time))
+                               (time-to-seconds time)) 60))
+	       'minute))
 	     ((equal (match-string 1 ts) "+")
 	      (while (or (= nshift 0)
-			 (<= (time-to-days time) (time-to-days (current-time))))
+			 (<= (time-to-seconds time)
+                             (time-to-seconds (current-time))))
 		(when (= (incf nshift) nshiftmax)
 		  (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today.  Continue? " nshift))
 		      (error "Abort")))
@@ -11456,7 +11459,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]+\\)\\([MHdwmy]\\)" ts))))
 	  (org-timestamp-change n (cdr (assoc what whata)))
 	  (setq msg (concat msg type " " org-last-changed-timestamp " "))))
       (setq org-log-post-message msg)
@@ -14687,7 +14690,7 @@ The command returns the inserted time stamp."
 	 t1 w1 with-hm tf time str w2 (off 0))
     (save-match-data
       (setq t1 (org-parse-time-string ts t))
-      (if (string-match "\\(-[0-9]+:[0-9]+\\)?\\( [.+]?\\+[0-9]+[dwmy]\\(/[0-9]+[dwmy]\\)?\\)?\\'" ts)
+      (if (string-match "\\(-[0-9]+:[0-9]+\\)?\\( [.+]?\\+[0-9]+[MHdwmy]\\(/[0-9]+[dwmy]\\)?\\)?\\'" ts)
 	  (setq off (- (match-end 0) (match-beginning 0)))))
     (setq end (- end off))
     (setq w1 (- end beg)
@@ -15177,8 +15180,8 @@ With prefix ARG, change that many days."
 (defun org-timestamp-change (n &optional what updown)
   "Change the date in the time stamp at point.
 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
-in the timestamp determines what will be changed."
+`year', `hour', `minute', `second'.  If WHAT is not given, the cursor
+position in the timestamp determines what will be changed."
   (let ((pos (point))
 	with-hm inactive
 	(dm (max (nth 1 org-time-stamp-rounding-minutes) 1))
@@ -15199,7 +15202,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]\\(/[0-9]+[dwmy]\\)?\\)*\\)[]>]"
+	   "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( +[.+]?[-+][0-9]+[HMdwmy]\\(/[0-9]+[dwmy]\\)?\\)*\\)[]>]"
 	   ts)
 	  (setq extra (match-string 1 ts)))
       (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts)
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Apply patch for hour/minute repeater support
  2010-09-14 17:06 [PATCH] Apply patch for hour/minute repeater support Andrew J. Korty
@ 2010-09-15 16:10 ` Martin Pohlack
  2010-09-15 23:58   ` Andrew J. Korty
  2010-09-21 12:46 ` Carsten Dominik
  2010-10-24 16:39 ` Carsten Dominik
  2 siblings, 1 reply; 7+ messages in thread
From: Martin Pohlack @ 2010-09-15 16:10 UTC (permalink / raw)
  To: Andrew J. Korty; +Cc: emacs-orgmode

On 14.09.2010 19:06, Andrew J. Korty wrote:
> This patch adds hour and minute granularity to repeaters.  Let me know 
> if there's interest in incorporating it, and I'll start the FSF 
> paperwork process.

There was a related discussion here:

http://www.mail-archive.com/emacs-orgmode@gnu.org/msg15142.html

Cheers,
Martin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Apply patch for hour/minute repeater support
  2010-09-15 16:10 ` Martin Pohlack
@ 2010-09-15 23:58   ` Andrew J. Korty
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew J. Korty @ 2010-09-15 23:58 UTC (permalink / raw)
  To: emacs-orgmode

Martin Pohlack <mp26@os.inf.tu-dresden.de> wrote:

> On 14.09.2010 19:06, Andrew J. Korty wrote:
> > This patch adds hour and minute granularity to repeaters.  Let me know 
> > if there's interest in incorporating it, and I'll start the FSF 
> > paperwork process.
> 
> There was a related discussion here:
> 
> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg15142.html

I must have missed that.  I don't use hour repeaters in the 
daily/weekly agenda but in tags-todo lists with 
org-agenda-todo-ignore-scheduled set to 'future.  I use them to remind 
me to do certain things every few hours, like check an incident queue.  
I also use them to tell me to check my mail, not because I'd forget 
that, but to keep me from checking it too frequently (I resist 
checking it until the todo appears).

ajk

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Apply patch for hour/minute repeater support
  2010-09-14 17:06 [PATCH] Apply patch for hour/minute repeater support Andrew J. Korty
  2010-09-15 16:10 ` Martin Pohlack
@ 2010-09-21 12:46 ` Carsten Dominik
  2010-09-22  4:47   ` Manish
  2010-10-24 16:39 ` Carsten Dominik
  2 siblings, 1 reply; 7+ messages in thread
From: Carsten Dominik @ 2010-09-21 12:46 UTC (permalink / raw)
  To: Andrew J. Korty; +Cc: emacs-orgmode

Hi everyone,

do we have any volunteers who are willing to test this patch?

Thanks.

- Carsten

On Sep 14, 2010, at 7:06 PM, Andrew J. Korty wrote:

> This patch adds hour and minute granularity to repeaters.  Let me  
> know if there's interest in incorporating it, and I'll start the FSF  
> paperwork process.
>
> Andrew Korty
>
> ---
> doc/org.texi       |    4 ++--
> lisp/org-agenda.el |    2 +-
> lisp/org.el        |   27 +++++++++++++++------------
> 3 files changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/doc/org.texi b/doc/org.texi
> index d6ea141..e9ede5a 100644
> --- a/doc/org.texi
> +++ b/doc/org.texi
> @@ -5006,8 +5006,8 @@ plain timestamp will be shown exactly on that  
> date.
> @cindex timestamp, with repeater interval
> A timestamp may contain a @emph{repeater interval}, indicating that it
> applies not only on the given date, but again and again after a  
> certain
> -interval of N days (d), weeks (w), months (m), or years (y).  The
> -following will show up in the agenda every Wednesday:
> +interval of N minutes(M), hours(H), days (d), weeks (w), months  
> (m), or
> +years (y).  The following will show up in the agenda every Wednesday:
> @example
> * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 9f94fa6..176c8f0 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -4385,7 +4385,7 @@ the documentation of `org-diary'."
> 	      (apply 'encode-time  ; DATE bound by calendar
> 		     (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
> 	     1 11))
> -	   "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[dwmy]>\\)"
> +	   "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[MHdwmy]>\\)"
> 	   "\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
> 	 marker hdmarker deadlinep scheduledp clockp closedp inactivep
> 	 donep tmp priority category ee txt timestr tags b0 b3 e3 head
> diff --git a/lisp/org.el b/lisp/org.el
> index 70dd482..ace8291 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -621,7 +621,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]+ 
> [MHdwmy]\\(/[0-9]+[dwmy]\\)?\\)"
>  "Regular expression for specifying repeated events.
> After a match, group 1 contains the repeat expression.")
> @@ -11392,7 +11392,8 @@ 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 '(("M" . minute) ("H" . hour) ("d" . day) ("m" . month)
> +                  ("y" . year)))
> 	 (msg "Entry repeats: ")
> 	 (org-log-done nil)
> 	 (org-todo-log-states nil)
> @@ -11429,7 +11430,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]+\\)\\([MHdwmy]\\)" 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"))
> @@ -11438,13 +11439,15 @@ This function is run automatically after  
> each state change to a DONE state."
> 	    (setq time (save-match-data (org-time-string-to-time ts)))
> 	    (cond
> 	     ((equal (match-string 1 ts) ".")
> -	      ;; Shift starting date to today
> +	      ;; Shift starting date to now
> 	      (org-timestamp-change
> -	       (- (time-to-days (current-time)) (time-to-days time))
> -	       'day))
> +               (truncate (/ (- (time-to-seconds (current-time))
> +                               (time-to-seconds time)) 60))
> +	       'minute))
> 	     ((equal (match-string 1 ts) "+")
> 	      (while (or (= nshift 0)
> -			 (<= (time-to-days time) (time-to-days (current-time))))
> +			 (<= (time-to-seconds time)
> +                             (time-to-seconds (current-time))))
> 		(when (= (incf nshift) nshiftmax)
> 		  (or (y-or-n-p (message "%d repeater intervals were not enough to  
> shift date past today.  Continue? " nshift))
> 		      (error "Abort")))
> @@ -11456,7 +11459,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]+\\)\\([MHdwmy]\\)"  
> ts))))
> 	  (org-timestamp-change n (cdr (assoc what whata)))
> 	  (setq msg (concat msg type " " org-last-changed-timestamp " "))))
>      (setq org-log-post-message msg)
> @@ -14687,7 +14690,7 @@ The command returns the inserted time stamp."
> 	 t1 w1 with-hm tf time str w2 (off 0))
>    (save-match-data
>      (setq t1 (org-parse-time-string ts t))
> -      (if (string-match "\\(-[0-9]+:[0-9]+\\)?\\( [.+]?\\+[0-9]+ 
> [dwmy]\\(/[0-9]+[dwmy]\\)?\\)?\\'" ts)
> +      (if (string-match "\\(-[0-9]+:[0-9]+\\)?\\( [.+]?\\+[0-9]+ 
> [MHdwmy]\\(/[0-9]+[dwmy]\\)?\\)?\\'" ts)
> 	  (setq off (- (match-end 0) (match-beginning 0)))))
>    (setq end (- end off))
>    (setq w1 (- end beg)
> @@ -15177,8 +15180,8 @@ With prefix ARG, change that many days."
> (defun org-timestamp-change (n &optional what updown)
>  "Change the date in the time stamp at point.
> 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
> -in the timestamp determines what will be changed."
> +`year', `hour', `minute', `second'.  If WHAT is not given, the cursor
> +position in the timestamp determines what will be changed."
>  (let ((pos (point))
> 	with-hm inactive
> 	(dm (max (nth 1 org-time-stamp-rounding-minutes) 1))
> @@ -15199,7 +15202,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]\\(/ 
> [0-9]+[dwmy]\\)?\\)*\\)[]>]"
> +	   "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( +[.+]?[-+][0-9]+[HMdwmy]\\ 
> (/[0-9]+[dwmy]\\)?\\)*\\)[]>]"
> 	   ts)
> 	  (setq extra (match-string 1 ts)))
>      (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts)
> -- 
> 1.7.2.3
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Apply patch for hour/minute repeater support
  2010-09-21 12:46 ` Carsten Dominik
@ 2010-09-22  4:47   ` Manish
  2010-09-22  7:06     ` Nick Dokos
  0 siblings, 1 reply; 7+ messages in thread
From: Manish @ 2010-09-22  4:47 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Andrew J. Korty, emacs-orgmode

Hello Andrew,

I copied the diff from "---" to the version number at the end of the
diff to a file and ran a "git apply <patch file>" while on a local
branch. It fails with "fatal: corrupt patch at line 12" which is:

,----
| @cindex timestamp, with repeater interval
`----

Any clues what I could be doing wrong?

Thanks
-- 
Manish


On Tue, Sep 21, 2010 at 6:16 PM, Carsten Dominik wrote:
> Hi everyone,
>
> do we have any volunteers who are willing to test this patch?
>
> Thanks.
>
> - Carsten
>
> On Sep 14, 2010, at 7:06 PM, Andrew J. Korty wrote:
>
>> This patch adds hour and minute granularity to repeaters.  Let me know if
>> there's interest in incorporating it, and I'll start the FSF paperwork
>> process.
>>
>> Andrew Korty
>>
>> ---
>> doc/org.texi       |    4 ++--
>> lisp/org-agenda.el |    2 +-
>> lisp/org.el        |   27 +++++++++++++++------------
>> 3 files changed, 18 insertions(+), 15 deletions(-)
>>
>> diff --git a/doc/org.texi b/doc/org.texi
>> index d6ea141..e9ede5a 100644
>> --- a/doc/org.texi
>> +++ b/doc/org.texi
>> @@ -5006,8 +5006,8 @@ plain timestamp will be shown exactly on that date.
>> @cindex timestamp, with repeater interval
>> A timestamp may contain a @emph{repeater interval}, indicating that it
>> applies not only on the given date, but again and again after a certain
>> -interval of N days (d), weeks (w), months (m), or years (y).  The
>> -following will show up in the agenda every Wednesday:
>> +interval of N minutes(M), hours(H), days (d), weeks (w), months (m), or
>> +years (y).  The following will show up in the agenda every Wednesday:
>> @example
>> * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
>> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
>> index 9f94fa6..176c8f0 100644
>> --- a/lisp/org-agenda.el
>> +++ b/lisp/org-agenda.el
>> @@ -4385,7 +4385,7 @@ the documentation of `org-diary'."
>>              (apply 'encode-time  ; DATE bound by calendar
>>                     (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
>>             1 11))
>> -          "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[dwmy]>\\)"
>> +          "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[MHdwmy]>\\)"
>>           "\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
>>         marker hdmarker deadlinep scheduledp clockp closedp inactivep
>>         donep tmp priority category ee txt timestr tags b0 b3 e3 head
>> diff --git a/lisp/org.el b/lisp/org.el
>> index 70dd482..ace8291 100644
>> --- a/lisp/org.el
>> +++ b/lisp/org.el
>> @@ -621,7 +621,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]+[MHdwmy]\\(/[0-9]+[dwmy]\\)?\\)"
>>  "Regular expression for specifying repeated events.
>> After a match, group 1 contains the repeat expression.")
>> @@ -11392,7 +11392,8 @@ 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 '(("M" . minute) ("H" . hour) ("d" . day) ("m" . month)
>> +                  ("y" . year)))
>>         (msg "Entry repeats: ")
>>         (org-log-done nil)
>>         (org-todo-log-states nil)
>> @@ -11429,7 +11430,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]+\\)\\([MHdwmy]\\)" 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"))
>> @@ -11438,13 +11439,15 @@ This function is run automatically after each
>> state change to a DONE state."
>>            (setq time (save-match-data (org-time-string-to-time ts)))
>>            (cond
>>             ((equal (match-string 1 ts) ".")
>> -             ;; Shift starting date to today
>> +             ;; Shift starting date to now
>>              (org-timestamp-change
>> -              (- (time-to-days (current-time)) (time-to-days time))
>> -              'day))
>> +               (truncate (/ (- (time-to-seconds (current-time))
>> +                               (time-to-seconds time)) 60))
>> +              'minute))
>>             ((equal (match-string 1 ts) "+")
>>              (while (or (= nshift 0)
>> -                        (<= (time-to-days time) (time-to-days
>> (current-time))))
>> +                        (<= (time-to-seconds time)
>> +                             (time-to-seconds (current-time))))
>>                (when (= (incf nshift) nshiftmax)
>>                  (or (y-or-n-p (message "%d repeater intervals were not
>> enough to shift date past today.  Continue? " nshift))
>>                      (error "Abort")))
>> @@ -11456,7 +11459,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]+\\)\\([MHdwmy]\\)"
>> ts))))
>>          (org-timestamp-change n (cdr (assoc what whata)))
>>          (setq msg (concat msg type " " org-last-changed-timestamp " "))))
>>     (setq org-log-post-message msg)
>> @@ -14687,7 +14690,7 @@ The command returns the inserted time stamp."
>>         t1 w1 with-hm tf time str w2 (off 0))
>>   (save-match-data
>>     (setq t1 (org-parse-time-string ts t))
>> -      (if (string-match "\\(-[0-9]+:[0-9]+\\)?\\(
>> [.+]?\\+[0-9]+[dwmy]\\(/[0-9]+[dwmy]\\)?\\)?\\'" ts)
>> +      (if (string-match "\\(-[0-9]+:[0-9]+\\)?\\(
>> [.+]?\\+[0-9]+[MHdwmy]\\(/[0-9]+[dwmy]\\)?\\)?\\'" ts)
>>          (setq off (- (match-end 0) (match-beginning 0)))))
>>   (setq end (- end off))
>>   (setq w1 (- end beg)
>> @@ -15177,8 +15180,8 @@ With prefix ARG, change that many days."
>> (defun org-timestamp-change (n &optional what updown)
>>  "Change the date in the time stamp at point.
>> 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
>> -in the timestamp determines what will be changed."
>> +`year', `hour', `minute', `second'.  If WHAT is not given, the cursor
>> +position in the timestamp determines what will be changed."
>>  (let ((pos (point))
>>        with-hm inactive
>>        (dm (max (nth 1 org-time-stamp-rounding-minutes) 1))
>> @@ -15199,7 +15202,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]\\(/[0-9]+[dwmy]\\)?\\)*\\)[]>]"
>> +          "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\(
>> +[.+]?[-+][0-9]+[HMdwmy]\\(/[0-9]+[dwmy]\\)?\\)*\\)[]>]"
>>           ts)
>>          (setq extra (match-string 1 ts)))
>>     (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts)
>> --
>> 1.7.2.3
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> - Carsten
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Apply patch for hour/minute repeater support
  2010-09-22  4:47   ` Manish
@ 2010-09-22  7:06     ` Nick Dokos
  0 siblings, 0 replies; 7+ messages in thread
From: Nick Dokos @ 2010-09-22  7:06 UTC (permalink / raw)
  To: Manish; +Cc: Andrew J. Korty, nicholas.dokos, emacs-orgmode, Carsten Dominik

Manish <mailtomanish.sharma@gmail.com> wrote:

> Hello Andrew,
> 
> I copied the diff from "---" to the version number at the end of the
> diff to a file and ran a "git apply <patch file>" while on a local
> branch. It fails with "fatal: corrupt patch at line 12" which is:
> 
> ,----
> | @cindex timestamp, with repeater interval
> `----
> 
> Any clues what I could be doing wrong?
> 

Don't edit the message file: ``git apply'' and ``git am'' are perfectly
capable of stripping out the irrelevant stuf.

I did

   $ git checkout -b foo master

to create a ``foo'' branch and then

   $ git am  ~/Mail/org/25794
   Applying: Apply patch for hour/minute repeater support

(that's the file that contains Andrew's mail message - no editing involved).
As you can see, it worked without a hitch.

HTH,
Nick

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Apply patch for hour/minute repeater support
  2010-09-14 17:06 [PATCH] Apply patch for hour/minute repeater support Andrew J. Korty
  2010-09-15 16:10 ` Martin Pohlack
  2010-09-21 12:46 ` Carsten Dominik
@ 2010-10-24 16:39 ` Carsten Dominik
  2 siblings, 0 replies; 7+ messages in thread
From: Carsten Dominik @ 2010-10-24 16:39 UTC (permalink / raw)
  To: Andrew J. Korty; +Cc: emacs-orgmode

Dear Andrew,

thanks for the patch.  However, I don't think Org is ready
to deal with hour and minute granularity of tasks.  The decision
weather to display a task in the agenda is based solely on days,
not on time, and this is deeply engrained into a number of
places inside Org.  I don't see how this will be very meaningful.
So I will not take the patch, at least for now.  More discussion
and many other changes would be needed.

Thanks for your contribution anyway - I hope another one
will make it!

Best wishes

- Carsten

On Sep 14, 2010, at 7:06 PM, Andrew J. Korty wrote:

> This patch adds hour and minute granularity to repeaters.  Let me  
> know if there's interest in incorporating it, and I'll start the FSF  
> paperwork process.
>
> Andrew Korty
>
> ---
> doc/org.texi       |    4 ++--
> lisp/org-agenda.el |    2 +-
> lisp/org.el        |   27 +++++++++++++++------------
> 3 files changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/doc/org.texi b/doc/org.texi
> index d6ea141..e9ede5a 100644
> --- a/doc/org.texi
> +++ b/doc/org.texi
> @@ -5006,8 +5006,8 @@ plain timestamp will be shown exactly on that  
> date.
> @cindex timestamp, with repeater interval
> A timestamp may contain a @emph{repeater interval}, indicating that it
> applies not only on the given date, but again and again after a  
> certain
> -interval of N days (d), weeks (w), months (m), or years (y).  The
> -following will show up in the agenda every Wednesday:
> +interval of N minutes(M), hours(H), days (d), weeks (w), months  
> (m), or
> +years (y).  The following will show up in the agenda every Wednesday:
> @example
> * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 9f94fa6..176c8f0 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -4385,7 +4385,7 @@ the documentation of `org-diary'."
> 	      (apply 'encode-time  ; DATE bound by calendar
> 		     (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
> 	     1 11))
> -	   "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[dwmy]>\\)"
> +	   "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[MHdwmy]>\\)"
> 	   "\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
> 	 marker hdmarker deadlinep scheduledp clockp closedp inactivep
> 	 donep tmp priority category ee txt timestr tags b0 b3 e3 head
> diff --git a/lisp/org.el b/lisp/org.el
> index 70dd482..ace8291 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -621,7 +621,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]+ 
> [MHdwmy]\\(/[0-9]+[dwmy]\\)?\\)"
>  "Regular expression for specifying repeated events.
> After a match, group 1 contains the repeat expression.")
> @@ -11392,7 +11392,8 @@ 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 '(("M" . minute) ("H" . hour) ("d" . day) ("m" . month)
> +                  ("y" . year)))
> 	 (msg "Entry repeats: ")
> 	 (org-log-done nil)
> 	 (org-todo-log-states nil)
> @@ -11429,7 +11430,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]+\\)\\([MHdwmy]\\)" 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"))
> @@ -11438,13 +11439,15 @@ This function is run automatically after  
> each state change to a DONE state."
> 	    (setq time (save-match-data (org-time-string-to-time ts)))
> 	    (cond
> 	     ((equal (match-string 1 ts) ".")
> -	      ;; Shift starting date to today
> +	      ;; Shift starting date to now
> 	      (org-timestamp-change
> -	       (- (time-to-days (current-time)) (time-to-days time))
> -	       'day))
> +               (truncate (/ (- (time-to-seconds (current-time))
> +                               (time-to-seconds time)) 60))
> +	       'minute))
> 	     ((equal (match-string 1 ts) "+")
> 	      (while (or (= nshift 0)
> -			 (<= (time-to-days time) (time-to-days (current-time))))
> +			 (<= (time-to-seconds time)
> +                             (time-to-seconds (current-time))))
> 		(when (= (incf nshift) nshiftmax)
> 		  (or (y-or-n-p (message "%d repeater intervals were not enough to  
> shift date past today.  Continue? " nshift))
> 		      (error "Abort")))
> @@ -11456,7 +11459,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]+\\)\\([MHdwmy]\\)"  
> ts))))
> 	  (org-timestamp-change n (cdr (assoc what whata)))
> 	  (setq msg (concat msg type " " org-last-changed-timestamp " "))))
>      (setq org-log-post-message msg)
> @@ -14687,7 +14690,7 @@ The command returns the inserted time stamp."
> 	 t1 w1 with-hm tf time str w2 (off 0))
>    (save-match-data
>      (setq t1 (org-parse-time-string ts t))
> -      (if (string-match "\\(-[0-9]+:[0-9]+\\)?\\( [.+]?\\+[0-9]+ 
> [dwmy]\\(/[0-9]+[dwmy]\\)?\\)?\\'" ts)
> +      (if (string-match "\\(-[0-9]+:[0-9]+\\)?\\( [.+]?\\+[0-9]+ 
> [MHdwmy]\\(/[0-9]+[dwmy]\\)?\\)?\\'" ts)
> 	  (setq off (- (match-end 0) (match-beginning 0)))))
>    (setq end (- end off))
>    (setq w1 (- end beg)
> @@ -15177,8 +15180,8 @@ With prefix ARG, change that many days."
> (defun org-timestamp-change (n &optional what updown)
>  "Change the date in the time stamp at point.
> 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
> -in the timestamp determines what will be changed."
> +`year', `hour', `minute', `second'.  If WHAT is not given, the cursor
> +position in the timestamp determines what will be changed."
>  (let ((pos (point))
> 	with-hm inactive
> 	(dm (max (nth 1 org-time-stamp-rounding-minutes) 1))
> @@ -15199,7 +15202,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]\\(/ 
> [0-9]+[dwmy]\\)?\\)*\\)[]>]"
> +	   "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( +[.+]?[-+][0-9]+[HMdwmy]\\ 
> (/[0-9]+[dwmy]\\)?\\)*\\)[]>]"
> 	   ts)
> 	  (setq extra (match-string 1 ts)))
>      (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts)
> -- 
> 1.7.2.3
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-10-24 16:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-14 17:06 [PATCH] Apply patch for hour/minute repeater support Andrew J. Korty
2010-09-15 16:10 ` Martin Pohlack
2010-09-15 23:58   ` Andrew J. Korty
2010-09-21 12:46 ` Carsten Dominik
2010-09-22  4:47   ` Manish
2010-09-22  7:06     ` Nick Dokos
2010-10-24 16:39 ` Carsten Dominik

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).