unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22870: 25.0.91; Mouse-clicks fail on button overlays with display properties
@ 2016-03-01 17:00 Artur Malabarba
  2019-10-09 16:21 ` Stefan Kangas
  2020-09-20 20:18 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Artur Malabarba @ 2016-03-01 17:00 UTC (permalink / raw)
  To: 22870


1. Visit the scratch buffer.

2. Evaluate this code:

(defun my-action (&rest _)
  (interactive)
  (message "WORKED!"))

(make-button (point-min) (+ 30 (point-min))
             'display "..."
             'action #'my-action
             'follow-link t)

3. As expected, the first 30 chars of the buffer will be hidden under a
button that displays as “...”.  Hitting RET on that buffer works as
expected (you see the message “Worked!” on the echo-area).

4. Try clicking on the button with the mouse. You'll get the following error:

Debugger entered--Lisp error: (void-function nil)
  nil(("..." . 1))
  button-activate(("..." . 1) t)
  push-button((mouse-2 (#<window 3 on *scratch*> 1 (14 . 2) 15461622 ("..." . 1) 1 (1 . 0) nil (5 . 2) (9 . 18))))
  funcall-interactively(push-button (mouse-2 (#<window 3 on *scratch*> 1 (14 . 2) 15461622 ("..." . 1) 1 (1 . 0) nil (5 . 2) (9 . 18))))
  call-interactively(push-button nil nil)
  command-execute(push-button)

5. Adding a `mouse-action' property makes no difference.

6. Without the `display' property, everything works as expected.



Looks like this happens because the first argument given to
`button-activate' is `("..." . 1)', while it should be the overlay.





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

* bug#22870: 25.0.91; Mouse-clicks fail on button overlays with display properties
  2016-03-01 17:00 bug#22870: 25.0.91; Mouse-clicks fail on button overlays with display properties Artur Malabarba
@ 2019-10-09 16:21 ` Stefan Kangas
  2019-10-10 10:32   ` Eli Zaretskii
  2020-09-20 20:18 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2019-10-09 16:21 UTC (permalink / raw)
  To: Artur Malabarba; +Cc: 22870

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

Artur Malabarba <bruce.connor.am@gmail.com> writes:

> 1. Visit the scratch buffer.
>
> 2. Evaluate this code:
>
> (defun my-action (&rest _)
>   (interactive)
>   (message "WORKED!"))
>
> (make-button (point-min) (+ 30 (point-min))
>              'display "..."
>              'action #'my-action
>              'follow-link t)
>
> 3. As expected, the first 30 chars of the buffer will be hidden under a
> button that displays as “...”.  Hitting RET on that buffer works as
> expected (you see the message “Worked!” on the echo-area).
>
> 4. Try clicking on the button with the mouse. You'll get the following
error:
>
> Debugger entered--Lisp error: (void-function nil)
>   nil(("..." . 1))
>   button-activate(("..." . 1) t)
>   push-button((mouse-2 (#<window 3 on *scratch*> 1 (14 . 2) 15461622
("..." . 1) 1 (1 . 0) nil (5 . 2) (9 . 18))))
>   funcall-interactively(push-button (mouse-2 (#<window 3 on *scratch*> 1
(14 . 2) 15461622 ("..." . 1) 1 (1 . 0) nil (5 . 2) (9 . 18))))
>   call-interactively(push-button nil nil)
>   command-execute(push-button)
>
> 5. Adding a `mouse-action' property makes no difference.
>
> 6. Without the `display' property, everything works as expected.
>
>
>
> Looks like this happens because the first argument given to
> `button-activate' is `("..." . 1)', while it should be the overlay.

It seems like it was broken by this commit:
24fc948039 2012-12-06 * lisp/button.el: Make them work in header-lines.

Best regards,
Stefan Kangas

[-- Attachment #2: Type: text/html, Size: 1941 bytes --]

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

* bug#22870: 25.0.91; Mouse-clicks fail on button overlays with display properties
  2019-10-09 16:21 ` Stefan Kangas
@ 2019-10-10 10:32   ` Eli Zaretskii
  2019-10-10 10:43     ` Stefan Kangas
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2019-10-10 10:32 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: bruce.connor.am, 22870

> From: Stefan Kangas <stefan@marxist.se>
> Date: Wed, 9 Oct 2019 18:21:22 +0200
> Cc: 22870@debbugs.gnu.org
> 
> > Looks like this happens because the first argument given to
> > `button-activate' is `("..." . 1)', while it should be the overlay.
> 
> It seems like it was broken by this commit:
> 24fc948039 2012-12-06 * lisp/button.el: Make them work in header-lines.

Can you sport which part(s) of that change broke this?

Thanks.





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

* bug#22870: 25.0.91; Mouse-clicks fail on button overlays with display properties
  2019-10-10 10:32   ` Eli Zaretskii
@ 2019-10-10 10:43     ` Stefan Kangas
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2019-10-10 10:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Artur Malabarba, 22870

Eli Zaretskii <eliz@gnu.org> writes:

> > It seems like it was broken by this commit:
> > 24fc948039 2012-12-06 * lisp/button.el: Make them work in header-lines.
>
> Can you sport which part(s) of that change broke this?

Yes, this part:

@@ -417,11 +444,13 @@ push-button
       ;; POS is a mouse event; switch to the proper window/buffer
       (let ((posn (event-start pos)))
        (with-current-buffer (window-buffer (posn-window posn))
-     (push-button (posn-point posn) t)))
+   (if (posn-area posn)
+       ;; mode-line or header-line event
+       (button-activate (car (posn-string posn)) t)
+     (push-button (posn-point posn)) t)))

