emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: "Andrew J. Korty" <ajk@iu.edu>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Apply patch for hour/minute repeater support
Date: Tue, 21 Sep 2010 14:46:48 +0200	[thread overview]
Message-ID: <CAACDA2F-3A08-4A30-A6C5-42FE2F11AF1F@gmail.com> (raw)
In-Reply-To: <24904.1284483999@iu.edu>

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

  parent reply	other threads:[~2010-09-21 12:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2010-09-22  4:47   ` Manish
2010-09-22  7:06     ` Nick Dokos
2010-10-24 16:39 ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAACDA2F-3A08-4A30-A6C5-42FE2F11AF1F@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=ajk@iu.edu \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).