emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ruijie Yu via "General discussions about Org-mode." <emacs-orgmode@gnu.org>
To: gautier@gautierponsinet.xyz
Cc: Ihor Radchenko <yantar92@posteo.net>, Bastien <bzg@gnu.org>,
	emacs-orgmode@gnu.org
Subject: Re: New face: org-agenda-calendar-timerange
Date: Fri, 20 Jan 2023 11:32:49 +0800	[thread overview]
Message-ID: <sdv4jsldeii.fsf@fw.net.yu> (raw)
In-Reply-To: <12a8d2e8b36fb5c6f61a2b084e22a7b8@gautierponsinet.xyz>

[-- 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

  reply	other threads:[~2023-01-20  4:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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. [this message]
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

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=sdv4jsldeii.fsf@fw.net.yu \
    --to=emacs-orgmode@gnu.org \
    --cc=bzg@gnu.org \
    --cc=gautier@gautierponsinet.xyz \
    --cc=ruijie@netyu.xyz \
    --cc=yantar92@posteo.net \
    /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).