From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Ponce Newsgroups: gmane.emacs.bugs Subject: bug#67404: 30.0.50; Issue with :box face attribute Date: Thu, 30 Nov 2023 17:20:44 +0100 Message-ID: <0275e8ba-efe6-41bc-8380-0baa08c562e9@orange.fr> References: <986eaa76-521b-4325-a510-e9a8e374bf49@orange.fr> <83cyvwbyic.fsf@gnu.org> <83ttp3b74e.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38127"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 67404@debbugs.gnu.org To: Eli Zaretskii , Mauro Aranda Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 30 17:21:28 2023 Return-path: Envelope-to: geb-bug-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 1r8jn2-0009Xu-QA for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 Nov 2023 17:21:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r8jmg-0008Lo-Ce; Thu, 30 Nov 2023 11:21:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r8jmY-0008LK-K2 for bug-gnu-emacs@gnu.org; Thu, 30 Nov 2023 11:20:56 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r8jmY-0005MB-19 for bug-gnu-emacs@gnu.org; Thu, 30 Nov 2023 11:20:54 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r8jmg-0003At-1m for bug-gnu-emacs@gnu.org; Thu, 30 Nov 2023 11:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: David Ponce Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 Nov 2023 16:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67404 X-GNU-PR-Package: emacs Original-Received: via spool by 67404-submit@debbugs.gnu.org id=B67404.170136125812183 (code B ref 67404); Thu, 30 Nov 2023 16:21:02 +0000 Original-Received: (at 67404) by debbugs.gnu.org; 30 Nov 2023 16:20:58 +0000 Original-Received: from localhost ([127.0.0.1]:54407 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8jmb-0003AR-Lc for submit@debbugs.gnu.org; Thu, 30 Nov 2023 11:20:58 -0500 Original-Received: from smtp-18.smtpout.orange.fr ([80.12.242.18]:55201 helo=smtp.smtpout.orange.fr) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8jmY-0003AH-Kc for 67404@debbugs.gnu.org; Thu, 30 Nov 2023 11:20:56 -0500 Original-Received: from [192.168.1.15] ([2.7.71.181]) by smtp.orange.fr with ESMTPA id 8jmOr7XZB66Vq8jmOrAZ3g; Thu, 30 Nov 2023 17:20:45 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1701361245; bh=QZIFolyNGxpILlHsqza20wrxpxESrmk3MwdTXeVXzGU=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=OJg8bnloGj1QIAiYkKa+eWINc0vT5pTYWjBOmWCRfqs4aNj3XE6Gy5nkmNFtOd3wW y5tAnDrddMZinT4rWnL04ELGQdBc6zSH/2XP1Yy58kyPVmZohkVX+6vB5/WNPQz5Es pBovviOi+OmwV83rg2pqpW/rKE4+51sHODtq6SXs5isenazYYJh5By5IJ0Y8N3l8ye yyPNIQ734GuGoniEbqDRa6iohnOOZ/UEsEzEZBIb54xSOBkjxOStAaCwguwNGrVn2y i/NgbhFy3ohzfoRHKa/q/jvYgRy7HjJRznqzWfKdOyuruT8UNxPrED+0m/Xki8Vyne EV1tw4ECUs+Tw== X-ME-Helo: [192.168.1.15] X-ME-Auth: ZGFfdmlkQHdhbmFkb28uZnI= X-ME-Date: Thu, 30 Nov 2023 17:20:45 +0100 X-ME-IP: 2.7.71.181 Content-Language: fr, en-US In-Reply-To: <83ttp3b74e.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275289 Archived-At: On 30/11/2023 16:20, Eli Zaretskii wrote: >> Date: Thu, 30 Nov 2023 07:46:02 -0300 >> Cc: 67404@debbugs.gnu.org >> From: Mauro Aranda >> >> On 26/11/23 07:27, Eli Zaretskii wrote: >> >> >> Date: Thu, 23 Nov 2023 16:23:15 +0100 >> >> From: David Ponce >> >> >> >> Hello, >> >> >> >> The below face with specified :box attribute can be defined and further >> >> used without problem: >> >> >> >> (defface test-face >> >>    '((t >> >>       (:box (:style released-button :line-width (3 . 0))) >> >>       )) >> >>    "Test face.") >> >> >> >> (insert (propertize "XXXXX" 'face 'test-face)) >> >> >> >> However, it is not possible to apply any change to this face with >> >> `customize-face', for example to change :line-width (3 . 0) to >> >> :line-width (2 . 0), or to add a :foreground color, etc. This fails >> >> with the message "set-face-attribute: Invalid face box: :line-width, >> >> , :style, ", and the :box attribute is discarded. >> >> >> >> AFAICS, :box attribute with any zero :line-width value works as >> >> expected: the box line with zero width is not displayed. But zero is >> >> not considered as a valid value by `set-face-attribute' (in fact, the >> >> internal function `internal-set-lisp-face-attribute'). >> >> >> >> For consistency, a zero :line-width value either should be accepted by >> >> `internal-set-lisp-face-attribute', or never accepted at all. >> > >> > Mauro, any comments about these issues? >> >> Hi Eli, >> >> Not really, no.  The widget used for line-width just assumes 0 is a >> valid value.  I don't know if that's the case or not, it is not >> explicitly documented in the ELisp manual and I don't really know the >> xfaces.c code. >> >> For some reason, the code that rejects a value of 0 in >> Finternal_set_lisp_face_attribute doesn't complain (maybe it does not >> get to run?) when using defface, but it does complain when Customize >> tries to set it, by calling face-spec-set. > > Thanks for the hints. This is a (very old) bug in > Finternal_set_lisp_face_attribute. The value zero for line-width is > not valid, but because of the bug it (and invalid values of other box > attributes) could be accepted, but only if the invalid attribute is > the last attribute of :box. Try this equivalent definition: > > (defface test-face > '((t > (:box (:line-width (3 . 0) :style released-button)) > )) > "Test face.") > > which just swaps the :box attributes, and you will see that defface > signals an error. Customizing the :line-width attribute just happens > to move that attribute to the front of the list, and then you get the > error. > > I've now fixed this on the master branch, and now zero width values > will always be rejected. Hi Eli, I confirm that with your fix on master branch, the behavior is now consistent between defface and customize-face: both signal an error on value zero for line-width :-) However, please note that it remains possible to use a value zero for line-width on an anonymous face. For example, in the *scratch* buffer you still can eval the below expression without error: (insert (propertize "xxxx" 'font-lock-face '(:box (:style released-button :line-width (3 . 0))))) Thanks!