Subject: Re: bug#79294: [PATCH] Add hideable indicators for hideshow.

From: Eli Zaretskii <[email-masked]>
Date: Tue, 16 Sep 2025 14:30:16 +0300

> From: Elijah Gabe Pérez <[email-masked]>
> Cc: [email-masked]
> Date: Mon, 15 Sep 2025 14:21:35 -0600
> 
> > Maybe it's a bug?  Can you show a simple Lisp program that I could
> > evaluate in *scratch* and use to look into this issue?
> 
> Sure, here is a recipe:
> 
> 1. M-x fundamental-mode
> 
> 2. M-:
>    (insert
>     "  "
>     (propertize
>      "x"
>      'display '(left-fringe
>                 left-arrow
>                 error)
>      'keymap (let ((map (make-sparse-keymap)))
>                (define-key map (kbd "<left-fringe> <mouse-1>")
>                            (lambda ()
>                              (interactive)
>                              (print "message!")))
>                map)))
> 
> 3. Click on the fringe icon, it should not work an throw the
> "<left-fringe> <mouse-1> is undefined" message.

I don't understand: you set the 'keymap' property on a character 'x',
and expect a click on the fringe to somehow magically use that keymap?
That's not how this works: the 'keymap' property defines the keymap to
use when clicking on the character with the property.

> 4. M-: ; (Same code but without the spaces at BOL)
>    (insert
>     (propertize
>      "x"
>      'display '(left-fringe
>                 left-arrow
>                 error)
>      'keymap (let ((map (make-sparse-keymap)))
>                (define-key map (kbd "<left-fringe> <mouse-1>")
>                            (lambda ()
>                              (interactive)
>                              (print "message!")))
>                map)))
> 
> 5. Click on the fringe icon, it should display the message "message!".

This is just a side effect of the implementation, arguably a bug.

> I'm not sure if this is a known bug, but I've seen packages that locally
> (in the buffer local map) bind mouse-1 to a command that scans for the
> overlay in some region of the buffer, probably the fringe keymap doesn't
> support this yet.

That's exactly what you should do.  See, for example,
gdb-mouse-set-clear-breakpoint in gdb-mi.el.

> For the patch, I have already solved this problem, although I am not
> happy with the solution, it is possibly the only way to solve this:

That is the right solution.