GNU bug report logs - #58312
Improve “Invalid face attribute” error message

Previous Next

Package: emacs;

Reported by: Felix Dietrich <felix.dietrich <at> sperrhaken.name>

Date: Wed, 5 Oct 2022 18:43:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 58312 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#58312; Package emacs. (Wed, 05 Oct 2022 18:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Felix Dietrich <felix.dietrich <at> sperrhaken.name>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 05 Oct 2022 18:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Felix Dietrich <felix.dietrich <at> sperrhaken.name>
To: bug-gnu-emacs <at> gnu.org
Subject: Improve “Invalid face attribute” error message
Date: Wed, 05 Oct 2022 20:42:28 +0200
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 <at> ucl.ac.uk>

     <https://lists.gnu.org/archive/html/help-gnu-emacs/2022-09/msg00415.html>

-- 
Felix Dietrich




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58312; Package emacs. (Thu, 06 Oct 2022 12:45:02 GMT) Full text and rfc822 format available.

Message #8 received at 58312 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Felix Dietrich <felix.dietrich <at> sperrhaken.name>
Cc: 58312 <at> debbugs.gnu.org
Subject: Re: bug#58312: Improve “Invalid face
 attribute” error message
Date: Thu, 06 Oct 2022 14:44:39 +0200
Felix Dietrich <felix.dietrich <at> sperrhaken.name> writes:

> 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?

Perhaps include the window name?  That would be less ambiguous than the
buffer name.





Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 06 Oct 2022 12:45:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58312; Package emacs. (Wed, 10 Jan 2024 10:52:02 GMT) Full text and rfc822 format available.

Message #13 received at 58312 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Felix Dietrich <felix.dietrich <at> sperrhaken.name>, Po Lu <luangruo <at> yahoo.com>,
 eliz <at> gnu.org, 58312 <at> debbugs.gnu.org
Subject: Re: bug#58312: Improve “Invalid face attribute” error message
Date: Wed, 10 Jan 2024 02:50:46 -0800
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Felix Dietrich <felix.dietrich <at> sperrhaken.name> writes:
>
>> 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?
>
> Perhaps include the window name?  That would be less ambiguous than the
> buffer name.

That makes sense to me.  Eli or Po Lu, WDYT about this change?




Removed tag(s) moreinfo. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 10 Jan 2024 10:52:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58312; Package emacs. (Wed, 10 Jan 2024 13:48:02 GMT) Full text and rfc822 format available.

Message #18 received at 58312 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: felix.dietrich <at> sperrhaken.name, luangruo <at> yahoo.com, larsi <at> gnus.org,
 58312 <at> debbugs.gnu.org
Subject: Re: bug#58312: Improve “Invalid face
 attribute” error message
Date: Wed, 10 Jan 2024 15:38:00 +0200
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Wed, 10 Jan 2024 02:50:46 -0800
> Cc: Felix Dietrich <felix.dietrich <at> sperrhaken.name>, 58312 <at> debbugs.gnu.org, eliz <at> gnu.org, 
> 	Po Lu <luangruo <at> yahoo.com>
> 
> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> 
> > Felix Dietrich <felix.dietrich <at> sperrhaken.name> writes:
> >
> >> 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?
> >
> > Perhaps include the window name?  That would be less ambiguous than the
> > buffer name.
> 
> That makes sense to me.  Eli or Po Lu, WDYT about this change?

Patches welcome, but please take into account the fact that the window
is not always known there: merge_face_ref can be called with its first
argument NULL.




This bug report was last modified 1 year and 159 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.