emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-agenda-dim-blocked-tasks don't use org-todo face
@ 2022-12-12  6:14 Mark Kerr
  2022-12-12  9:59 ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Kerr @ 2022-12-12  6:14 UTC (permalink / raw)
  To: emacs-orgmode

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

The org-todo face is used for todo keywords in non-blocked items.

When org-agenda-dim-blocked-tasks is set to true, however, the todo keyword
is instead displayed using org-agenda-dimmed-todo-face.

The org-priority face, however, is still used for blocked tasks.

Is this by design or due to an error on my part? Is there a possible
workaround?

[-- Attachment #2: Type: text/html, Size: 475 bytes --]

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

* Re: org-agenda-dim-blocked-tasks don't use org-todo face
  2022-12-12  6:14 org-agenda-dim-blocked-tasks don't use org-todo face Mark Kerr
@ 2022-12-12  9:59 ` Ihor Radchenko
  2022-12-17  9:54   ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2022-12-12  9:59 UTC (permalink / raw)
  To: Mark Kerr; +Cc: emacs-orgmode

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

Mark Kerr <mkerr23@gmail.com> writes:

> The org-todo face is used for todo keywords in non-blocked items.
>
> When org-agenda-dim-blocked-tasks is set to true, however, the todo keyword
> is instead displayed using org-agenda-dimmed-todo-face.
>
> The org-priority face, however, is still used for blocked tasks.
>
> Is this by design or due to an error on my part? Is there a possible
> workaround?

This appears to be an omission on Org part, related some overlay
implementation details in Emacs.

Can you try the attached patch?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-agenda-dim-blocked-tasks-Prioritize-face-over-ot.patch --]
[-- Type: text/x-patch, Size: 1422 bytes --]

From 1bd6d8bd13deb9e7f57826ea492bbc88fddf5ee3 Mon Sep 17 00:00:00 2001
Message-Id: <1bd6d8bd13deb9e7f57826ea492bbc88fddf5ee3.1670839095.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Mon, 12 Dec 2022 12:56:11 +0300
Subject: [PATCH] org-agenda-dim-blocked-tasks: Prioritize face over other
 overlays

* lisp/org-agenda.el (org-agenda-dim-blocked-tasks): Use high overlays
priority when adding dimmed face.  Otherwise, contained overlays, like
created by `org-agenda-fontify-priorities', will take
priority (default Emacs behavior).

Reported-by: Mark Kerr <mkerr23@gmail.com>
Link: https://orgmode.org/list/CAM9qJ5+C3nvbNaJyq6ofRgPsuAMcaBD=2UN-n96Kb68NBbX3Dg@mail.gmail.com
---
 lisp/org-agenda.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index eda248938..05f2e3669 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4166,7 +4166,9 @@ (defun org-agenda-dim-blocked-tasks (&optional _invisible)
 				   (line-beginning-position))
 				 (line-end-position))))
 	  (when todo-blocked
-	    (overlay-put ov 'face 'org-agenda-dimmed-todo-face))
+	    (overlay-put ov 'face 'org-agenda-dimmed-todo-face)
+            ;; Override other overlays.
+            (overlay-put ov 'priority 50))
 	  (when invisible
 	    (org-agenda-filter-hide-line 'todo-blocked)))
         (if (= (point-max) (line-end-position))
-- 
2.38.1


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


-- 
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 related	[flat|nested] 7+ messages in thread

* Re: org-agenda-dim-blocked-tasks don't use org-todo face
@ 2022-12-12 19:02 Mark Kerr
  2022-12-13  7:51 ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Kerr @ 2022-12-12 19:02 UTC (permalink / raw)
  To: yantar92; +Cc: emacs-orgmode, Mark Kerr

From: Ihor Radchenko <yantar92@posteo.net>

> [-- Attachment #1: Type: text/plain, Size: 534 bytes --]
>
> Mark Kerr <mkerr23@gmail.com> writes:
>
> > The org-todo face is used for todo keywords in non-blocked items.
> >
> > When org-agenda-dim-blocked-tasks is set to true, however, the todo keyword
> > is instead displayed using org-agenda-dimmed-todo-face.
> >
> > The org-priority face, however, is still used for blocked tasks.
> >
> > Is this by design or due to an error on my part? Is there a possible
> > workaround?
>
> This appears to be an omission on Org part, related some overlay
> implementation details in Emacs.
>
> Can you try the attached patch?
>
>
> [-- Warning: decoded text below may be mangled, UTF-8 assumed --]
> [-- Attachment #2: 0001-org-agenda-dim-blocked-tasks-Prioritize-face-over-ot.patch --]
> [-- Type: text/x-patch, Size: 1422 bytes --]
>
> From 1bd6d8bd13deb9e7f57826ea492bbc88fddf5ee3 Mon Sep 17 00:00:00 2001
> Message-Id: <1bd6d8bd13deb9e7f57826ea492bbc88fddf5ee3.1670839095.git.yantar92@posteo.net>
> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Mon, 12 Dec 2022 12:56:11 +0300
> Subject: [PATCH] org-agenda-dim-blocked-tasks: Prioritize face over other
>  overlays
>
> * lisp/org-agenda.el (org-agenda-dim-blocked-tasks): Use high overlays
> priority when adding dimmed face.  Otherwise, contained overlays, like
> created by `org-agenda-fontify-priorities', will take
> priority (default Emacs behavior).
>
> Reported-by: Mark Kerr <mkerr23@gmail.com>
> Link: https://orgmode.org/list/CAM9qJ5+C3nvbNaJyq6ofRgPsuAMcaBD=2UN-n96Kb68NBbX3Dg@mail.gmail.com
> ---
>  lisp/org-agenda.el | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index eda248938..05f2e3669 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -4166,7 +4166,9 @@ (defun org-agenda-dim-blocked-tasks (&optional _invisible)
>     (line-beginning-position))
>   (line-end-position))))
>    (when todo-blocked
> -    (overlay-put ov 'face 'org-agenda-dimmed-todo-face))
> +    (overlay-put ov 'face 'org-agenda-dimmed-todo-face)
> +            ;; Override other overlays.
> +            (overlay-put ov 'priority 50))
>    (when invisible
>      (org-agenda-filter-hide-line 'todo-blocked)))
>          (if (= (point-max) (line-end-position))
> --
> 2.38.1
>
>
> [-- Attachment #3: Type: text/plain, Size: 224 bytes --]
>
>
> --
> 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>


This is my first time applying a patch, so I hope I did it properly.

Thank you. I may have been unclear but the result seems to be the
opposite of what I was hoping for.

I was hoping to be able to gain the ability to use the org-todo face
with blocked tasks, while retaining the org-priority face which was
previously working..

Now blocked tasks are entirely rendered with
org-agenda-dimmed-todo-face, including the priority.

In case I messed up the patch, here is the patched function:

--
(defun org-agenda-dim-blocked-tasks (&optional _invisible)
  "Dim currently blocked TODOs in the agenda display.
When INVISIBLE is non-nil, hide currently blocked TODO instead of
dimming them."                   ;FIXME: The arg isn't used, actually!
  (interactive "P")
  (when (called-interactively-p 'interactive)
    (message "Dim or hide blocked tasks..."))
  (dolist (o (overlays-in (point-min) (point-max)))
    (when (eq (overlay-get o 'face) 'org-agenda-dimmed-todo-face)
      (delete-overlay o)))
  (save-excursion
    (let ((inhibit-read-only t))
      (goto-char (point-min))
      (while (let ((pos (text-property-not-all
(point) (point-max) 'org-todo-blocked nil)))
      (when pos (goto-char pos)))
(let* ((invisible
(eq (org-get-at-bol 'org-todo-blocked) 'invisible))
      (todo-blocked
(eq (org-get-at-bol 'org-filter-type) 'todo-blocked))
      (ov (make-overlay (if invisible
    (line-end-position 0)
  (line-beginning-position))
(line-end-position))))
 (when todo-blocked
   (overlay-put ov 'face 'org-agenda-dimmed-todo-face)
            ;; Override other overlays.
            (overlay-put ov 'priority 50))
 (when invisible
   (org-agenda-filter-hide-line 'todo-blocked)))
        (if (= (point-max) (line-end-position))
            (goto-char (point-max))
 (move-beginning-of-line 2)))))
  (when (called-interactively-p 'interactive)
    (message "Dim or hide blocked tasks...done")))
--

Thank you, Mark


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

* Re: org-agenda-dim-blocked-tasks don't use org-todo face
  2022-12-12 19:02 Mark Kerr
@ 2022-12-13  7:51 ` Ihor Radchenko
  2022-12-14 21:11   ` Mark Kerr
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2022-12-13  7:51 UTC (permalink / raw)
  To: Mark Kerr; +Cc: emacs-orgmode

Mark Kerr <mkerr23@gmail.com> writes:

> Thank you. I may have been unclear but the result seems to be the
> opposite of what I was hoping for.
>
> I was hoping to be able to gain the ability to use the org-todo face
> with blocked tasks, while retaining the org-priority face which was
> previously working..
>
> Now blocked tasks are entirely rendered with
> org-agenda-dimmed-todo-face, including the priority.

What you observe is what I intended to do.

What you want is an opposite of "dimming" (IMHO).

To achieve what you want, you may consider customizing
`org-agenda-dimmed-todo-face' face. This face is applied on top of all
other faces. If you, say, set only a background, the todo keywords will
retain their foreground colour.

-- 
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] 7+ messages in thread

* Re: org-agenda-dim-blocked-tasks don't use org-todo face
  2022-12-13  7:51 ` Ihor Radchenko
@ 2022-12-14 21:11   ` Mark Kerr
  2022-12-15  8:43     ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Kerr @ 2022-12-14 21:11 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

On Tue, Dec 13, 2022 at 2:51 AM Ihor Radchenko <yantar92@posteo.net> wrote:
>
> Mark Kerr <mkerr23@gmail.com> writes:
>
> > Thank you. I may have been unclear but the result seems to be the
> > opposite of what I was hoping for.
> >
> > I was hoping to be able to gain the ability to use the org-todo face
> > with blocked tasks, while retaining the org-priority face which was
> > previously working..
> >
> > Now blocked tasks are entirely rendered with
> > org-agenda-dimmed-todo-face, including the priority.
>
> What you observe is what I intended to do.
>
> What you want is an opposite of "dimming" (IMHO).
>
> To achieve what you want, you may consider customizing
> `org-agenda-dimmed-todo-face' face. This face is applied on top of all
> other faces. If you, say, set only a background, the todo keywords will
> retain their foreground colour.
>
> --
> 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>

I understand your viewpoint,  Ihor. Actually, it was mainly the font
size of the TODO keyword that I wanted to retain, not the colour.

The org-agenda-dimmed-todo-face overlay overrides the size set in
org-todo face, which breaks my layout.

I would like to retain the org-todo face colour as well, but it is
mainly the face size that causes me issues.

I have been fiddling with the face and overlay rules, but my knowledge
is not up to the task. From what I can tell, overlays always overwrite
faces.

I was thinking that a version of org-font-lock-add-priority-faces
could perhaps be adapted to work with todo keywords.


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

* Re: org-agenda-dim-blocked-tasks don't use org-todo face
  2022-12-14 21:11   ` Mark Kerr
@ 2022-12-15  8:43     ` Ihor Radchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Ihor Radchenko @ 2022-12-15  8:43 UTC (permalink / raw)
  To: Mark Kerr; +Cc: emacs-orgmode

Mark Kerr <mkerr23@gmail.com> writes:

> I understand your viewpoint,  Ihor. Actually, it was mainly the font
> size of the TODO keyword that I wanted to retain, not the colour.
>
> The org-agenda-dimmed-todo-face overlay overrides the size set in
> org-todo face, which breaks my layout.

It should not, by default.
If it is, please try to reproduce the problem starting from emacs -Q, so
that I can see what is ha penning using my Emacs.

> I have been fiddling with the face and overlay rules, but my knowledge
> is not up to the task. From what I can tell, overlays always overwrite
> faces.

No, they do not. Overlays apply their faces on top of text properties
and on top of overlays with lower priority.

"On top" means that only face attributes that are "specified" are
overwritten. `org-agenda-dimmed-todo-face' only overwrites :foreground
by default.

Note, however, that your Emacs theme might change this. You can examine
the output of M-x describe-face <RET> org-agenda-dimmed-todo-face <RET>.
Pay attention to "Inherit", if any. The attributes of inherited faces
are also considered.

-- 
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] 7+ messages in thread

* Re: org-agenda-dim-blocked-tasks don't use org-todo face
  2022-12-12  9:59 ` Ihor Radchenko
@ 2022-12-17  9:54   ` Ihor Radchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Ihor Radchenko @ 2022-12-17  9:54 UTC (permalink / raw)
  To: Mark Kerr; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> From 1bd6d8bd13deb9e7f57826ea492bbc88fddf5ee3 Mon Sep 17 00:00:00 2001
> Message-Id: <1bd6d8bd13deb9e7f57826ea492bbc88fddf5ee3.1670839095.git.yantar92@posteo.net>
> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Mon, 12 Dec 2022 12:56:11 +0300
> Subject: [PATCH] org-agenda-dim-blocked-tasks: Prioritize face over other
>  overlays

Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=751de0212

-- 
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] 7+ messages in thread

end of thread, other threads:[~2022-12-17  9:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12  6:14 org-agenda-dim-blocked-tasks don't use org-todo face Mark Kerr
2022-12-12  9:59 ` Ihor Radchenko
2022-12-17  9:54   ` Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2022-12-12 19:02 Mark Kerr
2022-12-13  7:51 ` Ihor Radchenko
2022-12-14 21:11   ` Mark Kerr
2022-12-15  8:43     ` Ihor Radchenko

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