From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Felix Dietrich Newsgroups: gmane.emacs.help Subject: Re: how to track down "invalid face attribute" errors? Date: Wed, 05 Oct 2022 14:32:04 +0200 Message-ID: <87a66acuyj.fsf@sperrhaken.name> References: <87k05rr79k.fsf@ucl.ac.uk> <87czbjpq1c.fsf@dataswamp.org> <87v8pawlpy.fsf@ucl.ac.uk> <87sfkea2yw.fsf@gmail.com> <87r0zxm5pv.fsf@sperrhaken.name> <87ill89ag4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36418"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Robert Pluim Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 05 14:37:00 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1og3dz-0009IF-Nt for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 05 Oct 2022 14:36:59 +0200 Original-Received: from localhost ([::1]:51618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1og3dt-0006Yg-MJ for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 05 Oct 2022 08:36:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1og3ZO-0006XO-8M for help-gnu-emacs@gnu.org; Wed, 05 Oct 2022 08:32:14 -0400 Original-Received: from mout.kundenserver.de ([212.227.17.10]:40081) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1og3ZM-0006N7-Ah for help-gnu-emacs@gnu.org; Wed, 05 Oct 2022 08:32:14 -0400 Original-Received: from localhost ([77.11.160.112]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MEVmm-1oR9LH1ltq-00Fz7p; Wed, 05 Oct 2022 14:32:09 +0200 X-Provags-ID: V03:K1:dHySyqNrX4y/y3sV1D9KBYOLicizZufAKSM+Uwi+9QKnmLJf5M+ vrKAVOpbcyN8+CZFgAFZCDWhryRffELiPIhtmSvbOy5ARYSJVsdsNqC6Q01IkFgsFJg6oG0 RmElra7SAF0d8ZqA2LliXxpfBGNqrlrl4c3kZht91IoDqJY2bN1qpB/HA4PN9030gLXkESe sAwl61hdCKOA/hCMK2XLg== X-UI-Out-Filterresults: notjunk:1;V03:K0:2eTHbajyuzg=:FGLDAijQk33ggK+RBTdQtL b/hwxEwYLRSSlf1IX3jaBVx5VBPkSCUzA7oq5CqIElXToCDWgZm7eATAoFhLgLYgY+VyUZeqm YX2Hn3MYrnSg5b2THspx/8GtRZZUvf0/xsAi6qUUTSXMVRgOCAWIYUM3O4j/pZS8N6ys0upOn gBaf5pd9ky7a2mHvIrLZnjiNuZMOGTnPhRMgiOBDxyhXZOTr34dUEyCOt6AN32R+UpMS5SG29 eugFe3ywp+JZ8lsK30+OZ2izDF9LaMx/QoN9/Laj6spoDlRwuAoswOSbchuO5g8erfXW4bm9+ ixDREA/RlbN/UHekEOkIcGTSQny79l/I8BbmlcIg6m1xzx8NqfE6jkXc/tSXwKNbACt1X1AVZ 9B5+z9onNxVY0cQF1imP+E7Xh9YiVNad8980PFcH0QhlPlO0Gu8RWi9hk4T3uVYd6mlam6U5g bLiFo46NiC5EENHV5dKiO9a4qfG5U66CjLzNjLeNCpINp9jHJorIQJdXDVJDwCJz7n9It72du 683odgTaJCisio/lz6XLo3Gqx7IghjrkWtmdYfWjyPWaGmHcZFyZeHAXSnRJUu/5GDQp7sAbc 6CbiRZMXN6+G+iMOenVG0DpUcpjLc65gxdvNWTQgQoZCn7hmqjdZE0qmgGFW2S2j/W6Pzud+q 6fKeRREXKu6VNcpvdPFQg6D79584HEIu1XKNHDf7hOGLHY7Jf6kuy9euArGzyl1QTiKUq2zzh p54Tbv2JczsX81xqiM/SsFv76ynEKkw3j0/aadFG62paYCI9AzMtA1ANw6GacYy3GSDsFVxc Received-SPF: none client-ip=212.227.17.10; envelope-from=felix.dietrich@sperrhaken.name; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:139716 Archived-At: Hello Robert, Emanuel Berg writes: > > Eric S Fraga writes: > >> some package I'm using is leading to errors of the form >>=20 >> Invalid face attribute :foreground nil [54 times] >>=20 >> can anybody suggest how I can track down which package/function is >> causing this? Debugging on error doesn't catch this. > > Sounds like that error message should be changed to include > what face causes trouble, if possible? Robert Pluim writes: > > Felix Dietrich writes: > >> Robert Pluim writes: >>> >>> (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 > > There=CA=BCs no actual face there for Emacs to log, what the low-level co= de > receives is "(:foreground nil)" But =E2=80=9Cxfaces.c:merge_face_ref=E2=80=9D (which produces the error mes= sage) has a =E2=80=9Cstruct window w=E2=80=9D parameter. I believe in cases where it i= s not NULL, which it isn=CA=BCt when running the above code, this could be used to deri= ve the buffer and the buffer=CA=BCs position using the struct members =E2=80= =9Ccontents=E2=80=9D and =E2=80=9Cpointm=E2=80=99: 1. =E2=80=9Ccontents=E2=80=9D stores, for lea= f windows, the windows buffer; its descriptions mentions other possible value types it may hold [1]; I do not know in how far these other types have to be considered here. 2. =E2=80=9Cpointm=E2=80=9D refers to a marker holding the current b= uffer position in window; its description states that it is =E2=80=9Cused only wh= en the window is not selected=E2=80=9D. Therefore, it is possible that, if the window =E2=80=9Cw=E2=80=9D is the selected one, the point would have to be = taken from another source (perhaps the =E2=80=9CPT=E2=80=9D macro in =E2=80=9Cbuffer.h= =E2=80=9D). Also note that, if the position would be added to the log entry, multiple log entries would not be merged anymore. Additionally, with the code above, the position is actually after the text (at =E2=80=98point-max=E2=80=99); therefore, this might not be useful informati= on to add. I am not sure if the whole thing is worth the effort or would complicate the creation of a simple log entry for a, hopefully, rare case to much. Anyway, perhaps, if there is any interest in adding information to the =E2=80=9CInvalid face attribute=E2=80=9D log message, further discussion sh= ould move to a wishlist bug report? Robert Pluim writes: > > Felix Dietrich writes >> >> Upon evaluation, the resulting output in the =E2=80=9C*Messages*=E2=80= =9D buffer also >> shows another issues with a missing newline between messages (in Emacs >> 28.1 at least). > >> #+begin_example >> #>Invalid face attribute :foreground nil >> Invalid face attribute :foreground nil >> #+end_example > > It=CA=BCs still there in emacs-29, but it=CA=BCs deep in the guts of the = elisp > engine, so I haven=CA=BCt found exactly where it comes from. If there isn=CA=BCt one already, I try to remember to file a minor bug repo= rt sometime in the next couple of days. >> 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 >> =E2=80=98defface=E2=80=99, that is being treated as the symbol =E2=80=98= unspecified=E2=80=99? > >> #+begin_src emacs-lisp >> (progn >> (defface my/test '((t . (:foreground nil))) "test face") >> (face-attribute 'my/test :foreground)) >> #+end_src > >> #+RESULTS: >> : unspecified > > There was recently a long thread about this on emacs-devel, which I > didn=CA=BCt read :-) It might be worth suggesting this there. I don=CA=BCt seem to be able to find it. Footnotes: [1] =E2=80=9CFor a leaf window or a tooltip window this is the buffer shown in the window; for a combination window this is the first of its child windows; for a pseudo window showing the menu bar or tool bar this is nil. It is a buffer for a minibuffer window as well.=E2=80=9D =E2=80=94 Description of the =E2=80=9Ccontents=E2=80=9D member of =E2= =80=9Cstruct window=E2=80=9D copied from the file =E2=80=9Cwindow.h=E2=80=9D --=20 Felix Dietrich