emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-agenda: fix start/end time in timerange
@ 2011-01-22 17:08 Julien Danjou
  2011-01-25  5:47 ` [Accepted] " Carsten Dominik
  2011-01-25  5:48 ` [PATCH] " Carsten Dominik
  0 siblings, 2 replies; 3+ messages in thread
From: Julien Danjou @ 2011-01-22 17:08 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Julien Danjou

* org-agenda.el (org-agenda-get-blocks): Fix time of start/end
of events with range. This display things like:
<2011-01-22 Sat 14:00>--<2011-01-23 Sun 20:00>
correctly, with the event starting at 14:00 and ending at 20:00.

Signed-off-by: Julien Danjou <julien@danjou.info>
---
 lisp/org-agenda.el |   92 +++++++++++++++++++++++++++------------------------
 1 files changed, 49 insertions(+), 43 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 4f06eb0..3c1104e 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -5075,55 +5075,61 @@ FRACTION is what fraction of the head-warning time has passed."
 			      (abbreviate-file-name buffer-file-name))))
 	 (regexp org-tr-regexp)
 	 (d0 (calendar-absolute-from-gregorian date))
-	 marker hdmarker ee txt d1 d2 s1 s2 timestr category todo-state tags pos
+	 marker hdmarker ee txt d1 d2 s1 s2 category todo-state tags pos
 	 head donep)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (catch :skip
 	(org-agenda-skip)
 	(setq pos (point))
-	(setq timestr (match-string 0)
-	      s1 (match-string 1)
-	      s2 (match-string 2)
-	      d1 (time-to-days (org-time-string-to-time s1))
-	      d2 (time-to-days (org-time-string-to-time s2)))
-	(if (and (> (- d0 d1) -1) (> (- d2 d0) -1))
-	    ;; Only allow days between the limits, because the normal
-	    ;; date stamps will catch the limits.
-	    (save-excursion
-	      (setq todo-state (org-get-todo-state))
-	      (setq donep (member todo-state org-done-keywords))
-	      (if (and donep org-agenda-skip-timestamp-if-done)
-		  (throw :skip t))
-	      (setq marker (org-agenda-new-marker (point)))
-	      (setq category (org-get-category))
-	      (if (not (re-search-backward "^\\*+ " nil t))
-		  (setq txt org-agenda-no-heading-message)
-		(goto-char (match-beginning 0))
-		(setq hdmarker (org-agenda-new-marker (point)))
-		(setq tags (org-get-tags-at))
-		(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
-		(setq head (match-string 1))
-		(let ((remove-re
-		       (if org-agenda-remove-timeranges-from-blocks
-			   (concat
-			    "<" (regexp-quote s1) ".*?>"
-			    "--"
-			    "<" (regexp-quote s2) ".*?>")
-			 nil)))
-		  (setq txt (org-format-agenda-item
-			     (format
-			      (nth (if (= d1 d2) 0 1)
-				   org-agenda-timerange-leaders)
-			      (1+ (- d0 d1)) (1+ (- d2 d1)))
-			     head category tags
-			     timestr nil remove-re))))
-	      (org-add-props txt props
-		'org-marker marker 'org-hd-marker hdmarker
-		'type "block" 'date date
-		'todo-state todo-state
-		'priority (org-get-priority txt) 'org-category category)
-	      (push txt ee)))
+	(let ((start-time (match-string 1))
+	      (end-time (match-string 2)))
+	  (setq s1 (match-string 1)
+		s2 (match-string 2)
+		d1 (time-to-days (org-time-string-to-time s1))
+		d2 (time-to-days (org-time-string-to-time s2)))
+	  (if (and (> (- d0 d1) -1) (> (- d2 d0) -1))
+	      ;; Only allow days between the limits, because the normal
+	      ;; date stamps will catch the limits.
+	      (save-excursion
+		(setq todo-state (org-get-todo-state))
+		(setq donep (member todo-state org-done-keywords))
+		(if (and donep org-agenda-skip-timestamp-if-done)
+		    (throw :skip t))
+		(setq marker (org-agenda-new-marker (point)))
+		(setq category (org-get-category))
+		(if (not (re-search-backward "^\\*+ " nil t))
+		    (setq txt org-agenda-no-heading-message)
+		  (goto-char (match-beginning 0))
+		  (setq hdmarker (org-agenda-new-marker (point)))
+		  (setq tags (org-get-tags-at))
+		  (looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
+		  (setq head (match-string 1))
+		  (let ((remove-re
+			 (if org-agenda-remove-timeranges-from-blocks
+			     (concat
+			      "<" (regexp-quote s1) ".*?>"
+			      "--"
+			      "<" (regexp-quote s2) ".*?>")
+			   nil)))
+		    (setq txt (org-format-agenda-item
+			       (format
+				(nth (if (= d1 d2) 0 1)
+				     org-agenda-timerange-leaders)
+				(1+ (- d0 d1)) (1+ (- d2 d1)))
+			       head category tags
+			       (cond ((= d1 d0)
+				      (concat "<" start-time ">"))
+				     ((= d2 d0)
+				      (concat "<" end-time ">"))
+				     (t nil))
+			       remove-re))))
+		(org-add-props txt props
+		  'org-marker marker 'org-hd-marker hdmarker
+		  'type "block" 'date date
+		  'todo-state todo-state
+		  'priority (org-get-priority txt) 'org-category category)
+		(push txt ee))))
 	(goto-char pos)))
     ;; Sort the entries by expiration date.
     (nreverse ee)))
