help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to track down "invalid face attribute" errors?


From: Felix Dietrich
Subject: Re: how to track down "invalid face attribute" errors?
Date: Tue, 27 Sep 2022 13:12:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

Robert Pluim <rpluim@gmail.com> writes:

> On Mon, 26 Sep 2022 10:04:09 +0100, Eric S Fraga <e.fraga@ucl.ac.uk> said:
>
>> On Sunday, 25 Sep 2022 at 15:00, Emanuel Berg wrote:
>>
>>> Sounds like that error message should be changed to include
>>> what face causes trouble, if possible?
>
> I think youʼre looking for the `debug-on-message' variable, since this
> is a log in *Messages*, not an error.

Would this work in this case?  The variable ‘debug-on-message’ seems to
be handled in the C-function ‘set_message’ which, on a cursory glance, I
cannot see being called from ‘add_to_log’ or below.  Therefore,
‘debug-on-message’ may be bypassed in this case here.

> (If you have a reproducer, we can look at changing the message)

Here is one:

#+begin_src emacs-lisp
  (let ((buf (generate-new-buffer "*test*"))
        (s (propertize "Hello World" 'face '(:foreground nil))))
    (with-current-buffer buf
      (insert s))
    (display-buffer buf))
#+end_src

Upon evaluation, the resulting output in the “*Messages*” buffer also
shows another issues with a missing newline between messages (in Emacs
28.1 at least).

#+begin_example
#<window 54 on *test*<2>>Invalid face attribute :foreground nil
Invalid face attribute :foreground nil
#+end_example

Maybe a value of nil for the :foreground attribute in an anonymous face
should be handled the same way as it is in a face defined with
‘defface’, that is being treated as the symbol ‘unspecified’?

#+begin_src emacs-lisp
  (progn
    (defface my/test '((t . (:foreground nil))) "test face")
    (face-attribute 'my/test :foreground))
#+end_src

#+RESULTS:
: unspecified


-- 
Felix Dietrich



reply via email to

[Prev in Thread] Current Thread [Next in Thread]