Subject: bug#22870: 25.0.91; Mouse-clicks fail on button overlays with display properties

From: Stefan Kangas <[email-masked]>
Date: Wed, 9 Oct 2019 18:21:22 +0200

Artur Malabarba <[email-masked]> 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