GNU bug report logs -
#75841
[PATCH] Fix mouse click on flymake
Previous Next
Reported by: Ergus <spacibba <at> aol.com>
Date: Sat, 25 Jan 2025 21:28:02 UTC
Severity: normal
Tags: patch
Fixed in version 31.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 75841 in the body.
You can then email your comments to 75841 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Sat, 25 Jan 2025 21:28:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ergus <spacibba <at> aol.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 25 Jan 2025 21:28:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Juri:
On Sat, Jan 25, 2025 at 07:48:33PM +0200, Juri Linkov wrote:
>> Please find attached the patch with the fix + the new feature.
>
>Your previous patch worked at least for margins, but new one doesn't work.
>
Try it now please. I actually detected the issue just now and was
planning to submit a new patch. when I saw your message
The issue was that I was checking for errors only in the event
position. But on fringe events `pos' is always the line start position,
where not necessarily needs to be any error overlay.
Now the code considers the whole line when the event is from the fringe
or margin and uses only pos in the flymake-menu's command.
If the line has more than one error, it highlights the first one
returned by flymake-diagnostics.
>> It includes:
>
>> 1. A new defcustom equivalent to xref-after-jump-hook.
>> 2. An optional argument to flymake-show-buffer-diagnostics.
>> 3. Modification to flymake-menu to use a new function that also highlights
>> the candidate when possible.
>
>Thanks, nice idea.
>
>> They look like too many, but are actually just a few lines, so I put
>> them together.
>
>I wonder why you don't send patches to bug-gnu-emacs
>where it's easier to track them.
I actually prefer to create a branch and so on, but I thought that this
patch would be just a couple of lines (like in my first message). But
things are never as simple as I would like ;)
Best,
Ergus
[flymake-indicator-margin-click_v3.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Mon, 27 Jan 2025 19:04:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 75841 <at> debbugs.gnu.org (full text, mbox):
>>> Please find attached the patch with the fix + the new feature.
>>
>>Your previous patch worked at least for margins, but new one doesn't work.
>>
> Try it now please. I actually detected the issue just now and was
> planning to submit a new patch. when I saw your message
Thanks for the patch. I tested it, and now it works.
Please see some comments below.
> I actually prefer to create a branch and so on, but I thought that this
> patch would be just a couple of lines (like in my first message). But
> things are never as simple as I would like ;)
Too many troubles with the branch because it requires recompilation
every time after switching the branch. The patch is much simpler ;)
> +(defvar-keymap flymake-mode-map
> + :doc "Keymap for `flymake-mode'."
> + (format "<%s> <mouse-1>" flymake-fringe-indicator-position)
> + #'flymake-show-buffer-diagnostics-at-event-line)
This dependency on 'flymake-fringe-indicator-position' can break
in the case when the user customizes the value
of 'flymake-fringe-indicator-position' to 'right-fringe'.
Then clicking will fail with "<right-fringe> <mouse-1> is undefined".
> + (with-selected-window (posn-window posn)
> + (with-current-buffer (window-buffer)
> + (goto-char pos)
> + (if full-line
> + (flymake-diagnostics (line-beginning-position) (line-end-position))
> + (flymake-diagnostics pos (1+ pos))))))))
I don't know if '(with-selected-window (posn-window posn)' was intended
to handle this case, but clicking on the fringe still raises the error
"Flymake mode is not enabled in the current buffer" when clicking
from the diagnostics buffer.
> +(defcustom flymake-after-jump-hook '(pulse-momentary-highlight-one-line)
> + "Hook called after jumping to a diagnostic line.
> +
> +This hooks are called when `flymake-show-buffer-diagnostics' receives an
> +the optional `diagnostic' argument and it matches an entry in the
> +diagnostic's buffer."
> + :type 'hook
> + :version "31.0")
Please note that this is not direct equivalent to xref-after-jump-hook.
xref-after-jump-hook is more like flymake-show-diagnostic and
flymake-goto-diagnostic that jumps from the diagnostic buffer to the
source buffer. But this hook is about showing the diagnostic buffer.
So a less ambiguous name would be 'flymake-after-show-buffer-diagnostics-hook'.
Then 'pulse-momentary-highlight-one-line' works nicely.
For consistency it could use the same face 'highlight'
as 'pulse-momentary-highlight-region' in 'flymake-show-diagnostic'.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Tue, 28 Jan 2025 13:00:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 75841 <at> debbugs.gnu.org (full text, mbox):
On Mon, Jan 27, 2025 at 09:00:45PM +0200, Juri Linkov wrote:
>>>> Please find attached the patch with the fix + the new feature.
>>>
>>>Your previous patch worked at least for margins, but new one doesn't work.
>>>
>> Try it now please. I actually detected the issue just now and was
>> planning to submit a new patch. when I saw your message
>
>Thanks for the patch. I tested it, and now it works.
>Please see some comments below.
>
>> I actually prefer to create a branch and so on, but I thought that this
>> patch would be just a couple of lines (like in my first message). But
>> things are never as simple as I would like ;)
>
>Too many troubles with the branch because it requires recompilation
>every time after switching the branch. The patch is much simpler ;)
>
It depends ;)
>> +(defvar-keymap flymake-mode-map
>> + :doc "Keymap for `flymake-mode'."
>> + (format "<%s> <mouse-1>" flymake-fringe-indicator-position)
>> + #'flymake-show-buffer-diagnostics-at-event-line)
>
>This dependency on 'flymake-fringe-indicator-position' can break
>in the case when the user customizes the value
>of 'flymake-fringe-indicator-position' to 'right-fringe'.
>Then clicking will fail with "<right-fringe> <mouse-1> is undefined".
>
This works the same way. The previous code didn't support dynamically
change the flymake-fringe-indicator-position. We can try to solve it,
but we go back to the same issue tan in my first patch. We cannot change
the map.
>> + (with-selected-window (posn-window posn)
>> + (with-current-buffer (window-buffer)
>> + (goto-char pos)
>> + (if full-line
>> + (flymake-diagnostics (line-beginning-position) (line-end-position))
>> + (flymake-diagnostics pos (1+ pos))))))))
>
>I don't know if '(with-selected-window (posn-window posn)' was intended
>to handle this case, but clicking on the fringe still raises the error
>"Flymake mode is not enabled in the current buffer" when clicking
>from the diagnostics buffer.
>
I haven't seen this, please tell me how to reproduce it.
>> +(defcustom flymake-after-jump-hook '(pulse-momentary-highlight-one-line)
>> + "Hook called after jumping to a diagnostic line.
>> +
>> +This hooks are called when `flymake-show-buffer-diagnostics' receives an
>> +the optional `diagnostic' argument and it matches an entry in the
>> +diagnostic's buffer."
>> + :type 'hook
>> + :version "31.0")
>
>Please note that this is not direct equivalent to xref-after-jump-hook.
>xref-after-jump-hook is more like flymake-show-diagnostic and
>flymake-goto-diagnostic that jumps from the diagnostic buffer to the
>source buffer. But this hook is about showing the diagnostic buffer.
>So a less ambiguous name would be 'flymake-after-show-buffer-diagnostics-hook'.
>
>Then 'pulse-momentary-highlight-one-line' works nicely.
>For consistency it could use the same face 'highlight'
>as 'pulse-momentary-highlight-region' in 'flymake-show-diagnostic'.
I will include these in the next patch. When I fix the
with-selected-window issue you mention before.
Best,
Ergus
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Tue, 28 Jan 2025 18:20:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 75841 <at> debbugs.gnu.org (full text, mbox):
>>> +(defvar-keymap flymake-mode-map
>>> + :doc "Keymap for `flymake-mode'."
>>> + (format "<%s> <mouse-1>" flymake-fringe-indicator-position)
>>> + #'flymake-show-buffer-diagnostics-at-event-line)
>>
>>This dependency on 'flymake-fringe-indicator-position' can break
>>in the case when the user customizes the value
>>of 'flymake-fringe-indicator-position' to 'right-fringe'.
>>Then clicking will fail with "<right-fringe> <mouse-1> is undefined".
>>
> This works the same way. The previous code didn't support dynamically
> change the flymake-fringe-indicator-position. We can try to solve it,
> but we go back to the same issue tan in my first patch. We cannot change
> the map.
Do you see a problem with binding both initially:
'left-fringe' and 'right-fringe'?
>>> + (with-selected-window (posn-window posn)
>>> + (with-current-buffer (window-buffer)
>>> + (goto-char pos)
>>> + (if full-line
>>> + (flymake-diagnostics (line-beginning-position) (line-end-position))
>>> + (flymake-diagnostics pos (1+ pos))))))))
>>
>>I don't know if '(with-selected-window (posn-window posn)' was intended
>>to handle this case, but clicking on the fringe still raises the error
>>"Flymake mode is not enabled in the current buffer" when clicking
>>from the diagnostics buffer.
>>
> I haven't seen this, please tell me how to reproduce it.
The previous code didn't support this case, so no need to handle this.
I just thought why with-selected-window can't handle the case
when the selected window was the diagnostics buffer, and then
can't click the fringe in the source buffer.
>>> +(defcustom flymake-after-jump-hook '(pulse-momentary-highlight-one-line)
>>> + "Hook called after jumping to a diagnostic line.
>>> +
>>> +This hooks are called when `flymake-show-buffer-diagnostics' receives an
>>> +the optional `diagnostic' argument and it matches an entry in the
>>> +diagnostic's buffer."
>>> + :type 'hook
>>> + :version "31.0")
>>
>>Please note that this is not direct equivalent to xref-after-jump-hook.
>>xref-after-jump-hook is more like flymake-show-diagnostic and
>>flymake-goto-diagnostic that jumps from the diagnostic buffer to the
>>source buffer. But this hook is about showing the diagnostic buffer.
>>So a less ambiguous name would be 'flymake-after-show-buffer-diagnostics-hook'.
>>
>>Then 'pulse-momentary-highlight-one-line' works nicely.
>>For consistency it could use the same face 'highlight'
>>as 'pulse-momentary-highlight-region' in 'flymake-show-diagnostic'.
>
> I will include these in the next patch. When I fix the
> with-selected-window issue you mention before.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Tue, 28 Jan 2025 22:05:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 75841 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Juri:
Please try it now.
This version also fixes what I consider an issue which is moving the
cursor to the mouse click in the cases where there is not diagnostic
(and no action is expected to take place.)
Best,
Ergus
On Tue, Jan 28, 2025 at 08:17:51PM +0200, Juri Linkov wrote:
>>>> +(defvar-keymap flymake-mode-map
>>>> + :doc "Keymap for `flymake-mode'."
>>>> + (format "<%s> <mouse-1>" flymake-fringe-indicator-position)
>>>> + #'flymake-show-buffer-diagnostics-at-event-line)
>>>
>>>This dependency on 'flymake-fringe-indicator-position' can break
>>>in the case when the user customizes the value
>>>of 'flymake-fringe-indicator-position' to 'right-fringe'.
>>>Then clicking will fail with "<right-fringe> <mouse-1> is undefined".
>>>
>> This works the same way. The previous code didn't support dynamically
>> change the flymake-fringe-indicator-position. We can try to solve it,
>> but we go back to the same issue tan in my first patch. We cannot change
>> the map.
>
>Do you see a problem with binding both initially:
>'left-fringe' and 'right-fringe'?
>
>>>> + (with-selected-window (posn-window posn)
>>>> + (with-current-buffer (window-buffer)
>>>> + (goto-char pos)
>>>> + (if full-line
>>>> + (flymake-diagnostics (line-beginning-position) (line-end-position))
>>>> + (flymake-diagnostics pos (1+ pos))))))))
>>>
>>>I don't know if '(with-selected-window (posn-window posn)' was intended
>>>to handle this case, but clicking on the fringe still raises the error
>>>"Flymake mode is not enabled in the current buffer" when clicking
>>>from the diagnostics buffer.
>>>
>> I haven't seen this, please tell me how to reproduce it.
>
>The previous code didn't support this case, so no need to handle this.
>I just thought why with-selected-window can't handle the case
>when the selected window was the diagnostics buffer, and then
>can't click the fringe in the source buffer.
>
>>>> +(defcustom flymake-after-jump-hook '(pulse-momentary-highlight-one-line)
>>>> + "Hook called after jumping to a diagnostic line.
>>>> +
>>>> +This hooks are called when `flymake-show-buffer-diagnostics' receives an
>>>> +the optional `diagnostic' argument and it matches an entry in the
>>>> +diagnostic's buffer."
>>>> + :type 'hook
>>>> + :version "31.0")
>>>
>>>Please note that this is not direct equivalent to xref-after-jump-hook.
>>>xref-after-jump-hook is more like flymake-show-diagnostic and
>>>flymake-goto-diagnostic that jumps from the diagnostic buffer to the
>>>source buffer. But this hook is about showing the diagnostic buffer.
>>>So a less ambiguous name would be 'flymake-after-show-buffer-diagnostics-hook'.
>>>
>>>Then 'pulse-momentary-highlight-one-line' works nicely.
>>>For consistency it could use the same face 'highlight'
>>>as 'pulse-momentary-highlight-region' in 'flymake-show-diagnostic'.
>>
>> I will include these in the next patch. When I fix the
>> with-selected-window issue you mention before.
>
>Thanks.
[flymake-indicator-margin-click_v4.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Wed, 29 Jan 2025 07:52:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 75841 <at> debbugs.gnu.org (full text, mbox):
> Please try it now.
>
> This version also fixes what I consider an issue which is moving the
> cursor to the mouse click in the cases where there is not diagnostic
> (and no action is expected to take place.)
Thanks, I have tried it, and everything work nicely.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Thu, 06 Feb 2025 07:53:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 75841 <at> debbugs.gnu.org (full text, mbox):
> This version also fixes what I consider an issue which is moving the
> cursor to the mouse click in the cases where there is not diagnostic
> (and no action is expected to take place.)
Is this patch ready to push? Can we push it now? I have more
issues with flymake indicators to report, not related to this patch.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Fri, 07 Feb 2025 12:56:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 75841 <at> debbugs.gnu.org (full text, mbox):
On Thu, Feb 06, 2025 at 09:50:33AM +0200, Juri Linkov wrote:
>> This version also fixes what I consider an issue which is moving the
>> cursor to the mouse click in the cases where there is not diagnostic
>> (and no action is expected to take place.)
>
>Is this patch ready to push?
I think so. I haven't detected any new issue.
>Can we push it now? I have more issues with flymake indicators to
>report, not related to this patch.
If you could add a couple of lines in NEWS and check the dockstrings it
is very welcome.
Best,
Ergus
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Mon, 10 Feb 2025 15:47:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 75841 <at> debbugs.gnu.org (full text, mbox):
Hi Juri:
Are you going to push this?
On Thu, Feb 06, 2025 at 09:50:33AM +0200, Juri Linkov wrote:
>> This version also fixes what I consider an issue which is moving the
>> cursor to the mouse click in the cases where there is not diagnostic
>> (and no action is expected to take place.)
>
>Is this patch ready to push? Can we push it now? I have more
>issues with flymake indicators to report, not related to this patch.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Tue, 11 Feb 2025 18:29:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 75841 <at> debbugs.gnu.org (full text, mbox):
>>> This version also fixes what I consider an issue which is moving the
>>> cursor to the mouse click in the cases where there is not diagnostic
>>> (and no action is expected to take place.)
>>
>>Is this patch ready to push?
>
> I think so. I haven't detected any new issue.
>
>>Can we push it now? I have more issues with flymake indicators to
>>report, not related to this patch.
>
> If you could add a couple of lines in NEWS and check the dockstrings it
> is very welcome.
Sorry, still not pushed. Whereas I could write a couple of lines in NEWS,
also we need the ChangeLog message that is much longer.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Sun, 23 Feb 2025 00:19:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 75841 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
>>>> This version also fixes what I consider an issue which is moving the
>>>> cursor to the mouse click in the cases where there is not diagnostic
>>>> (and no action is expected to take place.)
>>>
>>>Is this patch ready to push?
>>
>> I think so. I haven't detected any new issue.
>>
>>>Can we push it now? I have more issues with flymake indicators to
>>>report, not related to this patch.
>>
>> If you could add a couple of lines in NEWS and check the dockstrings it
>> is very welcome.
>
> Sorry, still not pushed. Whereas I could write a couple of lines in NEWS,
> also we need the ChangeLog message that is much longer.
Ergus, could you please resend the patch as an attachment as formatted
by
git format-patch -1
and preferably also with a ChangeLog message as per CONTRIBUTE?
Thanks in advance.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Tue, 25 Feb 2025 00:38:01 GMT)
Full text and
rfc822 format available.
Message #38 received at 75841 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Stefan:
Please find attached the patch.
Best,
Ergus
>
>Ergus, could you please resend the patch as an attachment as formatted
>by
>
> git format-patch -1
>
>and preferably also with a ChangeLog message as per CONTRIBUTE?
>
>Thanks in advance.
[0001-Add-jump-action-to-margin-indicators-in-flymake.patch (text/plain, attachment)]
Changed bug title to '[PATCH] Fix mouse click on flymake' from '[PATCH] [UPDATE3] Fix mouse click on flymake'
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 25 Feb 2025 00:52:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Thu, 27 Mar 2025 18:23:02 GMT)
Full text and
rfc822 format available.
Message #43 received at 75841 <at> debbugs.gnu.org (full text, mbox):
> Hi Stefan:
>
> Please find attached the patch.
I'm not Stefan, but pushed it, thanks for the patch.
However, I can't figure out what to add to NEWS.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Thu, 10 Apr 2025 00:53:01 GMT)
Full text and
rfc822 format available.
Message #46 received at 75841 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
>> Hi Stefan:
>>
>> Please find attached the patch.
>
> I'm not Stefan, but pushed it, thanks for the patch.
> However, I can't figure out what to add to NEWS.
Thanks. Maybe we don't need to add it to NEWS, seeing that this is more
of a bug fix?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Thu, 10 Apr 2025 06:59:01 GMT)
Full text and
rfc822 format available.
Message #49 received at 75841 <at> debbugs.gnu.org (full text, mbox):
close 75841 31.0.50
thanks
> Maybe we don't need to add it to NEWS, seeing that this is more
> of a bug fix?
Maybe. So now closing this bug fix.
bug marked as fixed in version 31.0.50, send any further explanations to
75841 <at> debbugs.gnu.org and Ergus <spacibba <at> aol.com>
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org
.
(Thu, 10 Apr 2025 06:59:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75841
; Package
emacs
.
(Sun, 20 Apr 2025 22:32:04 GMT)
Full text and
rfc822 format available.
Message #54 received at 75841 <at> debbugs.gnu.org (full text, mbox):
Hello,
The functionality of this change is very welcome, however its
implementation broke Flymake for any Emacs < 29.1 due to use of bleeding
edge constructs. It also introduces a number of undocumented API entry
points.
I've addressed these and other problems ahead of releasing version 1.4.0
of the Flymake :core package, which would have published those
implementation details and make them harder to roll back.
A possibly contentious point is the removal of a hook (undocumented in
the manual) which was run when a specific function was called with
specific arguments. A regular user is oblivious to these details and
the hook isn't needed to implement the change.
If the hook is indeed needed think a case for this hook must be made
separately. I didn't find this in the bug thread.
That said, I tested all the new "jump and reveal" functionality and
verified it is working correctly (from the fringe, the margin, the
source buffer). I've documented in the manual and in the NEWS file.
Please see the commit log for more details.
commit 3001d50d9ae6e41b3f1d8e576b13a85198f60da9
Author: João Távora <joaotavora <at> gmail.com>
Date: Sun Apr 20 13:29:26 2025 +0100
Flymake: rework, simplify and address problems of recent change (bug#75841)
Thanks,
João.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 19 May 2025 11:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 25 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.