From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73911: Issue with `widget-specify-button' Date: Sat, 28 Dec 2024 13:11:04 +0200 Message-ID: <86jzbkt647.fsf@gnu.org> References: <075599db-7d78-4475-aa71-daba0e06cf9e@orange.fr> <864j4pzwxx.fsf@gnu.org> <86bjyfguns.fsf@gnu.org> <861pyt9hdo.fsf@gnu.org> <86zfkyvc74.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21461"; mail-complaints-to="usenet@ciao.gmane.io" Cc: da_vid@orange.fr, 73911@debbugs.gnu.org To: maurooaranda@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 28 12:13:00 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 1tRUkc-0005ME-Gm for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Dec 2024 12:12:58 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRUjy-00008S-9k; Sat, 28 Dec 2024 06:12:18 -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 1tRUjj-0007zI-16 for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2024 06:12:03 -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 1tRUji-00072U-Ng for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2024 06:12:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=zdNVIo3Eh+pLdWBZQPwDQXeiRGFxGqYo0BJ8ZhNpvCk=; b=ERafJFPadwHEyXS9aNkZ4FiH+N0+DQRKMXHua49jj670G55C93XlpZ3J9oNkNW1OYMoFE7bOd2nvhrSvxd0zFNpFLN46E6ipRcseCxgqEpny3kRWQ/9M7UoKxlaMc5+/Zkpr4uomNAiHc7i2BIbnU/JRNO11FuFctOpmsDEZyAI7I/XR7i0yunRbywkiS29uMVPk7Qw7Aa2SfwH75Yj1HIgfDuLgY58hmWakCFEMi8cKmswbjZjp24B09g+ZlHqxjYEFeDFG/zdG+l3NO3eduK8kUlvQpGukmnMrTKesgdfFj9hLl+zxIHzNYAEYPovzgPOozvUI3l9cVY/JDqa3OA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tRUji-0006b3-In for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2024 06:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Dec 2024 11:12:02 +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.173538430725331 (code B ref 73911); Sat, 28 Dec 2024 11:12:02 +0000 Original-Received: (at 73911) by debbugs.gnu.org; 28 Dec 2024 11:11:47 +0000 Original-Received: from localhost ([127.0.0.1]:48973 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRUjS-0006aV-7G for submit@debbugs.gnu.org; Sat, 28 Dec 2024 06:11:46 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55646) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRUjP-0006aG-IH for 73911@debbugs.gnu.org; Sat, 28 Dec 2024 06:11:44 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRUjH-0006qR-It; Sat, 28 Dec 2024 06:11:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=zdNVIo3Eh+pLdWBZQPwDQXeiRGFxGqYo0BJ8ZhNpvCk=; b=pOcHyH/mH8FR Tsq6BXVFlsOvMQmy774gNUffEyG222ka7PHydfRcv4x7FcFV7v3uM1KtG9Cb1I6J7LWQILpmvxx5X Z+1i/Xg51+UZZIfi6pTIghh4t54PF57eLRP1qfMrR6Ny04zrjGDWLKhqS2hu0a0Fyq1GMvKV7zn+s 4BNAR4W3dwHuD2cUYNmpajsDpVC/E82DurkEH0WIaGzSaatC9no3iOcdSCumP5Cq++F0LAEZ8IccO esQN4A+2pfA1e9wMsC+lvMjMm5cVdveQn28H9aVsFw61FSgKVk3IERB1CiHmET/5QUUegm73w4CVk zDirLV9P1Xxvj5pIasI8KQ==; In-Reply-To: <86zfkyvc74.fsf@gnu.org> (message from Eli Zaretskii on Sat, 14 Dec 2024 11:35:59 +0200) 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:297876 Archived-At: 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? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >