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: Wed, 05 Oct 2022 13:29:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

Felix Dietrich <felix.dietrich@sperrhaken.name> writes:

> Felix Dietrich <felix.dietrich@sperrhaken.name> writes:
>
>> Emanuel Berg <incal@dataswamp.org> writes:
>>
>>> Isn't it better to initialize the faces first, and if it is
>>> attempted to define [a face] using invalid attributes, then that
>>> would be an error?
>>
>> This already happens to a degree for named faces: if you use ‘defface’
>> to create a face with :foreground set to nil, subsequent calls to
>> ‘face-attribute’ for :foreground on that face will return ‘unspecified’:
>>
>> #+begin_src emacs-lisp
>>   (progn
>>     (defface my/test '((t . (:foreground nil))) "test face")
>>     (face-attribute 'my/test :foreground))
>> #+end_src
>
> I was not correct with my assumption: when you ‘defface’ a face with an
> invalid :foreground value this will produce an error, but enough of the
> face with the invalid value remains that later creations of new frames
> using ‘make-frame-command’ will fail with that same error:
>
> #+begin_src emacs-lisp
>   (progn
>     (ignore-errors
>       (defface my/test03 '((t . (:foreground nil))) "test face"))
>     (make-frame-command))
> #+end_src
>
> This produces the error “(wrong-type-argument stringp :bla)”.

I copied the wrong snippet from my experiments.  It should have been
this:

#+begin_src emacs-lisp
  (progn
    (ignore-errors
      (defface my/test '((t . (:foreground :bla))) "test face"))
    (make-frame-command))
#+end_src

-- 
Felix Dietrich



reply via email to

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