all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#73911: Issue with `widget-specify-button'
@ 2024-10-20 13:01 David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-11-02 11:39 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-20 13:01 UTC (permalink / raw)
  To: 73911

[-- Attachment #1: Type: text/plain, Size: 2382 bytes --]

Hello,

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

[-- Attachment #2: wid-edit.el.patch --]
[-- Type: text/x-patch, Size: 1331 bytes --]

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* bug#73911: Issue with `widget-specify-button'
  2024-10-20 13:01 bug#73911: Issue with `widget-specify-button' David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-02 11:39 ` Eli Zaretskii
  2024-11-16 13:44   ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2024-11-02 11:39 UTC (permalink / raw)
  To: David Ponce, Mauro Aranda; +Cc: 73911

> 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" <bug-gnu-emacs@gnu.org>
> 
> 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?





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#73911: Issue with `widget-specify-button'
  2024-11-02 11:39 ` Eli Zaretskii
@ 2024-11-16 13:44   ` Eli Zaretskii
  2024-11-30  9:54     ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2024-11-16 13:44 UTC (permalink / raw)
  To: maurooaranda; +Cc: da_vid, 73911

Ping! Mauro, could you please respond?

> Cc: 73911@debbugs.gnu.org
> Date: Sat, 02 Nov 2024 13:39:38 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > 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" <bug-gnu-emacs@gnu.org>
> > 
> > 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?
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#73911: Issue with `widget-specify-button'
  2024-11-16 13:44   ` Eli Zaretskii
@ 2024-11-30  9:54     ` Eli Zaretskii
  2024-12-14  9:35       ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2024-11-30  9:54 UTC (permalink / raw)
  To: maurooaranda; +Cc: da_vid, 73911

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 <eliz@gnu.org>
> 
> Ping! Mauro, could you please respond?
> 
> > Cc: 73911@debbugs.gnu.org
> > Date: Sat, 02 Nov 2024 13:39:38 +0200
> > From: Eli Zaretskii <eliz@gnu.org>
> > 
> > > 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" <bug-gnu-emacs@gnu.org>
> > > 
> > > 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?
> > 
> > 
> > 
> > 
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#73911: Issue with `widget-specify-button'
  2024-11-30  9:54     ` Eli Zaretskii
@ 2024-12-14  9:35       ` Eli Zaretskii
  2024-12-28 11:11         ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2024-12-14  9:35 UTC (permalink / raw)
  To: maurooaranda; +Cc: da_vid, 73911

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 <eliz@gnu.org>
> 
> 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 <eliz@gnu.org>
> > 
> > Ping! Mauro, could you please respond?
> > 
> > > Cc: 73911@debbugs.gnu.org
> > > Date: Sat, 02 Nov 2024 13:39:38 +0200
> > > From: Eli Zaretskii <eliz@gnu.org>
> > > 
> > > > 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" <bug-gnu-emacs@gnu.org>
> > > > 
> > > > 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?
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > 
> > 
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#73911: Issue with `widget-specify-button'
  2024-12-14  9:35       ` Eli Zaretskii
@ 2024-12-28 11:11         ` Eli Zaretskii
  2024-12-31 11:34           ` Mauro Aranda
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2024-12-28 11:11 UTC (permalink / raw)
  To: maurooaranda; +Cc: da_vid, 73911

Ping! Ping! Ping!

> Cc: da_vid@orange.fr, 73911@debbugs.gnu.org
> Date: Sat, 14 Dec 2024 11:35:59 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> 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 <eliz@gnu.org>
> > 
> > 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 <eliz@gnu.org>
> > > 
> > > Ping! Mauro, could you please respond?
> > > 
> > > > Cc: 73911@debbugs.gnu.org
> > > > Date: Sat, 02 Nov 2024 13:39:38 +0200
> > > > From: Eli Zaretskii <eliz@gnu.org>
> > > > 
> > > > > 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" <bug-gnu-emacs@gnu.org>
> > > > > 
> > > > > 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?
> > > > 
> > > > 
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > 
> > 
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#73911: Issue with `widget-specify-button'
  2024-12-28 11:11         ` Eli Zaretskii
@ 2024-12-31 11:34           ` Mauro Aranda
  2024-12-31 13:34             ` Eli Zaretskii
  2024-12-31 16:12             ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 11+ messages in thread
From: Mauro Aranda @ 2024-12-31 11:34 UTC (permalink / raw)
  To: Eli Zaretskii, da_vid; +Cc: 73911

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 <eliz@gnu.org> 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 <eliz@gnu.org>
 >>
 >> 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 <eliz@gnu.org>
 >> >
 >> > 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 <eliz@gnu.org>
 >> > >
 >> > > Ping! Mauro, could you please respond?
 >> > >
 >> > > > Cc: 73911@debbugs.gnu.org
 >> > > > Date: Sat, 02 Nov 2024 13:39:38 +0200
 >> > > > From: Eli Zaretskii <eliz@gnu.org>
 >> > > >
 >> > > > > 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" <bug-gnu-emacs@gnu.org>
 >> > > > >
 >> > > > > 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.






^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#73911: Issue with `widget-specify-button'
  2024-12-31 11:34           ` Mauro Aranda
@ 2024-12-31 13:34             ` Eli Zaretskii
  2024-12-31 16:32               ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-12-31 16:12             ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2024-12-31 13:34 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: da_vid, 73911

> Date: Tue, 31 Dec 2024 08:34:58 -0300
> Cc: 73911@debbugs.gnu.org
> From: Mauro Aranda <maurooaranda@gmail.com>
> 
> 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.

No need to apologize, we all have our lives.  And welcome back.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#73911: Issue with `widget-specify-button'
  2024-12-31 11:34           ` Mauro Aranda
  2024-12-31 13:34             ` Eli Zaretskii
@ 2024-12-31 16:12             ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2025-01-01 11:03               ` Mauro Aranda
  1 sibling, 1 reply; 11+ messages in thread
From: David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-31 16:12 UTC (permalink / raw)
  To: Mauro Aranda, Eli Zaretskii; +Cc: 73911

[-- Attachment #1: Type: text/plain, Size: 1476 bytes --]

On 2024-12-31 12:34, Mauro Aranda wrote:
[...]
>  >> > > > 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.
> 

Hi Mauro,

I attached a screenshot of the result:

1. with the current version of `widget-specify-button' which clearly shows
    the unexpected appearance of the "OK" button when the button face has a
    :box attribute and the button prefix use a display space property.

2. with the patched version of `widget-specify-button' which shows the
    expected appearance of the same "OK" button.

It seems the problem is due to the invisible space inserted in front of the
button without specifying the face property, which causes a discontinuous
display of the button prefix when it uses a display space property.

I don't really know how to explain this better, sorry.

My proposed change just set the face of the invisible space to the button
face, which seems to fix the appearance of the button when the button
prefix has a display space text property.

I hope you will enjoy the new year.

Thank you for your help.

[-- Attachment #2: Screenshot.jpg --]
[-- Type: image/jpeg, Size: 69693 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#73911: Issue with `widget-specify-button'
  2024-12-31 13:34             ` Eli Zaretskii
@ 2024-12-31 16:32               ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 11+ messages in thread
From: Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-31 16:32 UTC (permalink / raw)
  To: Eli Zaretskii, Mauro Aranda; +Cc: da_vid@orange.fr, 73911@debbugs.gnu.org

> > 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.
> 
> No need to apologize, we all have our lives.  And welcome back.

+1.

Sorry to hear about your year, Mauro.
Hope 2025 will be better.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#73911: Issue with `widget-specify-button'
  2024-12-31 16:12             ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2025-01-01 11:03               ` Mauro Aranda
  0 siblings, 0 replies; 11+ messages in thread
From: Mauro Aranda @ 2025-01-01 11:03 UTC (permalink / raw)
  To: David Ponce; +Cc: Eli Zaretskii, 73911

David Ponce <da_vid@orange.fr> writes:

 > On 2024-12-31 12:34, Mauro Aranda wrote:
 > [...]
 >>  >> > > > 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.
 >>
 >
 > Hi Mauro,
 >
 > I attached a screenshot of the result:
 >
 > 1. with the current version of `widget-specify-button' which clearly 
shows
 >    the unexpected appearance of the "OK" button when the button face 
has a
 >    :box attribute and the button prefix use a display space property.
 >
 > 2. with the patched version of `widget-specify-button' which shows the
 >    expected appearance of the same "OK" button.
 >

Thanks, I see it now.

 > It seems the problem is due to the invisible space inserted in front 
of the
 > button without specifying the face property, which causes a discontinuous
 > display of the button prefix when it uses a display space property.
 >

Agreed.

 > My proposed change just set the face of the invisible space to the button
 > face, which seems to fix the appearance of the button when the button
 > prefix has a display space text property.

I think it makes sense.  It's the only place in wid-edit that we add
something "extra" to the overlay (as in not specified in the :format
property) that represents the widget in-buffer, and we should respect
the button face.

 > I hope you will enjoy the new year.
 >
 > Thank you for your help.

Thanks, have a great year you too.






^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-01-01 11:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-20 13:01 bug#73911: Issue with `widget-specify-button' David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-02 11:39 ` Eli Zaretskii
2024-11-16 13:44   ` Eli Zaretskii
2024-11-30  9:54     ` Eli Zaretskii
2024-12-14  9:35       ` Eli Zaretskii
2024-12-28 11:11         ` Eli Zaretskii
2024-12-31 11:34           ` Mauro Aranda
2024-12-31 13:34             ` Eli Zaretskii
2024-12-31 16:32               ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-31 16:12             ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-01 11:03               ` Mauro Aranda

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.