all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Felix Dietrich <felix.dietrich@sperrhaken.name>
Cc: Eric S Fraga <e.fraga@ucl.ac.uk>,  help-gnu-emacs@gnu.org
Subject: Re: how to track down "invalid face attribute" errors?
Date: Tue, 27 Sep 2022 16:08:27 +0200	[thread overview]
Message-ID: <87ill89ag4.fsf@gmail.com> (raw)
In-Reply-To: <87r0zxm5pv.fsf@sperrhaken.name> (Felix Dietrich's message of "Tue, 27 Sep 2022 13:12:12 +0200")

>>>>> On Tue, 27 Sep 2022 13:12:12 +0200, Felix Dietrich <felix.dietrich@sperrhaken.name> said:

    Felix> 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.

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

In that case gdb and something like this

gdb emacs
> b add_to_log
> commands
> bt
> c
> end
> run

add_to_log is not called that often, so this shouldnʼt create too much
output.

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

    Felix> Here is one:

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

Thereʼs no actual face there for Emacs to log, what the low-level code
receives is "(:foreground nil)"

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

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

Itʼs still there in emacs-29, but itʼs deep in the guts of the elisp
engine, so I havenʼt found exactly where it comes from.

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

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

    Felix> #+RESULTS:
    Felix> : unspecified

There was recently a long thread about this on emacs-devel, which I
didnʼt read :-) It might be worth suggesting this there.

Robert
-- 



  reply	other threads:[~2022-09-27 14:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-25 12:03 how to track down "invalid face attribute" errors? Eric S Fraga
2022-09-25 13:00 ` Emanuel Berg
2022-09-26  9:04   ` Eric S Fraga
2022-09-26  9:40     ` Robert Pluim
2022-09-26  9:50       ` Fraga, Eric
2022-09-27 11:12       ` Felix Dietrich
2022-09-27 14:08         ` Robert Pluim [this message]
2022-10-05 12:32           ` Felix Dietrich
2022-10-05 13:31             ` Robert Pluim
2022-10-05 13:51             ` Eli Zaretskii
2022-10-06 14:58               ` Felix Dietrich
2022-09-28 11:41   ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-09-28 15:04     ` Robert Pluim
2022-09-29 16:32     ` Emanuel Berg
2022-10-03 19:19       ` Felix Dietrich
2022-10-03 22:46         ` Emanuel Berg
2022-10-04 11:06         ` Felix Dietrich
2022-10-05 11:29           ` Felix Dietrich
2022-09-25 14:01 ` Eli Zaretskii
2022-09-25 15:53   ` Eric S Fraga
2022-09-25 16:06     ` Eli Zaretskii
2022-09-25 17:20       ` Eric S Fraga
2022-09-25 14:26 ` Felix Dietrich
2022-09-25 15:51   ` Fraga, Eric

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ill89ag4.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=e.fraga@ucl.ac.uk \
    --cc=felix.dietrich@sperrhaken.name \
    --cc=help-gnu-emacs@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.