From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mauro Aranda Newsgroups: gmane.emacs.bugs Subject: bug#69941: 30.0.50; Faulty fontification of radio button widgets Date: Sat, 23 Mar 2024 17:49:53 -0300 Message-ID: <51c20b56-4b82-4f5c-9559-cdbd0146df22@gmail.com> References: <87h6gynx49.fsf@rub.de> <865xxe1dwd.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="14983"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 69941@debbugs.gnu.org, Stefan Monnier To: Eli Zaretskii , Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 23 22:26:05 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 1ro8sP-0003i9-4B for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Mar 2024 22:26:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ro8ri-0000AQ-2m; Sat, 23 Mar 2024 17:25:22 -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 1ro8rh-0000A2-B9 for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2024 17:25:21 -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 1ro8rh-0000BY-2Z for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2024 17:25:21 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ro8sM-0004k1-DH for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2024 17:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Mar 2024 21:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69941 X-GNU-PR-Package: emacs Original-Received: via spool by 69941-submit@debbugs.gnu.org id=B69941.171122912018123 (code B ref 69941); Sat, 23 Mar 2024 21:26:02 +0000 Original-Received: (at 69941) by debbugs.gnu.org; 23 Mar 2024 21:25:20 +0000 Original-Received: from localhost ([127.0.0.1]:54751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ro8rf-0004iF-W5 for submit@debbugs.gnu.org; Sat, 23 Mar 2024 17:25:20 -0400 Original-Received: from mail-oi1-f171.google.com ([209.85.167.171]:44511) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ro8SA-0003dr-VN for 69941@debbugs.gnu.org; Sat, 23 Mar 2024 16:58:59 -0400 Original-Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3c3880cd471so1846286b6e.1 for <69941@debbugs.gnu.org>; Sat, 23 Mar 2024 13:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711227432; x=1711832232; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=WBS1uRNuEGR3GDIMTiO4qKAMOkVUa/jV745k82v7gac=; b=h1rL+qOnTY6aeiFSkBPJF8DaMt+6W+t9TT4GgOLC3erf/XHfYf0tKlW0dsDrqHoA6P 9JK94S8jWhXKrb8AzEs1ssmdFwJt/WcMKqyoKxKjf5rz+qzj9amO1SyTRu5px/6PuuzP p4uVxI9KxKH7YQ88lEm312sex4D5zZN5YtFvOG1LUBUedPfE8wSx1SiI93mGUj+AhyY0 uXhVlok9TWdXRk/HiE6qX802zk95rfBCB/iQsCvSnp9z5XMoahKG7xS0fk8T3jwOD5dF cYou5Jslhiu6LKJ3ogHR1m0bP63eZccQVXlyYJ/LmIeCyu3Bub1ok0QPxHoCADk7/5pw ftgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711227432; x=1711832232; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WBS1uRNuEGR3GDIMTiO4qKAMOkVUa/jV745k82v7gac=; b=LorOC6cMRbijhSxzK0lNfsliGjOiCRb0e1IUKd6g1Lb7MIPKG8EPTRqbkmdWU65nXY mw75yGD0DLXtgfpoyLKpkZFkULcBmM1MXxPrX4ds1dVmAh8DpCb2FW1FFlktIeyS6IxN q4IJXJEi5Kk/yn9+1IoPzJQ1VfKIj9J94MyMv2sKKxMII8IKEopYzlw6+SGdk9SnuQ1G yaUI0ZHOXnnUP1fjmYHy/eEI9zK3qwQ2/mxRuSvC4GcXJTWAo6zQwr0mHr0tgrAr1ObY wHBmJ2AyjlxxSCXMM/vrGenUvyrZaTGJ4sqNkStXaENAGqtgH/snrIBAR5khkTGNnOcs QTTw== X-Gm-Message-State: AOJu0Yy0VvxntbnU25UNOH72s6kIn8zLMDncXC0EE4uo7VUOzi2blYZw ctKJsvu3DIBSAbWxfZ8WjAOBtbOVDw7dMdhXBDaDBqdEt/IZ6a0y5Q2+wB+7 X-Google-Smtp-Source: AGHT+IHjOFBKJbJ9DWY2Da5rf9u+Mv+kMW+MZyISwdIJ+RmRbiARMi19rdEK4OTDg+FKtYuvQ3EGeA== X-Received: by 2002:a17:90b:1296:b0:2a0:38b5:bdc6 with SMTP id fw22-20020a17090b129600b002a038b5bdc6mr2384246pjb.22.1711226998611; Sat, 23 Mar 2024 13:49:58 -0700 (PDT) Original-Received: from [192.168.0.234] ([181.228.33.6]) by smtp.gmail.com with ESMTPSA id nn11-20020a17090b38cb00b0029b32b85d3dsm7481628pjb.29.2024.03.23.13.49.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 23 Mar 2024 13:49:58 -0700 (PDT) Content-Language: en-US In-Reply-To: <865xxe1dwd.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:282007 Archived-At: Stephen Berman writes: > 5. Tab back to "Activate" and press RET, again restoring the initial > state.  Now tab to radio button "Two" and press RET. > => The fontification is the same as in step 4: radio button "Two" has > the widget-inactive face but radio button "One" has the default (active) > face, though it is again inactive.  Repeatedly pressing either of the > radio buttons (after activating them), does not change the fontification > of "One" again. > > > The faulty fontification of radio button "One" also obtains if there is > just one radio button instead of two, and if there are more than two > radio buttons, it is only the first one that displays the odd > fontification (admittedly, I've only test up to three radio buttons). > > I've tried to debug this and found that the problem seems to be due to > the sexp (set-marker-insertion-type from t) near the end of > widget-default-create, which advances the marker specified by the > widget's :from property.  Changing t to nil fixes the faulty > fontification of the first radio button. > > I investigated the history of this code, and while the value t for the > marker insertion type was used in the initial commit, it was changed to > nil in commit e0f956935, with the message "Insert new text at the :from > marker _after_ the marker, not before it."  But 18 days later it was > changed back to t in commit 3bff434b8, that also added "Document need to > put some text before the %v escape in :format string" of editable-field > widgets.  (I looked at the bug-gnu-emacs and emacs-devel mailing list > archives but found nothing relevant at the time just prior to these > commits.) I'm pretty sure it makes sense for user-editable widgets that the value for insertion-type be t. > So evidently the advancing marker insertion type is needed for at least > some widgets, though it seems to be problematic for radio buttons.  So I > tried to conditionalize the choice of t or nil on the type of the > widget.  I used (not (eq 'radio-button (widget-type widget))), since the > argument `widget' of widget-default-create is, according to Edebug, > indeed radio-button, so negating the eq sexp returns nil, which I had > found to be the value of the marker insertion type that fixes the > fontification (however, I couldn't think of a way of limiting the > conditioning to only the first radio button, but in my testing so far > that lack doesn't appear to make a difference). I'm not sure if the right target is the radio-button widget.  It could be the radio-button-choice widget.  Did you try to conditionalize the code against the radio-button-choice widget? > But in fact, using the negation of the value of the eq sexp results in > the same faulty fontification, while omitting the negation (as in the > attached patch), which yields the advancing insertion type t, gives the > correct fontification, just like using nil does.  This makes no sense to > me, yet it is reliably reproducible.  The only possible explanation that > occurs to me is that the bug is triggered elsewhere in the Emacs code > and somehow using the sexp that evaluates to t as the marker insertion > type affects that code, while using t itself does not (or rather, has > the opposite effect); but how that could be and where the culpable code > is, I don't know (as a guess, perhaps in the C code that adds faces, but > I don't know how to debug that).  If anyone knows or has an idea what's > going on here, please communicate it.  In the meantime I will continue > to use the widget library with the patch to see whether it has unwanted > consequences. I don't know much about that code in Emacs.  If we find some hack that works maybe we can use that until someone figures it out.  But again, given your analysis, I'd like to find out if using the condition on the radio-button-choice widget works as expected.  And of course, the hack shouldn't be added to the widget-default-create, which should remain type agnostic.