all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* New face: org-agenda-calendar-timerange
@ 2022-12-22 16:56 Gautier Ponsinet
  2023-01-17 11:20 ` Ihor Radchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Gautier Ponsinet @ 2022-12-22 16:56 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello everyone,

I would like to propose the introduction of a new face:
org-agenda-calendar-timerange.
It is used to show entries with a timerange in the agenda, that is,
entries with a timestamp of the form:
<2022-12-22 Thu>--<2023-01-01 Sun>
At the moment, these entries with a timerange use the default face.
Please find attached a patch.

This is my first contribution (I just finished the copyright assignment
process with the FSF), so any feedback would be greatly appreciated.

In particular, could someone confirm that the function
org-agenda-get-blocks is the right place to apply the face? I place it
there mimicking how the faces org-agenda-calendar-event and
org-agenda-calendar-sexp are applied but I am not sure of this.

All the best,
Gautier.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Define-the-face-org-agenda-calendar-timerange.patch --]
[-- Type: text/x-patch, Size: 2205 bytes --]

From 31f2c3fc0ed93a100ccf18472cb44e2434d3060f Mon Sep 17 00:00:00 2001
From: Gautier Ponsinet <gautier@gautierponsinet.xyz>
Date: Fri, 16 Sep 2022 22:14:11 +0200
Subject: [PATCH] Define the face org-agenda-calendar-timerange

The face org-agenda-calendar-timerange is used to show entries with a
timerange in the agenda.
---
 etc/ORG-NEWS       | 5 +++++
 lisp/org-agenda.el | 2 +-
 lisp/org-faces.el  | 4 ++++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index a4e54dc41..d7f6ba846 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -27,6 +27,11 @@ backend delegates listing generation to another package like
 ,#+LATEX_HEADER: \DefineVerbatimEnvironment{lstlisting}{Verbatim}{...whatever...}
 #+END_src
 
+*** New face: ~org-agenda-calendar-timerange~
+The face ~org-agenda-calendar-timerange~ is used to show entries with
+a timerange in the agenda.  It inherits from the default face in order
+to remain backward-compatible.
+
 * Version 9.6
 
 ** Important announcements and breaking changes
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 05f2e3669..6f7a2c19c 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7059,7 +7059,7 @@ scheduled items with an hour specification like [h]h:mm."
 (defun org-agenda-get-blocks ()
   "Return the date-range information for agenda display."
   (with-no-warnings (defvar date))
-  (let* ((props (list 'face nil
+  (let* ((props (list 'face 'org-agenda-calendar-timerange
 		      'org-not-done-regexp org-not-done-regexp
 		      'org-todo-regexp org-todo-regexp
 		      'org-complex-heading-regexp org-complex-heading-regexp
diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index 0effa13a1..a6143cd21 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
@@ -668,6 +668,10 @@ month and 365.24 days for a year)."
   "Face used to show events computed from a S-expression."
   :group 'org-faces)
 
+(defface org-agenda-calendar-timerange '((t :inherit default))
+  "Face used to show entries with a timerange in the agenda."
+  :group 'org-faces)
+
 (defconst org-level-faces
   '(org-level-1 org-level-2 org-level-3 org-level-4
 		org-level-5 org-level-6 org-level-7 org-level-8))
-- 
2.39.0


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

* Re: New face: org-agenda-calendar-timerange
  2022-12-22 16:56 New face: org-agenda-calendar-timerange Gautier Ponsinet
@ 2023-01-17 11:20 ` Ihor Radchenko
  2023-01-17 22:25   ` gautier
  0 siblings, 1 reply; 15+ messages in thread
From: Ihor Radchenko @ 2023-01-17 11:20 UTC (permalink / raw)
  To: Gautier Ponsinet, Bastien; +Cc: emacs-orgmode

Gautier Ponsinet <gautier@gautierponsinet.xyz> writes:

> I would like to propose the introduction of a new face:
> org-agenda-calendar-timerange.
> It is used to show entries with a timerange in the agenda, that is,
> entries with a timestamp of the form:
> <2022-12-22 Thu>--<2023-01-01 Sun>
> At the moment, these entries with a timerange use the default face.
> Please find attached a patch.

Thanks!

"timerange" is a bit confusing because the patch will only affect date
ranges like <2022-12-22 Thu>--<2023-01-01 Sun> and
<2022-12-22 Thu 12:00>--<2023-01-01 Sun 10:00>, but not time ranges
<2022-12-22 Thu 10:00-12:00>

Is it what you are proposing? Or do you also want to include the time ranges?

> This is my first contribution (I just finished the copyright assignment
> process with the FSF), so any feedback would be greatly appreciated.

Bastien, could you please confirm?


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: New face: org-agenda-calendar-timerange
  2023-01-17 11:20 ` Ihor Radchenko
