emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Let org-agenda-time-grid control if the grid is displayed
@ 2012-05-25 12:33 Christophe Junke
  2012-05-25 12:50 ` Christophe Junke
  0 siblings, 1 reply; 8+ messages in thread
From: Christophe Junke @ 2012-05-25 12:33 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1720 bytes --]

Let org-agenda-time-grid control if the grid is displayed

* lisp/org-agenda.el (org-agenda-list): ensures that the
list returned by org-agenda-add-time-grid-maybe is appended
to rtnall before checking if rtnall is emtpy.

In the case where rtnall is empty (no item for current day),
we do not call org-agenda-add-time-grid-maybe.  This seems
bogus because that function is already computing whether the
time grid must be included, and does so according to the
user's preferences.

In particular, the org-agenda-time-grid variable has a
'require-timed' parameter controlling the visibility of the
time grid.

So, this patch :

 - removes the premature check for rtnall being empty,
 - inconditionally calls org-agenda-add-time-grid-maybe,
 - appends the result to rtnall,
 - and finally checks the emptiness of the resulting list
   before pretty printing.

TINYCHANGE
---
 lisp/org-agenda.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index cfd3e25..eebb66f 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3886,10 +3886,11 @@ given in `org-agenda-start-on-weekday'."
 	    (put-text-property s (1- (point)) 'org-day-cnt day-cnt)
 	    (when todayp
 	      (put-text-property s (1- (point)) 'org-today t))
+	    (setq rtnall
+		  (append rtnall
+			  (org-agenda-add-time-grid-maybe rtnall ndays todayp)))
 	    (if rtnall (insert ;; all entries
-			(org-finalize-agenda-entries
-			 (org-agenda-add-time-grid-maybe
-			  rtnall ndays todayp))
+			(org-finalize-agenda-entries rtnall)
 			"\n"))
 	    (put-text-property s (1- (point)) 'day d)
 	    (put-text-property s (1- (point)) 'org-day-cnt day-cnt))))
-- 
1.7.10.2.484.gcd07cc5

[-- Attachment #2: 0001-Let-org-agenda-time-grid-control-if-the-grid-is-disp.patch --]
[-- Type: text/x-patch, Size: 1902 bytes --]

From 5b1b0603ac72f8482c03596a4dadcc6692852503 Mon Sep 17 00:00:00 2001
From: Christophe Junke <christophe.junke@inria.fr>
Date: Fri, 25 May 2012 11:40:47 +0200
Subject: [PATCH] Let org-agenda-time-grid control if the grid is displayed

* lisp/org-agenda.el (org-agenda-list): ensures that the
list returned by org-agenda-add-time-grid-maybe is appended
to rtnall before checking if the latter is emtpy.

In the case where rtnall is empty (no item for current day),
we do not call org-agenda-add-time-grid-maybe.  This seems
bogus because that function is already computing whether the
time grid must be included, and does so according to the
user's preferences.

In particular, the org-agenda-time-grid variable has a
'require-timed' parameter controlling the visibility of the
time grid.

So, this patch :

 - removes the premature check for rtnall being empty,
 - inconditionally calls org-agenda-add-time-grid-maybe,
 - appends the result to rtnall,
 - and finally checks the emptiness of the resulting list
   before pretty printing.

TINYCHANGE
---
 lisp/org-agenda.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index cfd3e25..eebb66f 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3886,10 +3886,11 @@ given in `org-agenda-start-on-weekday'."
 	    (put-text-property s (1- (point)) 'org-day-cnt day-cnt)
 	    (when todayp
 	      (put-text-property s (1- (point)) 'org-today t))
+	    (setq rtnall
+		  (append rtnall
+			  (org-agenda-add-time-grid-maybe rtnall ndays todayp)))
 	    (if rtnall (insert ;; all entries
-			(org-finalize-agenda-entries
-			 (org-agenda-add-time-grid-maybe
-			  rtnall ndays todayp))
+			(org-finalize-agenda-entries rtnall)
 			"\n"))
 	    (put-text-property s (1- (point)) 'day d)
 	    (put-text-property s (1- (point)) 'org-day-cnt day-cnt))))
-- 
1.7.10.2.484.gcd07cc5


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

* [PATCH] Let org-agenda-time-grid control if the grid is displayed
  2012-05-25 12:33 Christophe Junke
@ 2012-05-25 12:50 ` Christophe Junke
  2012-05-25 22:20   ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Christophe Junke @ 2012-05-25 12:50 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1772 bytes --]

Let org-agenda-time-grid control if the grid is displayed

* lisp/org-agenda.el (org-agenda-list): ensures that the
list returned by org-agenda-add-time-grid-maybe is appended
to rtnall before checking if the latter is emtpy.

In the case where rtnall is empty (no item for current day),
we do not call org-agenda-add-time-grid-maybe.  This seems
bogus because that function is already computing whether the
time grid must be included, and does so according to the
user's preferences.

In particular, the org-agenda-time-grid variable has a
'require-timed' parameter controlling the visibility of the
time grid.

So, this patch :

 - removes the premature check for rtnall being empty,
 - inconditionally calls org-agenda-add-time-grid-maybe,
 - and finally checks the emptiness of the resulting list
   before pretty printing.

My previous patch had a bug (no need to append), please
do not consider it. I apologize for the noise.

TINYCHANGE
---
 lisp/org-agenda.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index cfd3e25..de555c0 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3886,10 +3886,10 @@ given in `org-agenda-start-on-weekday'."
 	    (put-text-property s (1- (point)) 'org-day-cnt day-cnt)
 	    (when todayp
 	      (put-text-property s (1- (point)) 'org-today t))
+	    (setq rtnall
+		  (org-agenda-add-time-grid-maybe rtnall ndays todayp))
 	    (if rtnall (insert ;; all entries
-			(org-finalize-agenda-entries
-			 (org-agenda-add-time-grid-maybe
-			  rtnall ndays todayp))
+			(org-finalize-agenda-entries rtnall)
 			"\n"))
 	    (put-text-property s (1- (point)) 'day d)
 	    (put-text-property s (1- (point)) 'org-day-cnt day-cnt))))
-- 
1.7.10.2.484.gcd07cc5

[-- Attachment #2: 0001-Let-org-agenda-time-grid-control-if-the-grid-is-disp.patch --]
[-- Type: text/x-patch, Size: 1902 bytes --]

From 5b1b0603ac72f8482c03596a4dadcc6692852503 Mon Sep 17 00:00:00 2001
From: Christophe Junke <christophe.junke@inria.fr>
Date: Fri, 25 May 2012 11:40:47 +0200
Subject: [PATCH] Let org-agenda-time-grid control if the grid is displayed

* lisp/org-agenda.el (org-agenda-list): ensures that the
list returned by org-agenda-add-time-grid-maybe is appended
to rtnall before checking if the latter is emtpy.

In the case where rtnall is empty (no item for current day),
we do not call org-agenda-add-time-grid-maybe.  This seems
bogus because that function is already computing whether the
time grid must be included, and does so according to the
user's preferences.

In particular, the org-agenda-time-grid variable has a
'require-timed' parameter controlling the visibility of the
time grid.

So, this patch :

 - removes the premature check for rtnall being empty,
 - inconditionally calls org-agenda-add-time-grid-maybe,
 - appends the result to rtnall,
 - and finally checks the emptiness of the resulting list
   before pretty printing.

TINYCHANGE
---
 lisp/org-agenda.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index cfd3e25..eebb66f 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3886,10 +3886,11 @@ given in `org-agenda-start-on-weekday'."
 	    (put-text-property s (1- (point)) 'org-day-cnt day-cnt)
 	    (when todayp
 	      (put-text-property s (1- (point)) 'org-today t))
+	    (setq rtnall
+		  (append rtnall
+			  (org-agenda-add-time-grid-maybe rtnall ndays todayp)))
 	    (if rtnall (insert ;; all entries
-			(org-finalize-agenda-entries
-			 (org-agenda-add-time-grid-maybe
-			  rtnall ndays todayp))
+			(org-finalize-agenda-entries rtnall)
 			"\n"))
 	    (put-text-property s (1- (point)) 'day d)
 	    (put-text-property s (1- (point)) 'org-day-cnt day-cnt))))
-- 
1.7.10.2.484.gcd07cc5


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

* Re: [PATCH] Let org-agenda-time-grid control if the grid is displayed
  2012-05-25 12:50 ` Christophe Junke
@ 2012-05-25 22:20   ` Bastien
  2012-05-26  2:14     ` Matt Lundin
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien @ 2012-05-25 22:20 UTC (permalink / raw)
  To: Christophe Junke; +Cc: emacs-orgmode

Hi Christophe,

Christophe Junke <christophe.junke@inria.fr> writes:

> Let org-agenda-time-grid control if the grid is displayed

Applied, thanks -- and special thanks for the ChangeLog and 
clear explanations.

All best,

-- 
 Bastien

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

* Re: [PATCH] Let org-agenda-time-grid control if the grid is displayed
  2012-05-25 22:20   ` Bastien
@ 2012-05-26  2:14     ` Matt Lundin
  2012-05-26  4:27       ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Matt Lundin @ 2012-05-26  2:14 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Christophe Junke

Bastien <bzg@gnu.org> writes:

> Christophe Junke <christophe.junke@inria.fr> writes:
>
>> Let org-agenda-time-grid control if the grid is displayed
>
> Applied, thanks -- and special thanks for the ChangeLog and 
> clear explanations.

This is a problematic patch. On my machine, it causes duplicate entries
to show up in the agenda. The reason, I believe, is because
org-agenda-add-time-grid-maybe takes the list of agenda items and
returns that list with time-grid stuff added. This patch appends the
list of agenda items to the list that org-agenda-add-time-grid-maybe
returns, thus resulting in the duplicates.

Best,
Matt

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

* Re: [PATCH] Let org-agenda-time-grid control if the grid is displayed
  2012-05-26  2:14     ` Matt Lundin
@ 2012-05-26  4:27       ` Bastien
  2012-05-28 16:02         ` Matt Lundin
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien @ 2012-05-26  4:27 UTC (permalink / raw)
  To: Matt Lundin; +Cc: emacs-orgmode, Christophe Junke

Hi Matt,

Matt Lundin <mdl@imapmail.org> writes:

> Bastien <bzg@gnu.org> writes:
>
>> Christophe Junke <christophe.junke@inria.fr> writes:
>>
>>> Let org-agenda-time-grid control if the grid is displayed
>>
>> Applied, thanks -- and special thanks for the ChangeLog and 
>> clear explanations.
>
> This is a problematic patch. On my machine, it causes duplicate entries
> to show up in the agenda. The reason, I believe, is because
> org-agenda-add-time-grid-maybe takes the list of agenda items and
> returns that list with time-grid stuff added. This patch appends the
> list of agenda items to the list that org-agenda-add-time-grid-maybe
> returns, thus resulting in the duplicates.

Mhh.. I've been testing too hastily.

Thanks for reporting this, I reverted the commit.

Christophe, can you look again and amend your patch if needed?

Thanks!

-- 
 Bastien

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

* Re: [PATCH] Let org-agenda-time-grid control if the grid is displayed
  2012-05-26  4:27       ` Bastien
@ 2012-05-28 16:02         ` Matt Lundin
  0 siblings, 0 replies; 8+ messages in thread
From: Matt Lundin @ 2012-05-28 16:02 UTC (permalink / raw)
  To: Bastien; +Cc: Christophe Junke, emacs-orgmode

Hi Bastien,

Bastien <bzg@altern.org> writes:

> Matt Lundin <mdl@imapmail.org> writes:

>> This is a problematic patch. On my machine, it causes duplicate entries
>> to show up in the agenda. The reason, I believe, is because
>> org-agenda-add-time-grid-maybe takes the list of agenda items and
>> returns that list with time-grid stuff added. This patch appends the
>> list of agenda items to the list that org-agenda-add-time-grid-maybe
>> returns, thus resulting in the duplicates.
>
> Mhh.. I've been testing too hastily.
>
> Thanks for reporting this, I reverted the commit.
>
> Christophe, can you look again and amend your patch if needed?

I just discovered that Christophe had posted an updated version of the
patch here:

http://permalink.gmane.org/gmane.emacs.orgmode/56323

Best,
Matt

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

* [PATCH] Let org-agenda-time-grid control if the grid is displayed
@ 2012-07-29  7:56 Christophe Junke
  2012-08-07 21:44 ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Christophe Junke @ 2012-07-29  7:56 UTC (permalink / raw)
  To: emacs-orgmode

* lisp/org-agenda.el (org-agenda-list): ensures that the
list returned by org-agenda-add-time-grid-maybe is appended
to rtnall before checking if the latter is emtpy.

In the case where rtnall is empty (no item for current day),
we do not call org-agenda-add-time-grid-maybe.  This seems
bogus because that function is already computing whether the
time grid must be included, and does so according to the
user's preferences.

In particular, the org-agenda-time-grid variable has a
'require-timed' parameter controlling the visibility of the
time grid.

So, this patch :

 - removes the premature check for rtnall being empty,
 - inconditionally calls org-agenda-add-time-grid-maybe,
 - and finally checks the emptiness of the resulting list
   before pretty printing.

TINYCHANGE
---
 lisp/org-agenda.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 59e55f7..d48a795 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3891,10 +3891,10 @@ given in `org-agenda-start-on-weekday'."
 	    (put-text-property s (1- (point)) 'org-day-cnt day-cnt)
 	    (when todayp
 	      (put-text-property s (1- (point)) 'org-today t))
+	    (setq rtnall
+		  (org-agenda-add-time-grid-maybe rtnall ndays todayp))
 	    (if rtnall (insert ;; all entries
-			(org-finalize-agenda-entries
-			 (org-agenda-add-time-grid-maybe
-			  rtnall ndays todayp))
+			(org-finalize-agenda-entries rtnall)
 			"\n"))
 	    (put-text-property s (1- (point)) 'day d)
 	    (put-text-property s (1- (point)) 'org-day-cnt day-cnt))))
-- 
1.7.12.rc0.83.g8dd846e

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

* Re: [PATCH] Let org-agenda-time-grid control if the grid is displayed
  2012-07-29  7:56 [PATCH] Let org-agenda-time-grid control if the grid is displayed Christophe Junke
@ 2012-08-07 21:44 ` Bastien
  0 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2012-08-07 21:44 UTC (permalink / raw)
  To: Christophe Junke; +Cc: emacs-orgmode

Hi Christophe,

Christophe Junke <junke.christophe@gmail.com> writes:

> * lisp/org-agenda.el (org-agenda-list): ensures that the
> list returned by org-agenda-add-time-grid-maybe is appended
> to rtnall before checking if the latter is emtpy.

I've now applied this patch.  

Thanks for the clear explanations and the changelog.

-- 
 Bastien

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

end of thread, other threads:[~2012-08-07 21:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-29  7:56 [PATCH] Let org-agenda-time-grid control if the grid is displayed Christophe Junke
2012-08-07 21:44 ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2012-05-25 12:33 Christophe Junke
2012-05-25 12:50 ` Christophe Junke
2012-05-25 22:20   ` Bastien
2012-05-26  2:14     ` Matt Lundin
2012-05-26  4:27       ` Bastien
2012-05-28 16:02         ` Matt Lundin

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).