(car (posn-string posn))  -- changed to (posn-string posn) in commit
4b0df8483 means that in button-activate, the following expression
returns nil:

(or (and use-mouse-action (button-get button 'mouse-action))
            (button-get button 'action))

Best regards,
Stefan Kangas





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

* bug#22870: 25.0.91; Mouse-clicks fail on button overlays with display properties
  2016-03-01 17:00 bug#22870: 25.0.91; Mouse-clicks fail on button overlays with display properties Artur Malabarba
  2019-10-09 16:21 ` Stefan Kangas
@ 2020-09-20 20:18 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-20 20:18 UTC (permalink / raw)
  To: Artur Malabarba; +Cc: 22870

Artur Malabarba <bruce.connor.am@gmail.com> writes:

> 1. Visit the scratch buffer.
>
> 2. Evaluate this code:
>
> (defun my-action (&rest _)
>   (interactive)
>   (message "WORKED!"))
>
> (make-button (point-min) (+ 30 (point-min))
>              'display "..."
>              'action #'my-action
>              'follow-link t)
>
> 3. As expected, the first 30 chars of the buffer will be hidden under a
> button that displays as “...”.  Hitting RET on that buffer works as
> expected (you see the message “Worked!” on the echo-area).
>
> 4. Try clicking on the button with the mouse. You'll get the following error:
>
> Debugger entered--Lisp error: (void-function nil)
>   nil(("..." . 1))
>   button-activate(("..." . 1) t)
>   push-button((mouse-2 (#<window 3 on *scratch*> 1 (14 . 2) 15461622 ("..." . 1) 1 (1 . 0) nil (5 . 2) (9 . 18))))

I'm unable to reproduce this in Emacs 28, and I see that a change was
committed to the push-button command earlier this year, so I think this
has been fixed, and I'm closing this bug report.  If you can see this
bug in Emacs 28, please send a message to the debbugs address and we'll
reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2020-09-20 20:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-01 17:00 bug#22870: 25.0.91; Mouse-clicks fail on button overlays with display properties Artur Malabarba
2019-10-09 16:21 ` Stefan Kangas
2019-10-10 10:32   ` Eli Zaretskii
2019-10-10 10:43     ` Stefan Kangas
2020-09-20 20:18 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).