@ 2023-01-17 22:25   ` gautier
  2023-01-18 10:08     ` Ihor Radchenko
  0 siblings, 1 reply; 15+ messages in thread
From: gautier @ 2023-01-17 22:25 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien, emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> "timerange" is a bit confusing because the patch will only affect date
> ranges like <2022-12-22 Thu>--<2023-01-01 Sun> and
> <2022-12-22 Thu 12:00>--<2023-01-01 Sun 10:00>, but not time ranges
> <2022-12-22 Thu 10:00-12:00>
> 
> Is it what you are proposing? Or do you also want to include the time 
> ranges?


Hello Ihor,

Currently, the entries with a time range of the form
<2022-12-22 Thu 10:00-12:00>
use the face 'org-agenda-calendar-event'.
While the entries with time ranges of the form
<2022-12-22 Thu>--<2023-01-01 Sun>, or
<2022-12-22 Thu 12:00>--<2023-01-01 Sun 10:00>, or even
<2023-01-01 Sun 10:00>--<2023-01-01 Sun 15:00>
use the default face.

The face in the patch would apply to the second type of entries. These
second type of entries are precisely the ones to which applies the
'org-agenda-timerange-leaders', this is why I have chosen the name
"org-agenda-calendar-timerange". Another name would be fine though,
maybe "daterange" instead of "timerange"? (However, it would be less
consistent with the 'org-agenda-timerange-leaders' name or the last
example <2023-01-01 Sun 10:00>--<2023-01-01 Sun 15:00>.)

All the best,
Gautier.


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

* Re: New face: org-agenda-calendar-timerange
  2023-01-17 22:25   ` gautier
@ 2023-01-18 10:08     ` Ihor Radchenko
  2023-01-18 15:41       ` gautier
  0 siblings, 1 reply; 15+ messages in thread
From: Ihor Radchenko @ 2023-01-18 10:08 UTC (permalink / raw)
  To: gautier; +Cc: Bastien, emacs-orgmode

gautier@gautierponsinet.xyz writes:

> Currently, the entries with a time range of the form
> <2022-12-22 Thu 10:00-12:00>
> use the face 'org-agenda-calendar-event'.
> While the entries with time ranges of the form
> <2022-12-22 Thu>--<2023-01-01 Sun>, or
> <2022-12-22 Thu 12:00>--<2023-01-01 Sun 10:00>, or even
> <2023-01-01 Sun 10:00>--<2023-01-01 Sun 15:00>
> use the default face.

So, the current situation is already not consistent.

<2023-01-01 Sun 10:00>--<2023-01-01 Sun 15:00>
and
<2023-01-01 Sun 10:00-15:00>

are equivalent.

I'd say that it will make sense to apply `org-agenda-calendar-event'
face and `org-agenda-timerange-leaders' to <2023-01-01 Sun 10:00-15:00>
as well. What do you think about this approach?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: New face: org-agenda-calendar-timerange
  2023-01-18 10:08     ` Ihor Radchenko
@ 2023-01-18 15:41       ` gautier
  2023-01-18 16:01         ` gautier
  2023-01-19 11:00         ` Ihor Radchenko
  0 siblings, 2 replies; 15+ messages in thread
From: gautier @ 2023-01-18 15:41 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien, emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> <2023-01-01 Sun 10:00>--<2023-01-01 Sun 15:00>
> and
> <2023-01-01 Sun 10:00-15:00>
> 
> are equivalent.
> 
> I'd say that it will make sense to apply `org-agenda-calendar-event'
> face and `org-agenda-timerange-leaders' to <2023-01-01 Sun 10:00-15:00>
> as well. What do you think about this approach?

So, the current situation is the following:

| Type of entry                                                          
     | Face                      | Use `org-agenda-timerange-leaders' |
