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#73911: Issue with `widget-specify-button' Date: Tue, 31 Dec 2024 08:34:58 -0300 Message-ID: <7cc4a2df-41d7-4b11-8fe9-c4b639ed7c8e@gmail.com> References: <075599db-7d78-4475-aa71-daba0e06cf9e@orange.fr> <864j4pzwxx.fsf@gnu.org> <86bjyfguns.fsf@gnu.org> <861pyt9hdo.fsf@gnu.org> <86zfkyvc74.fsf@gnu.org> <86jzbkt647.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="20600"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 73911@debbugs.gnu.org To: Eli Zaretskii , da_vid@orange.fr Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 31 12:37:23 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 1tSaYs-0005DV-Fl for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 31 Dec 2024 12:37:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tSaYZ-0008Id-UV; Tue, 31 Dec 2024 06:37:04 -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 1tSaYY-0008IU-G9 for bug-gnu-emacs@gnu.org; Tue, 31 Dec 2024 06:37:02 -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 1tSaYY-0006IU-7T for bug-gnu-emacs@gnu.org; Tue, 31 Dec 2024 06:37:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=3AiAcdp+QTdzKNAmjn313z7SnqsI2NwpcmUOrfBIDl4=; b=LAdASucHjMFSx3FpqfsFzkh5UJfT4PqpRKrTEdzwVcWkMtY6ibPjvlcowLLhGu7nIY9xt5hRObQsoCPrbxXrpl5oU5bZbywUwhBNh01fvLmbjiVK6dnhxcuiBrj24rt5XmrC4OJmcJR98oyXvdRDTMmv9etv+ZXn2HAC8zp1ZHvmriEafBJSawRoAxxJihT09yEZZMqAV/WvbtySTb9gdujNRQSISpkkALYi3VtYvI0oL5FSY0VzSMyxWhTCXmwWsj/0sR5GikZH6DSP2Akf8JSHkkoLQJ1z+afMtdlB735vN+OomNVjniugHMm+57lcDnJ/jHbA1BzS8ReyB0efeg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tSaYX-0006in-Nu for bug-gnu-emacs@gnu.org; Tue, 31 Dec 2024 06:37:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 31 Dec 2024 11:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73911 X-GNU-PR-Package: emacs Original-Received: via spool by 73911-submit@debbugs.gnu.org id=B73911.173564497225770 (code B ref 73911); Tue, 31 Dec 2024 11:37:01 +0000 Original-Received: (at 73911) by debbugs.gnu.org; 31 Dec 2024 11:36:12 +0000 Original-Received: from localhost ([127.0.0.1]:34065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tSaXj-0006hY-Kb for submit@debbugs.gnu.org; Tue, 31 Dec 2024 06:36:12 -0500 Original-Received: from mail-pj1-f52.google.com ([209.85.216.52]:59783) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tSaXf-0006hG-KL for 73911@debbugs.gnu.org; Tue, 31 Dec 2024 06:36:11 -0500 Original-Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2ef72924e53so13409423a91.3 for <73911@debbugs.gnu.org>; Tue, 31 Dec 2024 03:36:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735644902; x=1736249702; 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=3AiAcdp+QTdzKNAmjn313z7SnqsI2NwpcmUOrfBIDl4=; b=C/32YYYTee6vEM6oqeO/AMZt3/AKEzHZO/Fhk1NKrJQQn+wD5a5TecvgL+INuHdXV5 jWWM4/VMB5+hhzivoh7JyYUe28pAiGXU6RlVku5yra7Sy/7ta00prVqGHZx6OwF3/Zpz 1mdEBmOAQeJynYWmx+M4Bx2gxORyu/Mn2bwFBY85alVYuDYedCs00wyT0wRgmNC7HlYU kNih3mfJ3+cXDgUA058mU0tXwm07j7RxWMa7p4kXJnH4lfgaPFqstleCSn6EJPF6giUp 2qkT+R75fDvVD3LeSFnRhuctqLlaQGzBnijGQtbNfUVkV22zbC7Ydn7IvrFowkLkEpWC roJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735644902; x=1736249702; 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=3AiAcdp+QTdzKNAmjn313z7SnqsI2NwpcmUOrfBIDl4=; b=HJ3BrlpTq2qTmuwoBqO/JWpoW/kKQuabR8xAjKRSUKkqeaj8kaFftBkD1VBeNhXYja YGpp2JiKrJeMEUJkZoMIr1e/R52oFZdgZrVMifSJi9cZGK6YRWNoRkHXYcbXU+8g65pR 5iKhzXSqpP2DWwQuNhit+j2epw1gxHS1pODVIWS+RfZjROgJbTu9M0SH1dgqDqNq30lQ e/aixDtEHZj2df/dIqevk1Htn3G7tKX0RaZnHfCINQCjdM9LZfBIl+qTUT8Lk4dUZJnY 8erKw82E1JhGfjPg/WSUZQMJSB/XhSySOc3u6fMx7qIMX7Ik8lgrooxMSeT8niz8i2mx 3xQA== X-Gm-Message-State: AOJu0YxjFck6RyAxGAa5h61sW6M8pC7CwJNcBuJN/Byz442kV51395ii tqHQryCIgjD8foY27rpzGqqWqhQWMzGaJpFGv3ADBm0NdCn/7gQJ X-Gm-Gg: ASbGncvCbDhkqiKYTSP/gs4KeV5ijXAMfpx41VLM5PdEf6P6TOyk4ZEvKuI78/W1/52 fjSdU4n0PEF0bJH2m+Lg2uMayOUHHSPy96ZMCjr3ncDrnZxdn7lb+HZIMFKdFmgc7+/WuUCKLIY s0TbDCRWVz4lwXqweFW5/Z7+/buyRXoO/1qTr+3EUEwjgf/HH098CNRSdsuVAF8Rgbfu+4Ol/ut pP5lnQe0XiuGlYx9DILDb3Ojx7xpFUMAwZnTIT8vNa1B0H9Vrps+jv6bLiTLoM= X-Google-Smtp-Source: AGHT+IF5Lb9RnsRVQRJlwhvimhpidTcQ2LSpTHE9Tt0MSMGqnRSuhdbTHXPx5YNoymGh6c4bjjfIUg== X-Received: by 2002:a17:90b:5208:b0:2ee:dcf6:1c8f with SMTP id 98e67ed59e1d1-2f452e1814bmr60644604a91.16.1735644901686; Tue, 31 Dec 2024 03:35:01 -0800 (PST) Original-Received: from [192.168.0.234] ([181.228.33.6]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ed641ed7sm24386363a91.23.2024.12.31.03.35.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 Dec 2024 03:35:01 -0800 (PST) Content-Language: en-US In-Reply-To: <86jzbkt647.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:298039 Archived-At: Hi Eli, I'm sorry I was unable to respond to your messages all this time.  It has been a very difficult year for me. Eli Zaretskii writes: > Ping! Ping! Ping! > >> Cc: da_vid@orange.fr, 73911@debbugs.gnu.org >> Date: Sat, 14 Dec 2024 11:35:59 +0200 >> From: Eli Zaretskii >> >> Ping! Ping!  Mauro, please respond. >> >> > Cc: da_vid@orange.fr, 73911@debbugs.gnu.org >> > Date: Sat, 30 Nov 2024 11:54:11 +0200 >> > From: Eli Zaretskii >> > >> > Ping! Ping! Mauro, are you there? >> > >> > > Cc: da_vid@orange.fr, 73911@debbugs.gnu.org >> > > Date: Sat, 16 Nov 2024 15:44:39 +0200 >> > > From: Eli Zaretskii >> > > >> > > Ping! Mauro, could you please respond? >> > > >> > > > Cc: 73911@debbugs.gnu.org >> > > > Date: Sat, 02 Nov 2024 13:39:38 +0200 >> > > > From: Eli Zaretskii >> > > > >> > > > > Date: Sun, 20 Oct 2024 15:01:47 +0200 >> > > > > From:  David Ponce via "Bug reports for GNU Emacs, >> > > > >  the Swiss army knife of text editors" >> > > > > >> > > > > I found that `widget-specify-button' produces unexpected result when >> > > > > button prefix string has a space (and maybe others) display >> > > > > properties. >> > > > > >> > > > > To illustrate the issue with emacs -Q, evaluate the below code in the >> > > > > *scratch* buffer: >> > > > > >> > > > > (require 'wid-edit) >> > > > > (let* ((thin-space (propertize " " 'display '(space :width 0.5))) >> > > > >         (widget-push-button-prefix thin-space) >> > > > >         (widget-push-button-suffix thin-space)) >> > > > >    (widget-create 'push-button >> > > > >          :notify #'ignore >> > > > >          :button-face '( ;;:background "lightgrey" >> > > > >                  :box t) >> > > > >          ;;:suppress-face t >> > > > >          "OK") >> > > > >    (insert "\n")) >> > > > > >> > > > > I found that the culprit is the invisible space that >> > > > > `widget-specify-button' puts at the beginning of the button (no idea >> > > > > why) using a 'before-string overlay property, at line 467: >> > > > > >> > > > > (overlay-put overlay 'before-string #(" " 0 1 (invisible t))) >> > > > > >> > > > > Giving this invisible space the same face property as the rest of the >> > > > > button fixed the issue for me.  This is what I propose in the below >> > > > > patch.  With this fix the above test will give the expected result. >> > > > > >> > > > > Thanks >> > > > > >> > > > > diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el >> > > > > index 1d47f80b0dd..fd1747d3562 100644 >> > > > > --- a/lisp/wid-edit.el >> > > > > +++ b/lisp/wid-edit.el >> > > > > @@ -460,17 +460,20 @@ widget-specify-button >> > > > >     "Specify button for WIDGET between FROM and TO." >> > > > >     (let ((overlay (make-overlay from to nil t nil)) >> > > > >       (follow-link (widget-get widget :follow-link)) >> > > > > -    (help-echo (widget-get widget :help-echo))) >> > > > > +    (help-echo (widget-get widget :help-echo)) >> > > > > +    (face (unless (widget-get widget :suppress-face) >> > > > > +        (widget-apply widget :button-face-get)))) >> > > > >       (widget-put widget :button-overlay overlay) >> > > > >       (when (functionp help-echo) >> > > > >         (setq help-echo 'widget-mouse-help)) >> > > > > -    (overlay-put overlay 'before-string #(" " 0 1 (invisible t))) >> > > > > +    (overlay-put overlay 'before-string >> > > > > +                 (propertize " " 'invisible t 'face face)) >> > > > >       (overlay-put overlay 'button widget) >> > > > >       (overlay-put overlay 'keymap (widget-get widget :keymap)) >> > > > >       (overlay-put overlay 'evaporate t) >> > > > >       ;; We want to avoid the face with image buttons. >> > > > > -    (unless (widget-get widget :suppress-face) >> > > > > -      (overlay-put overlay 'face (widget-apply widget :button-face-get)) >> > > > > +    (when face >> > > > > +      (overlay-put overlay 'face face) >> > > > >         (overlay-put overlay 'mouse-face >> > > > >              ;; Make new list structure for the mouse-face value >> > > > >              ;; so that different widgets will have >> > > > >> > > > Thanks. >> > > > >> > > > Mauro, any comments? >> > > > >> > > > >> > > > I don't really know the effects that this change could have (whether good or bad).  The added invisible space comes from Bug#51550, which involved some discussions about the display engine itself. I had trouble reproducing the bug itself, since I don't understand what the unexpected result is. David, I'm sorry it took me so long to reply, but can you explain a bit more what's the unexpected result? Thank you.