-- 
1.7.2.3

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

* [Accepted] org-agenda: fix start/end time in timerange
  2011-01-22 17:08 [PATCH] org-agenda: fix start/end time in timerange Julien Danjou
@ 2011-01-25  5:47 ` Carsten Dominik
  2011-01-25  5:48 ` [PATCH] " Carsten Dominik
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2011-01-25  5:47 UTC (permalink / raw)
  To: emacs-orgmode

Patch 555 (http://patchwork.newartisans.com/patch/555/) is now "Accepted".

Maintainer comment: No comment

This relates to the following submission:

http://mid.gmane.org/%3C1295716131-12190-1-git-send-email-julien%40danjou.info%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [Orgmode] org-agenda: fix start/end time in timerange
> Date: Sat, 22 Jan 2011 22:08:51 -0000
> From: Julien Danjou <julien@danjou.info>
> X-Patchwork-Id: 555
> Message-Id: <1295716131-12190-1-git-send-email-julien@danjou.info>
> To: emacs-orgmode@gnu.org
> Cc: Julien Danjou <julien@danjou.info>
> 
> * org-agenda.el (org-agenda-get-blocks): Fix time of start/end
> of events with range. This display things like:
> <2011-01-22 Sat 14:00>--<2011-01-23 Sun 20:00>
> correctly, with the event starting at 14:00 and ending at 20:00.
> 
> Signed-off-by: Julien Danjou <julien@danjou.info>
> 
> ---
> lisp/org-agenda.el |   92 +++++++++++++++++++++++++++------------------------
>  1 files changed, 49 insertions(+), 43 deletions(-)
> 
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 4f06eb0..3c1104e 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -5075,55 +5075,61 @@ FRACTION is what fraction of the head-warning time has passed."
>  			      (abbreviate-file-name buffer-file-name))))
>  	 (regexp org-tr-regexp)
>  	 (d0 (calendar-absolute-from-gregorian date))
> -	 marker hdmarker ee txt d1 d2 s1 s2 timestr category todo-state tags pos
> +	 marker hdmarker ee txt d1 d2 s1 s2 category todo-state tags pos
>  	 head donep)
>      (goto-char (point-min))
>      (while (re-search-forward regexp nil t)
>        (catch :skip
>  	(org-agenda-skip)
>  	(setq pos (point))
> -	(setq timestr (match-string 0)
> -	      s1 (match-string 1)
> -	      s2 (match-string 2)
> -	      d1 (time-to-days (org-time-string-to-time s1))
> -	      d2 (time-to-days (org-time-string-to-time s2)))
> -	(if (and (> (- d0 d1) -1) (> (- d2 d0) -1))
> -	    ;; Only allow days between the limits, because the normal
> -	    ;; date stamps will catch the limits.
> -	    (save-excursion
> -	      (setq todo-state (org-get-todo-state))
> -	      (setq donep (member todo-state org-done-keywords))
> -	      (if (and donep org-agenda-skip-timestamp-if-done)
> -		  (throw :skip t))
> -	      (setq marker (org-agenda-new-marker (point)))
> -	      (setq category (org-get-category))
> -	      (if (not (re-search-backward "^\\*+ " nil t))
> -		  (setq txt org-agenda-no-heading-message)
> -		(goto-char (match-beginning 0))
> -		(setq hdmarker (org-agenda-new-marker (point)))
> -		(setq tags (org-get-tags-at))
> -		(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
> -		(setq head (match-string 1))
> -		(let ((remove-re
> -		       (if org-agenda-remove-timeranges-from-blocks
> -			   (concat
> -			    "<" (regexp-quote s1) ".*?>"
> -			    "--"
> -			    "<" (regexp-quote s2) ".*?>")
> -			 nil)))
> -		  (setq txt (org-format-agenda-item
> -			     (format
> -			      (nth (if (= d1 d2) 0 1)
> -				   org-agenda-timerange-leaders)
> -			      (1+ (- d0 d1)) (1+ (- d2 d1)))
> -			     head category tags
> -			     timestr nil remove-re))))
> -	      (org-add-props txt props
> -		'org-marker marker 'org-hd-marker hdmarker
> -		'type "block" 'date date
> -		'todo-state todo-state
> -		'priority (org-get-priority txt) 'org-category category)
> -	      (push txt ee)))
> +	(let ((start-time (match-string 1))
> +	      (end-time (match-string 2)))
> +	  (setq s1 (match-string 1)
> +		s2 (match-string 2)
> +		d1 (time-to-days (org-time-string-to-time s1))
> +		d2 (time-to-days (org-time-string-to-time s2)))
> +	  (if (and (> (- d0 d1) -1) (> (- d2 d0) -1))
> +	      ;; Only allow days between the limits, because the normal
> +	      ;; date stamps will catch the limits.
> +	      (save-excursion
> +		(setq todo-state (org-get-todo-state))
> +		(setq donep (member todo-state org-done-keywords))
> +		(if (and donep org-agenda-skip-timestamp-if-done)
> +		    (throw :skip t))
> +		(setq marker (org-agenda-new-marker (point)))
> +		(setq category (org-get-category))
> +		(if (not (re-search-backward "^\\*+ " nil t))
> +		    (setq txt org-agenda-no-heading-message)
> +		  (goto-char (match-beginning 0))
> +		  (setq hdmarker (org-agenda-new-marker (point)))
> +		  (setq tags (org-get-tags-at))
> +		  (looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
> +		  (setq head (match-string 1))
> +		  (let ((remove-re
> +			 (if org-agenda-remove-timeranges-from-blocks
> +			     (concat
> +			      "<" (regexp-quote s1) ".*?>"
> +			      "--"
> +			      "<" (regexp-quote s2) ".*?>")
> +			   nil)))
> +		    (setq txt (org-format-agenda-item
> +			       (format
> +				(nth (if (= d1 d2) 0 1)
> +				     org-agenda-timerange-leaders)
> +				(1+ (- d0 d1)) (1+ (- d2 d1)))
> +			       head category tags
> +			       (cond ((= d1 d0)
> +				      (concat "<" start-time ">"))
> +				     ((= d2 d0)
> +				      (concat "<" end-time ">"))
> +				     (t nil))
> +			       remove-re))))
> +		(org-add-props txt props
> +		  'org-marker marker 'org-hd-marker hdmarker
> +		  'type "block" 'date date
> +		  'todo-state todo-state
> +		  'priority (org-get-priority txt) 'org-category category)
> +		(push txt ee))))
>  	(goto-char pos)))
>      ;; Sort the entries by expiration date.
>      (nreverse ee)))
> 

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