|----------------------------------------------------------------------------+---------------------------+------------------------------------|
| simple date: <2023-01-01 Sun>                                          
     | org-agenda-calendar-event | no                                 |
| simple date with hour range: <2023-01-01 Sun 10:00-15:00>              
     | org-agenda-calendar-event | no                                 |
| timerange (same day): <2023-01-01 Sun 10:00>--<2023-01-01 Sun 15:00>   
     | default                   | yes                                |
| timerange (different days): <2023-01-01 Sun 10:00>--<2023-01-18 Wed 
15:00> | default                   | yes                                
|

and you say it would be better like this:

| Type of entry                                                          
     | Face                                      | Use 
`org-agenda-timerange-leaders' |
|----------------------------------------------------------------------------+-------------------------------------------+------------------------------------|
| simple date: <2023-01-01 Sun>                                          
     | org-agenda-calendar-event                 | no                     
             |
| simple date with hour range: <2023-01-01 Sun 10:00-15:00>              
     | org-agenda-calendar-event                 | yes                    
             |
| timerange (same day): <2023-01-01 Sun 10:00>--<2023-01-01 Sun 15:00>   
     | org-agenda-calendar-event                 | yes                    
             |
| timerange (different days): <2023-01-01 Sun 10:00>--<2023-01-18 Wed 
15:00> | new face (org-agenda-calendar-daterange?) | yes                 
                |

Is that correct?

This would be nice. However, this requires more complexes changes. I
don't know if I am capable of preparing such a patch, but I can give it
a try.

By the way, the entries "simple date with hour range" and "timerange (on
the same day)" are also presented differently in the agenda view, the
first ones look like:
   agenda:     10:00-15:00 Test simple date with hour range
while the second ones look like:
   agenda:     10:00 ┄┄┄┄┄ Test timerange (on the same day)

Should this change as well?


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

* Re: New face: org-agenda-calendar-timerange
  2023-01-18 15:41       ` gautier
@ 2023-01-18 16:01         ` gautier
  2023-01-19 11:00         ` Ihor Radchenko
  1 sibling, 0 replies; 15+ messages in thread
From: gautier @ 2023-01-18 16:01 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien, emacs-orgmode

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

The tables in my last message were not send correctly.
Please find attached a org file containing the tables.

[-- Attachment #2: tables.org --]
[-- Type: text/plain, Size: 2075 bytes --]

So, the current situation is the following:

| Type of entry                                                              | Face                      | Use `org-agenda-timerange-leaders' |
|----------------------------------------------------------------------------+---------------------------+------------------------------------|
| simple date: <2023-01-01 Sun>                                              | org-agenda-calendar-event | no                                 |
| simple date with hour range: <2023-01-01 Sun 10:00-15:00>                  | org-agenda-calendar-event | no                                 |
| timerange (same day): <2023-01-01 Sun 10:00>--<2023-01-01 Sun 15:00>       | default                   | yes                                |
| timerange (different days): <2023-01-01 Sun 10:00>--<2023-01-18 Wed 15:00> | default                   | yes                                |
|                                                                            |                           |                                    |

and you say it would be better like this:

| Type of entry                                                              | Face                                      | Use `org-agenda-timerange-leaders' |
|----------------------------------------------------------------------------+-------------------------------------------+------------------------------------|
| simple date: <2023-01-01 Sun>                                              | org-agenda-calendar-event                 | no                                 |
| simple date with hour range: <2023-01-01 Sun 10:00-15:00>                  | org-agenda-calendar-event                 | yes                                |
| timerange (same day): <2023-01-01 Sun 10:00>--<2023-01-01 Sun 15:00>       | org-agenda-calendar-event                 | yes                                |
| timerange (different days): <2023-01-01 Sun 10:00>--<2023-01-18 Wed 15:00> | new face (org-agenda-calendar-daterange?) | yes                                |

Is that correct?

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

* Re: New face: org-agenda-calendar-timerange
  2023-01-18 15:41       ` gautier
  2023-01-18 16:01         ` gautier
@ 2023-01-19 11:00         ` Ihor Radchenko
  2023-01-19 21:58           ` gautier
  1 sibling, 1 reply; 15+ messages in thread
From: Ihor Radchenko @ 2023-01-19 11:00 UTC (permalink / raw)
  To: gautier; +Cc: Bastien, emacs-orgmode

gautier@gautierponsinet.xyz writes:

> So, the current situation is the following:
> ...
> Is that correct?

Yes. "simple date with hour range" should be displayed the same with
"timerange (same day)", including faces and begin/end time being
displayed together.

It will be the most consistent.

>
> By the way, the entries "simple date with hour range" and "timerange (on
> the same day)" are also presented differently in the agenda view, the
> first ones look like:
>    agenda:     10:00-15:00 Test simple date with hour range
> while the second ones look like:
>    agenda:     10:00 ┄┄┄┄┄ Test timerange (on the same day)
>
> Should this change as well?

