From e3feebdf3596645d28d66c1baf6296bcaedf1f42 Mon Sep 17 00:00:00 2001 From: Gautier Ponsinet 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 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