* Re: [PATCH] org-agenda: fix start/end time in timerange
  2011-01-22 17:08 [PATCH] org-agenda: fix start/end time in timerange Julien Danjou
  2011-01-25  5:47 ` [Accepted] " Carsten Dominik
@ 2011-01-25  5:48 ` Carsten Dominik
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2011-01-25  5:48 UTC (permalink / raw)
  To: Julien Danjou; +Cc: emacs-orgmode

Applied, thanks.

- Carsten

On Jan 22, 2011, at 6:08 PM, Julien Danjou wrote:

> * org-agenda.el (org-agenda-get-blocks): Fix time of start/end
> of events with range. This display things like:
> <2011-01-22 Sat 14:00>--<2011-01-23 Sun 20:00>
> correctly, with the event starting at 14:00 and ending at 20:00.
>
> Signed-off-by: Julien Danjou <julien@danjou.info>
> ---
> lisp/org-agenda.el |   92 ++++++++++++++++++++++++++ 
> +------------------------
> 1 files changed, 49 insertions(+), 43 deletions(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 4f06eb0..3c1104e 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -5075,55 +5075,61 @@ FRACTION is what fraction of the head- 
> warning time has passed."
> 			      (abbreviate-file-name buffer-file-name))))
> 	 (regexp org-tr-regexp)
> 	 (d0 (calendar-absolute-from-gregorian date))
> -	 marker hdmarker ee txt d1 d2 s1 s2 timestr category todo-state  
> tags pos
> +	 marker hdmarker ee txt d1 d2 s1 s2 category todo-state tags pos
> 	 head donep)
>     (goto-char (point-min))
>     (while (re-search-forward regexp nil t)
>       (catch :skip
> 	(org-agenda-skip)
> 	(setq pos (point))
> -	(setq timestr (match-string 0)
> -	      s1 (match-string 1)
> -	      s2 (match-string 2)
> -	      d1 (time-to-days (org-time-string-to-time s1))
> -	      d2 (time-to-days (org-time-string-to-time s2)))
> -	(if (and (> (- d0 d1) -1) (> (- d2 d0) -1))
> -	    ;; Only allow days between the limits, because the normal
> -	    ;; date stamps will catch the limits.
> -	    (save-excursion
> -	      (setq todo-state (org-get-todo-state))
> -	      (setq donep (member todo-state org-done-keywords))
> -	      (if (and donep org-agenda-skip-timestamp-if-done)
> -		  (throw :skip t))
> -	      (setq marker (org-agenda-new-marker (point)))
> -	      (setq category (org-get-category))
> -	      (if (not (re-search-backward "^\\*+ " nil t))
> -		  (setq txt org-agenda-no-heading-message)
> -		(goto-char (match-beginning 0))
> -		(setq hdmarker (org-agenda-new-marker (point)))
> -		(setq tags (org-get-tags-at))
> -		(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
> -		(setq head (match-string 1))
> -		(let ((remove-re
> -		       (if org-agenda-remove-timeranges-from-blocks
> -			   (concat
> -			    "<" (regexp-quote s1) ".*?>"
> -			    "--"
> -			    "<" (regexp-quote s2) ".*?>")
> -			 nil)))
> -		  (setq txt (org-format-agenda-item
> -			     (format
> -			      (nth (if (= d1 d2) 0 1)
> -				   org-agenda-timerange-leaders)
> -			      (1+ (- d0 d1)) (1+ (- d2 d1)))
> -			     head category tags
> -			     timestr nil remove-re))))
> -	      (org-add-props txt props
> -		'org-marker marker 'org-hd-marker hdmarker
> -		'type "block" 'date date
> -		'todo-state todo-state
> -		'priority (org-get-priority txt) 'org-category category)
> -	      (push txt ee)))
> +	(let ((start-time (match-string 1))
> +	      (end-time (match-string 2)))
> +	  (setq s1 (match-string 1)
> +		s2 (match-string 2)
> +		d1 (time-to-days (org-time-string-to-time s1))
> +		d2 (time-to-days (org-time-string-to-time s2)))
> +	  (if (and (> (- d0 d1) -1) (> (- d2 d0) -1))
> +	      ;; Only allow days between the limits, because the normal
> +	      ;; date stamps will catch the limits.
> +	      (save-excursion
> +		(setq todo-state (org-get-todo-state))
> +		(setq donep (member todo-state org-done-keywords))
> +		(if (and donep org-agenda-skip-timestamp-if-done)
> +		    (throw :skip t))
> +		(setq marker (org-agenda-new-marker (point)))
> +		(setq category (org-get-category))
> +		(if (not (re-search-backward "^\\*+ " nil t))
> +		    (setq txt org-agenda-no-heading-message)
> +		  (goto-char (match-beginning 0))
> +		  (setq hdmarker (org-agenda-new-marker (point)))
> +		  (setq tags (org-get-tags-at))
> +		  (looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
> +		  (setq head (match-string 1))
> +		  (let ((remove-re
> +			 (if org-agenda-remove-timeranges-from-blocks
> +			     (concat
> +			      "<" (regexp-quote s1) ".*?>"
> +			      "--"
> +			      "<" (regexp-quote s2) ".*?>")
> +			   nil)))
> +		    (setq txt (org-format-agenda-item
> +			       (format
> +				(nth (if (= d1 d2) 0 1)
> +				     org-agenda-timerange-leaders)
> +				(1+ (- d0 d1)) (1+ (- d2 d1)))
> +			       head category tags
> +			       (cond ((= d1 d0)
> +				      (concat "<" start-time ">"))
> +				     ((= d2 d0)
> +				      (concat "<" end-time ">"))
> +				     (t nil))
> +			       remove-re))))
> +		(org-add-props txt props
> +		  'org-marker marker 'org-hd-marker hdmarker
> +		  'type "block" 'date date
> +		  'todo-state todo-state
> +		  'priority (org-get-priority txt) 'org-category category)
> +		(push txt ee))))
> 	(goto-char pos)))
>     ;; Sort the entries by expiration date.
>     (nreverse ee)))
> -- 
> 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] 3+ messages in thread

end of thread, other threads:[~2011-01-29 22:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-22 17:08 [PATCH] org-agenda: fix start/end time in timerange Julien Danjou
2011-01-25  5:47 ` [Accepted] " Carsten Dominik
2011-01-25  5:48 ` [PATCH] " 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).