Yes, if you can.

> This would be nice. However, this requires more complexes changes. I
> don't know if I am capable of preparing such a patch, but I can give it
> a try.

Applying faces should be easier. You may just add code applying
`org-agenda-calendar-event' face when timestamp is within a single day
to `org-agenda-get-blocks'. See d1 and d2 variables. They store
start/end date.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: New face: org-agenda-calendar-timerange
  2023-01-19 11:00         ` Ihor Radchenko
@ 2023-01-19 21:58           ` gautier
  2023-01-20  3:32             ` Ruijie Yu via General discussions about Org-mode.
  2023-01-20 11:24             ` Ihor Radchenko
  0 siblings, 2 replies; 15+ messages in thread
From: gautier @ 2023-01-19 21:58 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien, emacs-orgmode

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

Please find attached a patch containing two commits.
The first one applies the face `org-agenda-calendar-event' to entries
with a time range within a single day.
The second one defines the new face `org-agenda-calendar-daterange'
and applies it to entries with a time range on several days. (The
second commit assumes the first one is already applied.)

Since I am still learning elisp and this is my first contribution, it
would be very nice if someone could double check the patch, and any
feedback would be very welcome.

I will look into the other points we have discussed so far later on.

By the way, while trying to understand the code I have discovered the
commit "cb19f5c94e3dc94da78169ec675d5bd07af34427" by Bastien which I
don't really understand. The commit message says, talking about
entries with a timerange:
"* lisp/org-agenda.el (org-agenda-get-blocks): When both dates are of
the same value, assume this is a time to display for each date in the
range."

It seems to me that this should be done by creating repeating tasks
rather than an entry with a timerange, because suppose I want to put
in my agenda an event spanning on several days including the precise
hours at which it starts and ends but which starts and ends on the
same hour, for example an entry with the following timerange:

<2023-01-19 jeu. 12:00>--<2023-01-26 jeu. 12:00> .

In this case, it makes no sense to print the time "12:00" everyday in
the range. I would expect the agenda to show the event on each days it
is, the time at which the event starts on the first day, and the time
at which the event ends on the last day. Does that make sense?

All the best,
Gautier.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: agenda-timerange-faces.patch --]
[-- Type: text/x-diff; name=agenda-timerange-faces.patch, Size: 4896 bytes --]

From e3feebdf3596645d28d66c1baf6296bcaedf1f42 Mon Sep 17 00:00:00 2001
From: Gautier Ponsinet <gautier@gautierponsinet.xyz>
Date: Thu, 19 Jan 2023 21:34:37 +0100
Subject: [PATCH 1/2] org-agenda: Apply the face `org-agenda-calendar-event'

* list/org-agenda.el (org-agenda-get-blocks): Apply the face
  `org-agenda-calendar-event' to entries with a time range within a
  single day.
