From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#69942: 30.0.50; Fontification of radio-button widget labels Date: Fri, 22 Mar 2024 16:04:15 +0100 Message-ID: <87frwinw9c.fsf@rub.de> Reply-To: Stephen Berman Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11732"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 69942@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 22 16:05:52 2024 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 1rngSt-0002nM-3g for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 22 Mar 2024 16:05:51 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rngST-0004pa-IL; Fri, 22 Mar 2024 11:05:25 -0400 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 1rngSQ-0004p2-8f for bug-gnu-emacs@gnu.org; Fri, 22 Mar 2024 11:05:22 -0400 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 1rngSP-00007B-Jf for bug-gnu-emacs@gnu.org; Fri, 22 Mar 2024 11:05:21 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rngT3-0001rJ-UU for bug-gnu-emacs@gnu.org; Fri, 22 Mar 2024 11:06:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 22 Mar 2024 15:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69942 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17111199097019 (code B ref -1); Fri, 22 Mar 2024 15:06:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Mar 2024 15:05:09 +0000 Original-Received: from localhost ([127.0.0.1]:58876 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rngSC-0001p8-FW for submit@debbugs.gnu.org; Fri, 22 Mar 2024 11:05:09 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:51264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rngS9-0001ow-TY for submit@debbugs.gnu.org; Fri, 22 Mar 2024 11:05:07 -0400 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 1rngRS-0004c6-Ap for bug-gnu-emacs@gnu.org; Fri, 22 Mar 2024 11:04:23 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rngRO-00087s-IM for bug-gnu-emacs@gnu.org; Fri, 22 Mar 2024 11:04:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1711119856; x=1711724656; i=stephen.berman@gmx.net; bh=6JRzVRebb0xnmQvG/e7lz/3MPpuJfWU517roLlA7UVk=; h=X-UI-Sender-Class:From:To:Subject:Date; b=dj0gsMHPRWIItt/h/IfyNu2DrieS1ewhqpUj/X1DdibT5l5hRYxybQ1GpZpkI2G0 JQkYxJ9h7mNig7CTbPBW0CdHaz223JEq+oqYDpbUW5toSi/d60lNAUcDJ3bEwYXEU aQxc1vaIkbPd8ghM/8vp3ZNTzMOkBcAPFbo2asIX/zYDthNZixkmiEbqd0WUufJYE DTsjz40B9txPpJcPB9jWGCJ0798tfgdRq3iANaDTpzXi22w7v8Id59+bgKw/qvp2m gc3FsvPCj9x0VR1Djd+MDBHRmAR8Cnqp8h7jfDnMsVzYSDqpnOpmGL6V8iFzO1rrf W6snrRrbbVuUmGlTPw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfs2 ([88.130.50.228]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N79u8-1qgK3o12b6-017YGk for ; Fri, 22 Mar 2024 16:04:16 +0100 X-Provags-ID: V03:K1:47XnpaLQH+7xT6DpggefXx7Mo6KQ9va0Ryou77hpOvQHvf6iQzd C8IQHuwUSPk1tgTyG5oIS43S145q/KY9PqRqirxKS+1lkZTLCFEQaL3HOgJJcAwG8jFPkFk H2jkru2k3k1HO5y14b2arRwjfByWxeSEjHwb8j9NOSqDjfEEtpfhgMYRyZDZ/NTFSodogG8 KY3cKIRVeVF3ZkAudEcCA== UI-OutboundReport: notjunk:1;M01:P0:/YwoSLAy+qM=;zZihI+4H2N9Md/t0r8zxTttSBAy lLWKGa2yUFNd3PJfBeYu8usDE+DwpE5ULsKNgkvF0HBzxaNfAbCFw7oJ8Nn8sIm4IET5mKE+W IQi+V8atfwWa1zmSipB0rf7EnzCKldS4v7/vytLS3cDRJfEGj/HibOY6UHUwS4DDN2oDkn4op z0kOrtkXtijqNIAE4tSc9bEwCcDpjZWK/tQx0sweuRCXwpryS3qPLf/S8DoQKODIBL0idg4ZP GBJ9qdGhgsfscK30zmfi3Og37Ps0Cj8VTGZERLqdbra8FAcsnneuMfRVVS1G0nTDBnZJQY2Bn yHBMVBfkHdenXr/s3MDaRkq04DEWIKh3jCPQbV/IUXCttjcUp31AswQCW5FIkIA0bM1wpZofQ afOAAhzafGSerpoc6ioZR68C7wLTk7VSahsCfPQDVFEkGdeLJNiK4dCSBq2M1dA7x/jj1jXCb bYmwy9azZ9Vl3iP5z6ltvATwGeW5FGU2n7NoPyZWjrmS7bhgz2ptZpplm2MaOFs6pTcNBktVd NPQyza3oUW9IKW7hqXSTCf5ZxTEiGKfn41vjGPwWjGZtRAM1lYP8kgbmkoVjysoZIfyQO3Eo9 Zegl7mubBujwPXat5FyNAQ0MRIqN15ap4Jp8TWbva7xgft8NlPuxHwNMEFCQXVBnCH+SlFdth nEZVLzJ4dBf52+e2v7Yb7YK7vNr8EuxCXFX0s2zKx8u0fARzdwgsGp3onBHtJ3REPcCd196sr Sts5nuWS5tsPwT05AtKcjZCNr8Y0cyQhD6HocvIuulH7vyO5AZw2xzFjOdWkcukOR7WZHiYL Received-SPF: pass client-ip=212.227.17.22; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:281943 Archived-At: --=-=-= Content-Type: text/plain In bug#69941 I reported a faulty fontification of radio-button widgets and noted in passing that the labels associated with the radio buttons also have unexpected faces, namely, the widget-inactive face regardless of whether the associated radio buttons are inactive or active (except for the label of a radio button that has been pressed, which has the default face). While the faulty fontification discussed in bug#69941 appears to be a real bug, the widget-inactive face assigned to radio-button labels is apparently by design -- it was present in the initial commit of the widget library. But this seems to me to have been a UX mistake, since it effectively ignores the semantics implied by the name widget-inactive. I think a less surprising UI would be for the labels to be fontified according to the widget's activation state: default face when the widget is active and widget-inactive face when it's inactive. The attached patches provide two possible implementations of this UI. The first patch makes the change unconditionally, treating the current fontification as a UI/UX bug. But it may be argued that this aspect of the widget UI should not be unconditionally changed, since it was apparently a deliberate design choice and there have been (AFAIK) no complaints about the semantic discrepancy till now. The lack of complaint could be because the widget-inactive face inherits the shadow face, so it is not sharply different from the default face. But if one uses a very different face (as I did for illustrative purposes in bug#69941), the inconsistency is very obvious and (IMO) jarring. Nevertheless, to allow keeping the current fontification, the second patch conditionalizes the change from the current fontification by means of a user option (with the default being the current fontification). Is either of these changes acceptable? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=widget-radio-nocust.diff Content-Transfer-Encoding: quoted-printable diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 172da3db1e0..21848849ba5 100644 =2D-- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -2652,9 +2652,7 @@ widget-radio-add-item (setq child (if chosen (widget-create-child-value widget type value) - (widget-create-child widget type))) - (unless chosen - (widget-apply child :deactivate))) + (widget-create-child widget type)))) (t (error "Unknown escape `%c'" escape))))) ;; Update properties. @@ -2706,12 +2704,8 @@ widget-radio-value-set (match (and (not found) (widget-apply current :match value)))) (widget-value-set button match) - (if match - (progn - (widget-value-set current value) - (widget-apply current :activate)) - (widget-apply current :deactivate)) - (setq found (or found match)))))) + (when match (widget-value-set current value)) + (setq found (or found match)))))) (defun widget-radio-validate (widget) ;; Valid if we have made a valid choice. @@ -2733,11 +2727,9 @@ widget-radio-action (dolist (current (widget-get widget :children)) (let* ((button (widget-get current :button))) (cond ((eq child button) - (widget-value-set button t) - (widget-apply current :activate)) + (widget-value-set button t)) ((widget-value button) - (widget-value-set button nil) - (widget-apply current :deactivate))))))) + (widget-value-set button nil))))))) ;; Pass notification to parent. (widget-apply widget :notify child event)) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=widget-radio-cust.diff Content-Transfer-Encoding: quoted-printable diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 172da3db1e0..616286a817d 100644 =2D-- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -2591,6 +2591,16 @@ 'radio-button :off "( )" :off-glyph "radio") +(defcustom widget-radio-face-from-state nil + "How to fontify the label of a radio button. +If non-nil, use `widget-inactive' face for the label if the +radio-button-choice widget is inactive and default face if it is active. +If nil, use the default face for the label only if the associated radio +button is pressed, otherwise use `widget-inactive' face." + :type 'boolean + :group 'widget-faces + :version "30.1") + (defun widget-radio-button-notify (widget _child &optional event) ;; Tell daddy. (widget-apply (widget-get widget :parent) :action widget event)) @@ -2653,8 +2663,9 @@ widget-radio-add-item (widget-create-child-value widget type value) (widget-create-child widget type))) - (unless chosen - (widget-apply child :deactivate))) + (unless widget-radio-face-from-state + (unless chosen + (widget-apply child :deactivate)))) (t (error "Unknown escape `%c'" escape))))) ;; Update properties. @@ -2706,12 +2717,14 @@ widget-radio-value-set (match (and (not found) (widget-apply current :match value)))) (widget-value-set button match) - (if match - (progn - (widget-value-set current value) - (widget-apply current :activate)) - (widget-apply current :deactivate)) - (setq found (or found match)))))) + (if widget-radio-face-from-state + (when match (widget-value-set current value)) + (if match + (progn + (widget-value-set current value) + (widget-apply current :activate)) + (widget-apply current :deactivate))) + (setq found (or found match)))))) (defun widget-radio-validate (widget) ;; Valid if we have made a valid choice. @@ -2734,10 +2747,12 @@ widget-radio-action (let* ((button (widget-get current :button))) (cond ((eq child button) (widget-value-set button t) - (widget-apply current :activate)) + (unless widget-radio-face-from-state + (widget-apply current :activate))) ((widget-value button) (widget-value-set button nil) - (widget-apply current :deactivate))))))) + (unless widget-radio-face-from-state + (widget-apply current :deactivate)))))))) ;; Pass notification to parent. (widget-apply widget :notify child event)) --=-=-= Content-Type: text/plain In GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.18.0) of 2024-03-22 built on strobelfs2 Repository revision: c1530a2e4973005633ebe00d447f1f3aa1200301 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101009 System Description: Linux From Scratch r12.0-112 Configured using: 'configure -C --with-xwidgets 'CFLAGS=-Og -g3' PKG_CONFIG_PATH=/opt/qt5/lib/pkgconfig' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM XWIDGETS GTK3 ZLIB --=-=-=--