all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: maurooaranda@gmail.com
Cc: da_vid@orange.fr, 73911@debbugs.gnu.org
Subject: bug#73911: Issue with `widget-specify-button'
Date: Sat, 28 Dec 2024 13:11:04 +0200	[thread overview]
Message-ID: <86jzbkt647.fsf@gnu.org> (raw)
In-Reply-To: <86zfkyvc74.fsf@gnu.org> (message from Eli Zaretskii on Sat, 14 Dec 2024 11:35:59 +0200)

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?
> > > > 
> > > > 
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > 
> > 
> 
> 
> 
> 





      reply	other threads:[~2024-12-28 11:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86jzbkt647.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73911@debbugs.gnu.org \
    --cc=da_vid@orange.fr \
    --cc=maurooaranda@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.