emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] "Invalid face reference" with org-agenda-deadline-faces
@ 2024-01-10 16:44 Mark Kerr
  2024-01-10 18:01 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Kerr @ 2024-01-10 16:44 UTC (permalink / raw)
  To: emacs-orgmode

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

I have the below set in my init file:
---
(setq org-agenda-deadline-faces
  '((1.01 . org-agenda-deadline-past)
     (1.0 . org-agenda-deadline-today)
     (0.9 . org-agenda-deadline-tomorrow)
     (0.7 . org-agenda-deadline-soon)
     (0.0 . org-agenda-deadline-upcoming)))
---

But the faces are not created and the below lines keep appearing in
*Messages*:
---
Invalid face reference: org-agenda-deadline-today [6 times]
Invalid face reference: org-agenda-deadline-past [19 times]
---

`describe-face` says `[No match]` when run on any of these agenda deadline
faces. `describe-face` does work with the default faces though, i.e.
`org-imminent-deadline`.

However, running `describe-variable` on `org-agenda-deadline-faces`
indicates that the value is correct:
```
Value:
((1.01 . org-agenda-deadline-past)
  (1.0 . org-agenda-deadline-today)
  (0.9 . org-agenda-deadline-tomorrow)
  (0.7 . org-agenda-deadline-soon)
  (0.0 . org-agenda-deadline-upcoming))
Original value was
((1.0 . org-imminent-deadline)
  (0.5 . org-upcoming-deadline)
  (0.0 . org-upcoming-distant-deadline))
```
Turning on `debug-on-error` does nothing when the messages are generated.

This `org-agenda-deadline-faces` settings has been working without any
problems for years. I think the problem began with org v6.6.16, but am not
completely certain.

Is this a bug?

Thanks, Mark

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

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

* Re: [BUG] "Invalid face reference" with org-agenda-deadline-faces
  2024-01-10 16:44 [BUG] "Invalid face reference" with org-agenda-deadline-faces Mark Kerr
@ 2024-01-10 18:01 ` Ihor Radchenko
       [not found]   ` <CAM9qJ5+D9a8-KHorWLScRjqH9eOsvRjM+RrVMKqqi4q31EuBFQ@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2024-01-10 18:01 UTC (permalink / raw)
  To: Mark Kerr; +Cc: emacs-orgmode

Mark Kerr <mkerr23@gmail.com> writes:

> I have the below set in my init file:
> ---
> (setq org-agenda-deadline-faces
>   '((1.01 . org-agenda-deadline-past)
>      (1.0 . org-agenda-deadline-today)
>      (0.9 . org-agenda-deadline-tomorrow)
>      (0.7 . org-agenda-deadline-soon)
>      (0.0 . org-agenda-deadline-upcoming)))
> ---
>
> But the faces are not created and the below lines keep appearing in
> *Messages*:
> ---
> Invalid face reference: org-agenda-deadline-today [6 times]
> Invalid face reference: org-agenda-deadline-past [19 times]
> ---

These two faces have nothing to do with Org mode. Org mode simply does
not define such faces and never did (I cannot find these face names in
git history). In fact, Org mode does not define any of the faces in you
custom value.

> This `org-agenda-deadline-faces` settings has been working without any
> problems for years. I think the problem began with org v6.6.16, but am not
> completely certain.
>
> Is this a bug?

I am not sure what you mean by "working" - incorrect faces could have
been ignored by older Emacs. Newer Emacs indicate the problem with
invalid faces.

Canceled.

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