---
 lisp/org-agenda.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index d983a0916..4f29f3eb6 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7059,8 +7059,7 @@ scheduled items with an hour specification like [h]h:mm."
 (defun org-agenda-get-blocks ()
   "Return the date-range information for agenda display."
   (with-no-warnings (defvar date))
-  (let* ((props (list 'face nil
-		      'org-not-done-regexp org-not-done-regexp
+  (let* ((props (list 'org-not-done-regexp org-not-done-regexp
 		      'org-todo-regexp org-todo-regexp
 		      'org-complex-heading-regexp org-complex-heading-regexp
 		      'mouse-face 'highlight
@@ -7069,9 +7068,9 @@ scheduled items with an hour specification like [h]h:mm."
 			      (abbreviate-file-name buffer-file-name))))
 	 (regexp org-tr-regexp)
 	 (d0 (calendar-absolute-from-gregorian date))
-	 marker hdmarker ee txt d1 d2 s1 s2 category
-	 level todo-state tags pos head donep inherited-tags
-         effort effort-minutes)
+         face marker hdmarker ee txt d1 d2 s1 s2 category level
+	 todo-state tags pos head donep inherited-tags effort
+	 effort-minutes)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (catch :skip
@@ -7109,6 +7108,9 @@ scheduled items with an hour specification like [h]h:mm."
 	      (setq donep (member todo-state org-done-keywords))
 	      (when (and donep org-agenda-skip-timestamp-if-done)
 		(throw :skip t))
+              (setq face (if (= d1 d2)
+                             'org-agenda-calendar-event
+                           nil))
 	      (setq marker (org-agenda-new-marker (point))
 		    category (org-get-category))
               (setq effort (save-match-data (or (get-text-property (point) 'effort)
@@ -7160,6 +7162,7 @@ scheduled items with an hour specification like [h]h:mm."
 					(concat "<" end-time ">")))))
 			     remove-re))))
 	      (org-add-props txt props
+                'face face
 		'org-marker marker 'org-hd-marker hdmarker
 		'type "block" 'date date
 		'level level
-- 
2.39.1


From 5dc50a84ab6adc1765eaf5bf3cf3c670df69f355 Mon Sep 17 00:00:00 2001
From: Gautier Ponsinet <gautier@gautierponsinet.xyz>
Date: Thu, 19 Jan 2023 22:18:12 +0100
Subject: [PATCH 2/2] Define the face `org-agenda-calendar-daterange'

* etc/ORG-NEWS: Announce the introduction of the new face
  `org-agenda-calendar-daterange'.
* lisp/org-faces.el: Define the face `org-agenda-calendar-daterange'.
* lisp/org-agenda.el (org-agenda-get-blocks): Apply the face
  `org-agenda-calendar-daterange' to entries with a date range.
---
 etc/ORG-NEWS       | 5 +++++
 lisp/org-agenda.el | 2 +-
 lisp/org-faces.el  | 4 ++++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index c5d9bdf6e..613b32408 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -55,6 +55,11 @@ document header:
 ,#+LATEX_HEADER: \DefineVerbatimEnvironment{lstlisting}{Verbatim}{...whatever...}
 #+END_src
 
+*** New face: ~org-agenda-calendar-daterange~
+The face ~org-agenda-calendar-daterange~ is used to show entries with
+a date range in the agenda.  It inherits from the default face in
+order to remain backward-compatible.
+
 * Version 9.6
 
 ** Important announcements and breaking changes
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 4f29f3eb6..15736e5b8 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7110,7 +7110,7 @@ scheduled items with an hour specification like [h]h:mm."
 		(throw :skip t))
               (setq face (if (= d1 d2)
                              'org-agenda-calendar-event
-                           nil))
+                           'org-agenda-calendar-daterange))
 	      (setq marker (org-agenda-new-marker (point))
 		    category (org-get-category))
               (setq effort (save-match-data (or (get-text-property (point) 'effort)
diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index 594c9a6e7..b3f8e419c 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
@@ -660,6 +660,10 @@ month and 365.24 days for a year)."
   "Face used for agenda entries that come from the Emacs diary."
   :group 'org-faces)
 
+(defface org-agenda-calendar-daterange '((t :inherit default))
+  "Face used to show entries with a date range in the agenda."
+  :group 'org-faces)
+
 (defface org-agenda-calendar-event '((t :inherit default))
   "Face used to show events and appointments in the agenda."
   :group 'org-faces)
-- 
2.39.1


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

* Re: New face: org-agenda-calendar-timerange
  2023-01-19 21:58           ` gautier
@ 2023-01-20  3:32             ` Ruijie Yu via General discussions about Org-mode.
  2023-01-20  4:24               ` Ruijie Yu via General discussions about Org-mode.
  2023-01-20 11:24             ` Ihor Radchenko
  1 sibling, 1 reply; 15+ messages in thread
From: Ruijie Yu via General discussions about Org-mode. @ 2023-01-20  3:32 UTC (permalink / raw)
  To: gautier; +Cc: Ihor Radchenko, Bastien, emacs-orgmode

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


gautier@gautierponsinet.xyz writes:

> Please find attached a patch containing two commits.
>
> [...]
>
> It seems to me that this should be done by creating repeating tasks
> rather than an entry with a timerange, because suppose I want to put
> in my agenda an event spanning on several days including the precise
> hours at which it starts and ends but which starts and ends on the
> same hour, for example an entry with the following timerange:
>
> <2023-01-19 jeu. 12:00>--<2023-01-26 jeu. 12:00> .

Slight tangent, it seems that this time range has French abbreviations,
is there any resource I can take a look to find recognized abbreviations
for each language that I am interested in?


> In this case, it makes no sense to print the time "12:00" everyday in
> the range. I would expect the agenda to show the event on each days it
> is, the time at which the event starts on the first day, and the time
> at which the event ends on the last day. Does that make sense?

I agree, this is what I am used to with other calendar programs for
displaying multi-day events.  For the in-between days, maybe these
events should be shown as full-day events?

> All the best,
> Gautier.

> From e3feebdf3596645d28d66c1baf6296bcaedf1f42 Mon Sep 17 00:00:00 2001
> From: Gautier Ponsinet <gautier@gautierponsinet.xyz>
> Date: Thu, 19 Jan 2023 21:34:37 +0100
> Subject: [PATCH 1/2] org-agenda: Apply the face `org-agenda-calendar-event'
>
> * list/org-agenda.el (org-agenda-get-blocks): Apply the face
>   `org-agenda-calendar-event' to entries with a time range within a
>   single day.
> ---
>  lisp/org-agenda.el | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index d983a0916..4f29f3eb6 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> [...]
> @@ -7109,6 +7108,9 @@ scheduled items with an hour specification like [h]h:mm."
>         (setq donep (member todo-state org-done-keywords))
>         (when (and donep org-agenda-skip-timestamp-if-done)
>       (throw :skip t))
> +              (setq face (if (= d1 d2)
> +                             'org-agenda-calendar-event
> +                           nil))
>         (setq marker (org-agenda-new-marker (point))
>           category (org-get-category))
>                (setq effort (save-match-data (or (get-text-property (point) 'effort)
> [...]
> --
> 2.39.1

I see an (if cond then nil) construct.   Not that it matters for the
entire patch, since the else case is updated in the second commit, but I
want to use this opportunity to fulfill my longstanding curiosity on
lisp styles.  For cases where the "else" branch is nil, I have seen the
following three types of constructs:

1. (if cond then nil) -- like this commit
2. (and cond then) -- what I have heard people prefer and have started to adopt
3. (if cond then) -- I found this construct in various patches and source files

Do people prefer one over the other two, and why?

> From 5dc50a84ab6adc1765eaf5bf3cf3c670df69f355 Mon Sep 17 00:00:00 2001
> From: Gautier Ponsinet <gautier@gautierponsinet.xyz>
> Date: Thu, 19 Jan 2023 22:18:12 +0100
> Subject: [PATCH 2/2] Define the face `org-agenda-calendar-daterange'
> [...]
> --
> 2.39.1

The patch applies cleanly on current main branch (52f29d4da), and all
tests from `make test` passed.  However, I don't see any effects on a
test org buffer (see attached) -- in particular, I don't see the
`org-agenda-calendar-daterange' face being shown anywhere on the buffer.
According to `C-u C-x =' (`what-cursor-position'), all three date ranges
use `org-date' face.

$ git am this.patch
$ make test
$ emacs -Q -L lisp -l org agenda.org
(type `C-u C-x =' on each date range to see `org-date')


[-- Attachment #2: test org file --]
[-- Type: text/plain, Size: 238 bytes --]

* Multi-Day Range <2023-01-20 Fri 13:00>--<2023-01-23 Mon 13:00>
description

* Same-Day Multi-Stamp Range <2023-01-21 Sat 13:00>-<2023-01-21 Sat 15:00>
description

* Same-Day Single-Stamp Range <2023-01-21 Sat 13:00-15:00>
description


[-- Attachment #3: Type: text/plain, Size: 113 bytes --]


Thoughts?  Will do the same on the original main branch to ensure I
didn't misunderstand something.

Best,


RY

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

* Re: New face: org-agenda-calendar-timerange
  2023-01-20  3:32             ` Ruijie Yu via General discussions about Org-mode.
@ 2023-01-20  4:24               ` Ruijie Yu via General discussions about Org-mode.
  0 siblings, 0 replies; 15+ messages in thread
From: Ruijie Yu via General discussions about Org-mode. @ 2023-01-20  4:24 UTC (permalink / raw)
  To: gautier; +Cc: Ihor Radchenko, Bastien, emacs-orgmode


Ruijie Yu <ruijie@netyu.xyz> writes:
> [...]
> The patch applies cleanly on current main branch (52f29d4da), and all
> tests from `make test` passed.  However, I don't see any effects on a
> test org buffer (see attached) -- in particular, I don't see the
> `org-agenda-calendar-daterange' face being shown anywhere on the buffer.
> According to `C-u C-x =' (`what-cursor-position'), all three date ranges
> use `org-date' face.
>
> $ git am this.patch
> $ make test
> $ emacs -Q -L lisp -l org agenda.org
> (type `C-u C-x =' on each date range to see `org-date')
>
> Thoughts?  Will do the same on the original main branch to ensure I
> didn't misunderstand something.

Took another look at the previous mails and at the variable name, and I
realized that this change is for things under org-agenda, in which case
all three types of ranges are under their respective, correct faces.

Best,


RY


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

* Re: New face: org-agenda-calendar-timerange
  2023-01-19 21:58           ` gautier
  2023-01-20  3:32             ` Ruijie Yu via General discussions about Org-mode.
@ 2023-01-20 11:24             ` Ihor Radchenko
  2023-01-20 11:36               ` Bastien Guerry
  1 sibling, 1 reply; 15+ messages in thread
From: Ihor Radchenko @ 2023-01-20 11:24 UTC (permalink / raw)
  To: gautier; +Cc: Bastien, emacs-orgmode

gautier@gautierponsinet.xyz writes:

> Please find attached a patch containing two commits.
> The first one applies the face `org-agenda-calendar-event' to entries
> with a time range within a single day.
> The second one defines the new face `org-agenda-calendar-daterange'
> and applies it to entries with a time range on several days. (The
> second commit assumes the first one is already applied.)
>
> Since I am still learning elisp and this is my first contribution, it
> would be very nice if someone could double check the patch, and any
> feedback would be very welcome.

The patch looks good.
Now, just waiting for confirmation from Bastien about your copyright
status records.

> By the way, while trying to understand the code I have discovered the
> commit "cb19f5c94e3dc94da78169ec675d5bd07af34427" by Bastien which I
> don't really understand. The commit message says, talking about
> entries with a timerange:
> "* lisp/org-agenda.el (org-agenda-get-blocks): When both dates are of
> the same value, assume this is a time to display for each date in the
> range."
>
> It seems to me that this should be done by creating repeating tasks
> rather than an entry with a timerange, because suppose I want to put
> in my agenda an event spanning on several days including the precise
> hours at which it starts and ends but which starts and ends on the
> same hour, for example an entry with the following timerange:
>
> <2023-01-19 jeu. 12:00>--<2023-01-26 jeu. 12:00> .

AFAIU, the commit fixed a different scenario:
https://orgmode.org/list/BYAPR07MB573496C31816FE64B71E9D70A5CD0@BYAPR07MB5734.namprd07.prod.outlook.com

<2019-08-05 Mon 08:30-11:00>--<2019-08-09 Fri 08:30-11:00>

(which is, by the way, is not a proper time range, according to Org syntax)

Bastien, the commit asserts that when time parts of the timestamp range
are equal, treat them as repeating event, like <2019-08-05 Mon 08:30-11:00 +1d>
However, when there is an actual date range as in Gautier's example,
things are broken.

I am inclined to revert your commit because the original bug report was
trying to make Org use timestamp format, Org does not really recognize.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: New face: org-agenda-calendar-timerange
  2023-01-20 11:24             ` Ihor Radchenko
@ 2023-01-20 11:36               ` Bastien Guerry
  2023-01-21  8:27                 ` Ihor Radchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Bastien Guerry @ 2023-01-20 11:36 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: gautier, emacs-orgmode

Hi,

Ihor Radchenko <yantar92@posteo.net> writes:

> Now, just waiting for confirmation from Bastien about your copyright
> status records.

Yes, I confirme Gautier's FSF copyright record is in order.

> AFAIU, the commit fixed a different scenario:
> https://orgmode.org/list/BYAPR07MB573496C31816FE64B71E9D70A5CD0@BYAPR07MB5734.namprd07.prod.outlook.com
>
> <2019-08-05 Mon 08:30-11:00>--<2019-08-09 Fri 08:30-11:00>
>
> (which is, by the way, is not a proper time range, according to Org
> syntax)

I agree we should not allow this syntax from David's initial example.

> Bastien, the commit asserts that when time parts of the timestamp range
> are equal, treat them as repeating event, like <2019-08-05 Mon 08:30-11:00 +1d>
> However, when there is an actual date range as in Gautier's example,
> things are broken.
>
> I am inclined to revert your commit because the original bug report was
> trying to make Org use timestamp format, Org does not really
> recognize.

Yes, please do. Thanks!

-- 
 Bastien


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

* Re: New face: org-agenda-calendar-timerange
  2023-01-20 11:36               ` Bastien Guerry
@ 2023-01-21  8:27                 ` Ihor Radchenko
  2023-01-21  8:29                   ` Ihor Radchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Ihor Radchenko @ 2023-01-21  8:27 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: gautier, emacs-orgmode

Bastien Guerry <bzg@gnu.org> writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> Now, just waiting for confirmation from Bastien about your copyright
>> status records.
>
> Yes, I confirme Gautier's FSF copyright record is in order.

Added to the contributor list:
https://git.sr.ht/~bzg/worg/commit/b8096c5a

Now, I can apply the patch.
Applied, onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a0a30d7b6
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=cb73633e2

>> I am inclined to revert your commit because the original bug report was
>> trying to make Org use timestamp format, Org does not really
>> recognize.
>
> Yes, please do. Thanks!

Done.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a7e910646

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: New face: org-agenda-calendar-timerange
  2023-01-21  8:27                 ` Ihor Radchenko
@ 2023-01-21  8:29                   ` Ihor Radchenko
  2023-01-21 22:44                     ` Gautier Ponsinet
  0 siblings, 1 reply; 15+ messages in thread
From: Ihor Radchenko @ 2023-01-21  8:29 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: gautier, emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a0a30d7b6
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=cb73633e2
> ...
> Done.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a7e910646

Sorry, messed up the commit hashes.
Should be:

https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=22dea8557
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=84ead47d3

https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f2320a2cc

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: New face: org-agenda-calendar-timerange
  2023-01-21  8:29                   ` Ihor Radchenko
@ 2023-01-21 22:44                     ` Gautier Ponsinet
  0 siblings, 0 replies; 15+ messages in thread
From: Gautier Ponsinet @ 2023-01-21 22:44 UTC (permalink / raw)
  To: Ihor Radchenko, Bastien Guerry; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:
> Added to the contributor list:
> https://git.sr.ht/~bzg/worg/commit/b8096c5a
>
[ 4 more citation lines. Click/Enter to show. ]
> Now, I can apply the patch.
> Applied, onto main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a0a30d7b6
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=cb73633e2

> Done.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a7e910646

Great! Thanks Ihor & Bastien!

All the best,
Gautier.


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

end of thread, other threads:[~2023-01-21 22:45 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-22 16:56 New face: org-agenda-calendar-timerange Gautier Ponsinet
2023-01-17 11:20 ` Ihor Radchenko
2023-01-17 22:25   ` gautier
2023-01-18 10:08     ` Ihor Radchenko
2023-01-18 15:41       ` gautier
2023-01-18 16:01         ` gautier
2023-01-19 11:00         ` Ihor Radchenko
2023-01-19 21:58           ` gautier
2023-01-20  3:32             ` Ruijie Yu via General discussions about Org-mode.
2023-01-20  4:24               ` Ruijie Yu via General discussions about Org-mode.
2023-01-20 11:24             ` Ihor Radchenko
2023-01-20 11:36               ` Bastien Guerry
2023-01-21  8:27                 ` Ihor Radchenko
2023-01-21  8:29                   ` Ihor Radchenko
2023-01-21 22:44                     ` Gautier Ponsinet

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.