From: Felix Dietrich <felix.dietrich@sperrhaken.name>
To: 58312@debbugs.gnu.org
Subject: bug#58312: Improve “Invalid face attribute” error message
Date: Wed, 05 Oct 2022 20:42:28 +0200 [thread overview]
Message-ID: <87czb6p0x7.fsf@sperrhaken.name> (raw)
Package: emacs
Severity: wishlist
Could the log message “Invalid face attribute” created by
“xfaces.c:merge_face_ref” be extended to also include the buffer or
other identifying information about its origin? This request is
motivated by a recent issue posted to the help-gnu-emacs list [1].
When Emacs encounters an anonymous face with an invalid face attribute
value in a buffer, it will write a log entry to the “*Messages*” buffer.
This message takes the form “Invalid face attribute ATTRIBUTE VALUE” and
lacks any information that would allow easy identification of the
invalid faceʼs place of origin. The log entry is induced by the
function “xfaces.c:merge_face_ref”. This function takes as its first
argument a “struct window” which could potentially be used to retrieve
the causing buffer using its “contents” member (note, though, that it
may be NULL).
Here is a snippet that will cause the “Invalid face attribute” message
to be written to the “*Messages*” buffer when evaluated:
#+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
#+begin_example
#<window 54 on *test*<2>>Invalid face attribute :foreground nil
Invalid face attribute :foreground nil
#+end_example
Two things I noticed exploring the issue:
1. the value I use in the above example for the :foreground attribute
nil is handled specially in “xfaces.c:internal-set-lisp-face-attribute”
(accompanied by a comment stating “Compatibility with 20.x.”): it is
changed to ‘unspecified’, but in “xfaces.c:merge_face_ref” nil is
considered an error;
2. there is a newline missing between the log entries for the result of
the evaluation and the error entries in the “*Messages*” buffer. This
is bug #58311 <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58311>.
Footnotes:
[1] From: Eric S Fraga
Subject: how to track down "invalid face attribute" errors?
Date: Sun, 25 Sep 2022 13:03:03 +0100
Message-ID: <87k05rr79k.fsf@ucl.ac.uk>
<https://lists.gnu.org/archive/html/help-gnu-emacs/2022-09/msg00415.html>
--
Felix Dietrich
next reply other threads:[~2022-10-05 18:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-05 18:42 Felix Dietrich [this message]
2022-10-06 12:44 ` bug#58312: Improve “Invalid face attribute” error message Lars Ingebrigtsen
2024-01-10 10:50 ` Stefan Kangas
2024-01-10 13:38 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87czb6p0x7.fsf@sperrhaken.name \
--to=felix.dietrich@sperrhaken.name \
--cc=58312@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.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).