* Re: [BUG] "Invalid face reference" with org-agenda-deadline-faces
       [not found]   ` <CAM9qJ5+D9a8-KHorWLScRjqH9eOsvRjM+RrVMKqqi4q31EuBFQ@mail.gmail.com>
@ 2024-01-10 18:48     ` Ihor Radchenko
       [not found]       ` <CAM9qJ5JipoBHbANGAOz2+c_4yRaAZ2keUJn2DnGOWSOW-90hVg@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2024-01-10 18:48 UTC (permalink / raw)
  To: Mark Kerr; +Cc: emacs-orgmode

Mark Kerr <mkerr23@gmail.com> writes:

>> > Invalid face reference: org-agenda-deadline-today [6 times]
>> > Invalid face reference: org-agenda-deadline-past [19 times]
>> > ---
>>
>> These two faces have nothing to do with Org mode. Org mode simply does
>> not define such faces and never did (I cannot find these face names in
>> git history). In fact, Org mode does not define any of the faces in you
>> custom value.
>>
> I understand that, but the whole point of 'org-agenda-deadline-faces'  is
> that it  allows you to create *new faces*. So of course those user-defined
> faces wouldn't be in the code.

> For example, you could create a custom face called "deadline50" for any
> todo's whose deadline warning time has elapsed by 50%, and change it's face
> color to indicate that state in the agenda.
>
> From the docs for org-agenda-deadline-faces:
> Faces for showing deadlines in the agenda. This is a list of cons cells.
> The cdr of each cell is a face to be used, and it can also just be like
> (:foreground "yellow"). Each car is a fraction of the head-warning time
> that must have passed for this the face in the cdr to be used for display.
> The numbers must be
> given in descending order.  The head-warning time is normally taken from
> ‘org-deadline-warning-days’, but can also be specified in the deadline
> timestamp itself.

>> This `org-agenda-deadline-faces` settings has been working without any
>> > problems for years. I think the problem began with org v6.6.16, but am
>> not
>> > completely certain.
>>
>> I am not sure what you mean by "working" - incorrect faces could have
>> been ignored by older Emacs. Newer Emacs indicate the problem with
>> invalid faces.
>
> By "working", I mean that my 'org-agenda-deadline-faces' settings have
> functioned as described in the documentation for years.
>
> In other words , my custom faces were created  and appeared in the agenda
> with the attributes I specified at the time I specified.

Faces that you reference from org-agenda-deadline-faces should exist and
should be valid faces. However, it does not look like your
`org-agenda-deadline-past' and `org-agenda-deadline-today' faces are
defined correctly. You might have used malformed face declaration.

May you show how you define these custom faces in your config?

>> Canceled.
>> --
>> Ihor Radchenko // yantar92,
>
> I don't think this should be cancelled at this point, since the reasoning
> was based upon an incorrect assumption of how org-agenda-deadline-faces
> works.

I do not see any problem in how org-agenda handles this variable. I
suspect that the problem is in your config.

If you think that the problem is on Org side, please provide a minimal
reproducer starting from emacs -Q. See
https://orgmode.org/manual/Feedback.html#Feedback

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

* Re: [BUG] "Invalid face reference" with org-agenda-deadline-faces
       [not found]       ` <CAM9qJ5JipoBHbANGAOz2+c_4yRaAZ2keUJn2DnGOWSOW-90hVg@mail.gmail.com>
@ 2024-01-10 20:01         ` Ihor Radchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-01-10 20:01 UTC (permalink / raw)
  To: Mark Kerr; +Cc: emacs-orgmode

[ Adding org-mode mailing list back to CC.
  Please use "Reply All" or "Wide reply" to
  keep the discussion public ]

Mark Kerr <mkerr23@gmail.com> writes:

>> Faces that you reference from org-agenda-deadline-faces should exist and
>> should be valid faces. However, it does not look like your
>> `org-agenda-deadline-past' and `org-agenda-deadline-today' faces are
>> defined correctly. You might have used malformed face declaration.
>>
>> May you show how you define these custom faces in your config?
>
> I included my configuration in my initial post. Here it is:
>
> (setq org-agenda-deadline-faces
>   '((1.01 . org-agenda-deadline-past)
>      (1.0 . org-agenda-deadline-today)
>      (0.9 . org-agenda-deadline-tomorrow)
>      (0.7 . org-agenda-deadline-soon)
>      (0.0 . org-agenda-deadline-upcoming)))

This is not complete. I wanted to see how you define
`org-agenda-deadline-today' and `org-agenda-deadline-past' faces. They
are not standard faces provided by Org mode, so you need to define them
yourself.

> What is it about the `org-agenda-deadline-past' and
> `org-agenda-deadline-today' faces that makes you think they are incorrectly
> defined?

"Invalid face reference" error means exactly this - the face it
complains about is not a valid face.

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

end of thread, other threads:[~2024-01-10 19:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-10 16:44 [BUG] "Invalid face reference" with org-agenda-deadline-faces Mark Kerr
2024-01-10 18:01 ` Ihor Radchenko
     [not found]   ` <CAM9qJ5+D9a8-KHorWLScRjqH9eOsvRjM+RrVMKqqi4q31EuBFQ@mail.gmail.com>
2024-01-10 18:48     ` Ihor Radchenko
     [not found]       ` <CAM9qJ5JipoBHbANGAOz2+c_4yRaAZ2keUJn2DnGOWSOW-90hVg@mail.gmail.com>
2024-01-10 20:01         ` 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).