GNU bug report logs - #69809
30.0.50; flymake: error in process sentinel

Previous Next

Package: emacs;

Reported by: Gerd Möllmann <gerd.moellmann <at> gmail.com>

Date: Fri, 15 Mar 2024 07:11:02 UTC

Severity: normal

Found in version 30.0.50

Done: João Távora <joaotavora <at> gmail.com>

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 69809 in the body.
You can then email your comments to 69809 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Fri, 15 Mar 2024 07:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gerd Möllmann <gerd.moellmann <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 15 Mar 2024 07:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; flymake: error in process sentinel
Date: Fri, 15 Mar 2024 08:09:40 +0100
In master, I am sometimes getting errors like these:

  error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
  error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
  error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
  error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
  error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
  error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’

when working with C files.

I haven't configured anything for Flymake myself. I think Flymake gets
involved by using Eglot. The errors apparently don't prevent flymake
from working later on.

I have looked around in flymake docs and source, but I can't figure out
what's wrong.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Thu, 21 Mar 2024 10:25:02 GMT) Full text and rfc822 format available.

Message #8 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
 Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 69809 <at> debbugs.gnu.org
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Thu, 21 Mar 2024 12:23:56 +0200
> From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
> Date: Fri, 15 Mar 2024 08:09:40 +0100
> 
> In master, I am sometimes getting errors like these:
> 
>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
> 
> when working with C files.
> 
> I haven't configured anything for Flymake myself. I think Flymake gets
> involved by using Eglot. The errors apparently don't prevent flymake
> from working later on.
> 
> I have looked around in flymake docs and source, but I can't figure out
> what's wrong.

Spencer, any suggestions?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Sat, 23 Mar 2024 14:11:03 GMT) Full text and rfc822 format available.

Message #11 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: sbaugh <at> catern.com
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
 Spencer Baugh <sbaugh <at> janestreet.com>, 69809 <at> debbugs.gnu.org
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Sat, 23 Mar 2024 14:02:02 +0000 (UTC)
> From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
> Date: Fri, 15 Mar 2024 08:09:40 +0100
> 
> In master, I am sometimes getting errors like these:
> 
>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
> 
> when working with C files.
> 
> I haven't configured anything for Flymake myself. I think Flymake gets
> involved by using Eglot. The errors apparently don't prevent flymake
> from working later on.
> 
> I have looked around in flymake docs and source, but I can't figure out
> what's wrong.

It would be helpful if you could provide a minimal reproduction starting
from "emacs -q".

My immediate suspicion is that flymake-mode is (somehow) enabled in your
C files while flymake-diagnostic-functions is set to contain flymake-cc,
which causes flymake-cc to start up a background process.  Then,
flymake-mode is enabled again by eglot--managed-mode, which causes
flymake--state to be cleared, so when flymake-cc tries to report
diagnostics from that background process through flymake--handle-report,
it fails.

But I can't be sure whether this is due to a bug in Emacs or due to a
bug in your config without a more minimal reproduction.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Sat, 23 Mar 2024 14:23:02 GMT) Full text and rfc822 format available.

Message #14 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: sbaugh <at> catern.com
Cc: Spencer Baugh <sbaugh <at> janestreet.com>, Eli Zaretskii <eliz <at> gnu.org>,
 69809 <at> debbugs.gnu.org
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Sat, 23 Mar 2024 15:20:41 +0100
sbaugh <at> catern.com writes:

>> From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
>> Date: Fri, 15 Mar 2024 08:09:40 +0100
>>
>> In master, I am sometimes getting errors like these:
>>
>>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
>>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
>>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
>>
>> when working with C files.
>>
>> I haven't configured anything for Flymake myself. I think Flymake gets
>> involved by using Eglot. The errors apparently don't prevent flymake
>> from working later on.
>>
>> I have looked around in flymake docs and source, but I can't figure out
>> what's wrong.
>
> It would be helpful if you could provide a minimal reproduction starting
> from "emacs -q".

I know, but I can't reproduce it at will. And debug-on-error didn't help
catch it in the act, maybe there is some condition-case involved
somewhere that should have better been a condition-case-unless-debug.

> My immediate suspicion is that flymake-mode is (somehow) enabled in your
> C files while flymake-diagnostic-functions is set to contain flymake-cc,
> which causes flymake-cc to start up a background process.  Then,
> flymake-mode is enabled again by eglot--managed-mode, which causes
> flymake--state to be cleared, so when flymake-cc tries to report
> diagnostics from that background process through flymake--handle-report,
> it fails.
>
> But I can't be sure whether this is due to a bug in Emacs or due to a
> bug in your config without a more minimal reproduction.

No config using flymake and none for eglot. The only thing I did is
put eglot-ensure on c-mode-common-hook.

Maybe I can catch it in LLDB somehow, but that will have to wait a bit,
unfortunately.

Anyway, thanks for the replay.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Thu, 11 Jul 2024 09:46:02 GMT) Full text and rfc822 format available.

Message #17 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Eshel Yaron <me <at> eshelyaron.com>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: sbaugh <at> catern.com, Eli Zaretskii <eliz <at> gnu.org>, 69809 <at> debbugs.gnu.org,
 Spencer Baugh <sbaugh <at> janestreet.com>
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Thu, 11 Jul 2024 11:45:46 +0200
Hi,

Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

> sbaugh <at> catern.com writes:
>
>>> From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
>>> Date: Fri, 15 Mar 2024 08:09:40 +0100
>>>
>>> In master, I am sometimes getting errors like these:
>>>
>>>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>>>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
>>>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>>>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
>>>   error in process sentinel: flymake--handle-report: Can’t find state for flymake-cc in ‘flymake--state’
>>>   error in process sentinel: Can’t find state for flymake-cc in ‘flymake--state’
>>>
>>> when working with C files.
>>>
>>> I haven't configured anything for Flymake myself. I think Flymake gets
>>> involved by using Eglot. The errors apparently don't prevent flymake
>>> from working later on.
>>>
>>> I have looked around in flymake docs and source, but I can't figure out
>>> what's wrong.
>>
>> It would be helpful if you could provide a minimal reproduction starting
>> from "emacs -q".
>
> I know, but I can't reproduce it at will. And debug-on-error didn't help
> catch it in the act, maybe there is some condition-case involved
> somewhere that should have better been a condition-case-unless-debug.
>
>> My immediate suspicion is that flymake-mode is (somehow) enabled in your
>> C files while flymake-diagnostic-functions is set to contain flymake-cc,
>> which causes flymake-cc to start up a background process.  Then,
>> flymake-mode is enabled again by eglot--managed-mode, which causes
>> flymake--state to be cleared, so when flymake-cc tries to report
>> diagnostics from that background process through flymake--handle-report,
>> it fails.
>>
>> But I can't be sure whether this is due to a bug in Emacs or due to a
>> bug in your config without a more minimal reproduction.
>
> No config using flymake and none for eglot. The only thing I did is
> put eglot-ensure on c-mode-common-hook.
>
> Maybe I can catch it in LLDB somehow, but that will have to wait a bit,
> unfortunately.
>
> Anyway, thanks for the replay.

This issue bothered me as well.  Here's a recipe for reproducing on
master, with emacs -Q:

1. (add-hook 'c-mode-hook 'flymake-mode)
2. (add-hook 'c-mode-hook 'eglot-ensure)
3. Find some C file

This happens because Eglot _restarts_ flymake-mode while flymake-cc's
process is already running.  Here's a simple fix:

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index a893a8d749a..c9e1bb7b52d 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2040,7 +2040,7 @@ eglot--managed-mode
     (unless (eglot--stay-out-of-p 'imenu)
       (add-function :before-until (local 'imenu-create-index-function)
                     #'eglot-imenu))
-    (unless (eglot--stay-out-of-p 'flymake) (flymake-mode 1))
+    (unless (or (eglot--stay-out-of-p 'flymake) flymake-mode) (flymake-mode 1))
     (unless (eglot--stay-out-of-p 'eldoc)
       (add-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function
                 nil t)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Thu, 11 Jul 2024 11:16:01 GMT) Full text and rfc822 format available.

Message #20 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Eshel Yaron <me <at> eshelyaron.com>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: sbaugh <at> catern.com, Eli Zaretskii <eliz <at> gnu.org>, 69809 <at> debbugs.gnu.org,
 Spencer Baugh <sbaugh <at> janestreet.com>
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Thu, 11 Jul 2024 13:15:41 +0200
Eshel Yaron <me <at> eshelyaron.com> writes:

[...]

> This issue bothered me as well.  Here's a recipe for reproducing on
> master, with emacs -Q:
>
> 1. (add-hook 'c-mode-hook 'flymake-mode)
> 2. (add-hook 'c-mode-hook 'eglot-ensure)
> 3. Find some C file
>
> This happens because Eglot _restarts_ flymake-mode while flymake-cc's
> process is already running.  Here's a simple fix:
>
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index a893a8d749a..c9e1bb7b52d 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -2040,7 +2040,7 @@ eglot--managed-mode
>      (unless (eglot--stay-out-of-p 'imenu)
>        (add-function :before-until (local 'imenu-create-index-function)
>                      #'eglot-imenu))
> -    (unless (eglot--stay-out-of-p 'flymake) (flymake-mode 1))
> +    (unless (or (eglot--stay-out-of-p 'flymake) flymake-mode) (flymake-mode 1))
>      (unless (eglot--stay-out-of-p 'eldoc)
>        (add-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function
>                  nil t)

I realized that the change above has the downside of no longer
immediately initiating a Flymake analysis with Eglot in place.  To
preserve that behavior, maybe something like the following is better:

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index a893a8d749a..6cd48917d47 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2040,7 +2040,8 @@ eglot--managed-mode
     (unless (eglot--stay-out-of-p 'imenu)
       (add-function :before-until (local 'imenu-create-index-function)
                     #'eglot-imenu))
-    (unless (eglot--stay-out-of-p 'flymake) (flymake-mode 1))
+    (unless (eglot--stay-out-of-p 'flymake)
+      (if flymake-mode (flymake-start) (flymake-mode 1)))
     (unless (eglot--stay-out-of-p 'eldoc)
       (add-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function
                 nil t)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Thu, 11 Jul 2024 11:49:02 GMT) Full text and rfc822 format available.

Message #23 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: sbaugh <at> catern.com, Eli Zaretskii <eliz <at> gnu.org>,
 Spencer Baugh <sbaugh <at> janestreet.com>, 69809 <at> debbugs.gnu.org
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Thu, 11 Jul 2024 13:46:59 +0200
Eshel Yaron <me <at> eshelyaron.com> writes:

> I realized that the change above has the downside of no longer
> immediately initiating a Flymake analysis with Eglot in place.  To
> preserve that behavior, maybe something like the following is better:
>
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index a893a8d749a..6cd48917d47 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -2040,7 +2040,8 @@ eglot--managed-mode
>      (unless (eglot--stay-out-of-p 'imenu)
>        (add-function :before-until (local 'imenu-create-index-function)
>                      #'eglot-imenu))
> -    (unless (eglot--stay-out-of-p 'flymake) (flymake-mode 1))
> +    (unless (eglot--stay-out-of-p 'flymake)
> +      (if flymake-mode (flymake-start) (flymake-mode 1)))
>      (unless (eglot--stay-out-of-p 'eldoc)
>        (add-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function
>                  nil t)

Makes sense 👍. Thanks Eshel!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Fri, 12 Jul 2024 06:28:02 GMT) Full text and rfc822 format available.

Message #26 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: gerd.moellmann <at> gmail.com, sbaugh <at> catern.com, 69809 <at> debbugs.gnu.org,
 sbaugh <at> janestreet.com
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Fri, 12 Jul 2024 09:27:26 +0300
> From: Eshel Yaron <me <at> eshelyaron.com>
> Cc: sbaugh <at> catern.com,  Spencer Baugh <sbaugh <at> janestreet.com>,  Eli
>  Zaretskii <eliz <at> gnu.org>,  69809 <at> debbugs.gnu.org
> Date: Thu, 11 Jul 2024 13:15:41 +0200
> 
> Eshel Yaron <me <at> eshelyaron.com> writes:
> 
> [...]
> 
> > This issue bothered me as well.  Here's a recipe for reproducing on
> > master, with emacs -Q:
> >
> > 1. (add-hook 'c-mode-hook 'flymake-mode)
> > 2. (add-hook 'c-mode-hook 'eglot-ensure)
> > 3. Find some C file
> >
> > This happens because Eglot _restarts_ flymake-mode while flymake-cc's
> > process is already running.  Here's a simple fix:
> >
> > diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> > index a893a8d749a..c9e1bb7b52d 100644
> > --- a/lisp/progmodes/eglot.el
> > +++ b/lisp/progmodes/eglot.el
> > @@ -2040,7 +2040,7 @@ eglot--managed-mode
> >      (unless (eglot--stay-out-of-p 'imenu)
> >        (add-function :before-until (local 'imenu-create-index-function)
> >                      #'eglot-imenu))
> > -    (unless (eglot--stay-out-of-p 'flymake) (flymake-mode 1))
> > +    (unless (or (eglot--stay-out-of-p 'flymake) flymake-mode) (flymake-mode 1))
> >      (unless (eglot--stay-out-of-p 'eldoc)
> >        (add-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function
> >                  nil t)
> 
> I realized that the change above has the downside of no longer
> immediately initiating a Flymake analysis with Eglot in place.  To
> preserve that behavior, maybe something like the following is better:
> 
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index a893a8d749a..6cd48917d47 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -2040,7 +2040,8 @@ eglot--managed-mode
>      (unless (eglot--stay-out-of-p 'imenu)
>        (add-function :before-until (local 'imenu-create-index-function)
>                      #'eglot-imenu))
> -    (unless (eglot--stay-out-of-p 'flymake) (flymake-mode 1))
> +    (unless (eglot--stay-out-of-p 'flymake)
> +      (if flymake-mode (flymake-start) (flymake-mode 1)))
>      (unless (eglot--stay-out-of-p 'eldoc)
>        (add-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function
>                  nil t)

Spencer, any comments?

From where I stand, this is okay for the emacs-30 release branch,
unless you think it could break some legitimate workflow.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Tue, 16 Jul 2024 20:49:02 GMT) Full text and rfc822 format available.

Message #29 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: gerd.moellmann <at> gmail.com, sbaugh <at> catern.com,
 Eshel Yaron <me <at> eshelyaron.com>, 69809 <at> debbugs.gnu.org
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Tue, 16 Jul 2024 16:48:25 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Eshel Yaron <me <at> eshelyaron.com>
>> Cc: sbaugh <at> catern.com,  Spencer Baugh <sbaugh <at> janestreet.com>,  Eli
>>  Zaretskii <eliz <at> gnu.org>,  69809 <at> debbugs.gnu.org
>> Date: Thu, 11 Jul 2024 13:15:41 +0200
>> 
>> Eshel Yaron <me <at> eshelyaron.com> writes:
>> 
>> [...]
>> 
>> > This issue bothered me as well.  Here's a recipe for reproducing on
>> > master, with emacs -Q:
>> >
>> > 1. (add-hook 'c-mode-hook 'flymake-mode)
>> > 2. (add-hook 'c-mode-hook 'eglot-ensure)
>> > 3. Find some C file
>> >
>> > This happens because Eglot _restarts_ flymake-mode while flymake-cc's
>> > process is already running.  Here's a simple fix:
>> >
>> > diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
>> > index a893a8d749a..c9e1bb7b52d 100644
>> > --- a/lisp/progmodes/eglot.el
>> > +++ b/lisp/progmodes/eglot.el
>> > @@ -2040,7 +2040,7 @@ eglot--managed-mode
>> >      (unless (eglot--stay-out-of-p 'imenu)
>> >        (add-function :before-until (local 'imenu-create-index-function)
>> >                      #'eglot-imenu))
>> > -    (unless (eglot--stay-out-of-p 'flymake) (flymake-mode 1))
>> > +    (unless (or (eglot--stay-out-of-p 'flymake) flymake-mode) (flymake-mode 1))
>> >      (unless (eglot--stay-out-of-p 'eldoc)
>> >        (add-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function
>> >                  nil t)
>> 
>> I realized that the change above has the downside of no longer
>> immediately initiating a Flymake analysis with Eglot in place.  To
>> preserve that behavior, maybe something like the following is better:
>> 
>> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
>> index a893a8d749a..6cd48917d47 100644
>> --- a/lisp/progmodes/eglot.el
>> +++ b/lisp/progmodes/eglot.el
>> @@ -2040,7 +2040,8 @@ eglot--managed-mode
>>      (unless (eglot--stay-out-of-p 'imenu)
>>        (add-function :before-until (local 'imenu-create-index-function)
>>                      #'eglot-imenu))
>> -    (unless (eglot--stay-out-of-p 'flymake) (flymake-mode 1))
>> +    (unless (eglot--stay-out-of-p 'flymake)
>> +      (if flymake-mode (flymake-start) (flymake-mode 1)))
>>      (unless (eglot--stay-out-of-p 'eldoc)
>>        (add-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function
>>                  nil t)
>
> Spencer, any comments?
>
> From where I stand, this is okay for the emacs-30 release branch,
> unless you think it could break some legitimate workflow.

Yes, this seems good for emacs-30.  Thanks Eshel!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Wed, 17 Jul 2024 06:13:01 GMT) Full text and rfc822 format available.

Message #32 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Eshel Yaron <me <at> eshelyaron.com>
To: Spencer Baugh <sbaugh <at> janestreet.com>, João Távora
 <joaotavora <at> gmail.com>
Cc: gerd.moellmann <at> gmail.com, sbaugh <at> catern.com, Eli Zaretskii <eliz <at> gnu.org>,
 69809 <at> debbugs.gnu.org
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Wed, 17 Jul 2024 08:12:39 +0200
Spencer Baugh <sbaugh <at> janestreet.com> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> From: Eshel Yaron <me <at> eshelyaron.com>
>>>
>>> [...]maybe something like the following is better:
>>> 
>>> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
>>> index a893a8d749a..6cd48917d47 100644
>>> --- a/lisp/progmodes/eglot.el
>>> +++ b/lisp/progmodes/eglot.el
>>> @@ -2040,7 +2040,8 @@ eglot--managed-mode
>>>      (unless (eglot--stay-out-of-p 'imenu)
>>>        (add-function :before-until (local 'imenu-create-index-function)
>>>                      #'eglot-imenu))
>>> -    (unless (eglot--stay-out-of-p 'flymake) (flymake-mode 1))
>>> +    (unless (eglot--stay-out-of-p 'flymake)
>>> +      (if flymake-mode (flymake-start) (flymake-mode 1)))
>>>      (unless (eglot--stay-out-of-p 'eldoc)
>>>        (add-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function
>>>                  nil t)
>>
>> Spencer, any comments?
>>
>> From where I stand, this is okay for the emacs-30 release branch,
>> unless you think it could break some legitimate workflow.
>
> Yes, this seems good for emacs-30.  Thanks Eshel!

Great, thanks.  Since this is a change in eglot.el, let me also ask João
before installing: João, any objections to the change above?


Cheers,

Eshel




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Wed, 17 Jul 2024 08:23:02 GMT) Full text and rfc822 format available.

Message #35 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: gerd.moellmann <at> gmail.com, Spencer Baugh <sbaugh <at> janestreet.com>,
 Eli Zaretskii <eliz <at> gnu.org>, 69809 <at> debbugs.gnu.org, sbaugh <at> catern.com
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Wed, 17 Jul 2024 09:20:40 +0100
On Wed, Jul 17, 2024 at 7:12 AM Eshel Yaron <me <at> eshelyaron.com> wrote:

> > Yes, this seems good for emacs-30.  Thanks Eshel!
> Great, thanks.  Since this is a change in eglot.el, let me also ask João
> before installing: João, any objections to the change above?

I'd like to understand what problem it is solving.

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Wed, 17 Jul 2024 09:09:01 GMT) Full text and rfc822 format available.

Message #38 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: gerd.moellmann <at> gmail.com, Spencer Baugh <sbaugh <at> janestreet.com>,
 Eli Zaretskii <eliz <at> gnu.org>, 69809 <at> debbugs.gnu.org, sbaugh <at> catern.com
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Wed, 17 Jul 2024 10:07:30 +0100
On Wed, Jul 17, 2024 at 9:20 AM João Távora <joaotavora <at> gmail.com> wrote:
>
> On Wed, Jul 17, 2024 at 7:12 AM Eshel Yaron <me <at> eshelyaron.com> wrote:
>
> > > Yes, this seems good for emacs-30.  Thanks Eshel!
> > Great, thanks.  Since this is a change in eglot.el, let me also ask João
> > before installing: João, any objections to the change above?
>
> I'd like to understand what problem it is solving.

I've read a bit of the thread.  There seems to be an error involved,
but I didn't see a backtrace for this error.  Can someone produce it?

There's also some conjecture about interference related to
eglot-ensure.  Is it_only_ related to `eglot-ensure`?  How?

This part of Eglot is extremely delicate. I spent many hours making
sure the checks start only when they should, results of previous checks
are properly erased, etc.  This is because the Eglot Flymake backend
doesn't real work like other backends in that it cannot issue an order
to the LSP server (at least in most servers it can't) to provide diagnostics.

So I need to understand the problem and its impact in detail.

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Wed, 17 Jul 2024 13:09:01 GMT) Full text and rfc822 format available.

Message #41 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Eshel Yaron <me <at> eshelyaron.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: gerd.moellmann <at> gmail.com, Spencer Baugh <sbaugh <at> janestreet.com>,
 Eli Zaretskii <eliz <at> gnu.org>, 69809 <at> debbugs.gnu.org, sbaugh <at> catern.com
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Wed, 17 Jul 2024 15:08:51 +0200
Hi João,

João Távora <joaotavora <at> gmail.com> writes:

> On Wed, Jul 17, 2024 at 9:20 AM João Távora <joaotavora <at> gmail.com> wrote:
>>
>> On Wed, Jul 17, 2024 at 7:12 AM Eshel Yaron <me <at> eshelyaron.com> wrote:
>>
>> > > Yes, this seems good for emacs-30.  Thanks Eshel!
>> > Great, thanks.  Since this is a change in eglot.el, let me also ask João
>> > before installing: João, any objections to the change above?
>>
>> I'd like to understand what problem it is solving.
>
> I've read a bit of the thread.  There seems to be an error involved,
> but I didn't see a backtrace for this error.  Can someone produce it?

Sure, here's one (also see the recipe I posted upthread):

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (error "Can’t find state for flymake-cc in ‘flymake--state’")
  signal(error ("Can’t find state for flymake-cc in ‘flymake--state’"))
  error("Can't find state for %s in `flymake--state'" flymake-cc)
  (or (gethash backend flymake--state) (error "Can't find state for %s in `flymake--state'" backend))
  (let ((state (or (gethash backend flymake--state) (error "Can't find state for %s in `flymake--state'" backend))) expected-token) (cond ((null state) (flymake-error "Unexpected report from unknown backend %s" backend)) ((let* ((cl-x state)) (progn (or (let* ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-flymake--state-tags) t))) (signal 'wrong-type-argument (list 'flymake--state cl-x))) (aref cl-x 3))) (flymake-error "Unexpected report from disabled backend %s" backend)) ((progn (setq expected-token (let* ((cl-x state)) (progn (or (let* ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-flymake--state-tags) t))) (signal 'wrong-type-argument (list 'flymake--state cl-x))) (aref cl-x 1)))) (null expected-token)) (flymake-error "Unexpected report from stopped backend %s" backend)) ((not (or (eq expected-token token) force)) (flymake-error "Obsolete report from backend %s with explanation %s" backend explanation)) ((eq :panic report-action) (flymake--disable-backend backend explanation)) ((not (listp report-action)) (flymake--disable-backend backend (format "Unknown action %S" report-action)) (flymake-error "Expected report, but got unknown key %s" report-action)) (t (flymake--publish-diagnostics report-action :backend backend :state state :region region) (if flymake-check-start-time (progn (flymake--log-1 :debug 'flymake "backend %s reported %d diagnostics in %.2f second(s)" backend (length report-action) (float-time (time-since flymake-check-start-time))))))) (let* ((cl-x state)) (or (let* ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-flymake--state-tags) t))) (signal 'wrong-type-argument (list 'flymake--state cl-x))) (let* ((v cl-x)) (aset v 2 t))) (if (and flymake-show-diagnostics-at-end-of-line (not (cl-set-difference (flymake-running-backends) (flymake-reporting-backends)))) (progn (flymake--update-eol-overlays))) (flymake--update-diagnostics-listings (current-buffer)))
  (let* ((explanation (car (cdr (plist-member --cl-rest-- ':explanation)))) (force (car (cdr (plist-member --cl-rest-- ':force)))) (region (car (cdr (plist-member --cl-rest-- ':region))))) (let ((state (or (gethash backend flymake--state) (error "Can't find state for %s in `flymake--state'" backend))) expected-token) (cond ((null state) (flymake-error "Unexpected report from unknown backend %s" backend)) ((let* ((cl-x state)) (progn (or (let* ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-flymake--state-tags) t))) (signal 'wrong-type-argument (list 'flymake--state cl-x))) (aref cl-x 3))) (flymake-error "Unexpected report from disabled backend %s" backend)) ((progn (setq expected-token (let* ((cl-x state)) (progn (or (let* ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-flymake--state-tags) t))) (signal 'wrong-type-argument (list 'flymake--state cl-x))) (aref cl-x 1)))) (null expected-token)) (flymake-error "Unexpected report from stopped backend %s" backend)) ((not (or (eq expected-token token) force)) (flymake-error "Obsolete report from backend %s with explanation %s" backend explanation)) ((eq :panic report-action) (flymake--disable-backend backend explanation)) ((not (listp report-action)) (flymake--disable-backend backend (format "Unknown action %S" report-action)) (flymake-error "Expected report, but got unknown key %s" report-action)) (t (flymake--publish-diagnostics report-action :backend backend :state state :region region) (if flymake-check-start-time (progn (flymake--log-1 :debug 'flymake "backend %s reported %d diagnostics in %.2f second(s)" backend (length report-action) (float-time (time-since flymake-check-start-time))))))) (let* ((cl-x state)) (or (let* ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-flymake--state-tags) t))) (signal 'wrong-type-argument (list 'flymake--state cl-x))) (let* ((v cl-x)) (aset v 2 t))) (if (and flymake-show-diagnostics-at-end-of-line (not (cl-set-difference (flymake-running-backends) (flymake-reporting-backends)))) (progn (flymake--update-eol-overlays))) (flymake--update-diagnostics-listings (current-buffer))))
  flymake--handle-report(flymake-cc backend-token6 nil)
  apply(flymake--handle-report flymake-cc backend-token6 nil)
  (save-current-buffer (set-buffer buffer) (apply #'flymake--handle-report backend token args))
  (progn (save-current-buffer (set-buffer buffer) (apply #'flymake--handle-report backend token args)))
  (if (buffer-live-p buffer) (progn (save-current-buffer (set-buffer buffer) (apply #'flymake--handle-report backend token args))))
  #f(lambda (&rest args) [(buffer #<buffer search.c>) (token backend-token6) (backend flymake-cc)] (if (buffer-live-p buffer) (progn (save-current-buffer (set-buffer buffer) (apply #'flymake--handle-report backend token args)))))(nil)
  funcall(#f(lambda (&rest args) [(buffer #<buffer search.c>) (token backend-token6) (backend flymake-cc)] (if (buffer-live-p buffer) (progn (save-current-buffer (set-buffer buffer) (apply #'flymake--handle-report backend token args))))) nil)
  (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position)))))
  (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position))))))
  (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position)))))))
  (progn (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position))))))))
  (if (save-current-buffer (set-buffer source) (eq p flymake-cc--proc)) (progn (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position)))))))))
  (progn (if (save-current-buffer (set-buffer source) (eq p flymake-cc--proc)) (progn (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position))))))))))
  (if (eq 'exit (process-status p)) (progn (if (save-current-buffer (set-buffer source) (eq p flymake-cc--proc)) (progn (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position)))))))))))
  (unwind-protect (if (eq 'exit (process-status p)) (progn (if (save-current-buffer (set-buffer source) (eq p flymake-cc--proc)) (progn (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position))))))))))) (if (process-live-p p) nil (kill-buffer (process-buffer p))))
  #f(lambda (p _ev) [(source #<buffer search.c>) (report-fn #f(lambda (&rest args) [(buffer #<buffer search.c>) (token backend-token6) (backend flymake-cc)] (if (buffer-live-p buffer) (progn (save-current-buffer (set-buffer buffer) (apply #'flymake--handle-report backend token args))))))] (unwind-protect (if (eq 'exit (process-status p)) (progn (if (save-current-buffer (set-buffer source) (eq p flymake-cc--proc)) (progn (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position))))))))))) (if (process-live-p p) nil (kill-buffer (process-buffer p)))))(#<process gcc-flymake> "finished\n")
--8<---------------cut here---------------end--------------->8---




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Wed, 17 Jul 2024 13:46:01 GMT) Full text and rfc822 format available.

Message #44 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: gerd.moellmann <at> gmail.com, Spencer Baugh <sbaugh <at> janestreet.com>,
 Eli Zaretskii <eliz <at> gnu.org>, 69809 <at> debbugs.gnu.org, sbaugh <at> catern.com
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Wed, 17 Jul 2024 14:44:11 +0100
On Wed, Jul 17, 2024 at 2:08 PM Eshel Yaron <me <at> eshelyaron.com> wrote:
>
> Hi João,
>
> João Távora <joaotavora <at> gmail.com> writes:
>
> > On Wed, Jul 17, 2024 at 9:20 AM João Távora <joaotavora <at> gmail.com> wrote:
> >>
> >> On Wed, Jul 17, 2024 at 7:12 AM Eshel Yaron <me <at> eshelyaron.com> wrote:
> >>
> >> > > Yes, this seems good for emacs-30.  Thanks Eshel!
> >> > Great, thanks.  Since this is a change in eglot.el, let me also ask João
> >> > before installing: João, any objections to the change above?
> >>
> >> I'd like to understand what problem it is solving.
> >
> > I've read a bit of the thread.  There seems to be an error involved,
> > but I didn't see a backtrace for this error.  Can someone produce it?
>
> Sure, here's one (also see the recipe I posted upthread):

Thanks. Is the backtrace below what's unequivocally (or close)
produced by that recipe?

Anyway, can you try this patch?

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index e72f25fd0cd..74db9b56dd9 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -991,7 +991,7 @@ flymake--highlight-line
 ;; third-party compatibility.
 (define-obsolete-function-alias 'flymake-display-warning 'message-box "26.1")

-(defvar-local flymake--state nil
+(defvar-local flymake--state (make-hash-table)
   "State of a buffer's multiple Flymake backends.
 The keys to this hash table are functions as found in
 `flymake-diagnostic-functions'.  The values are structures
@@ -1396,7 +1396,6 @@ flymake-mode
     ;; reinitializing `flymake--state' in the next line.
     ;; See https://github.com/joaotavora/eglot/issues/223.
     (mapc #'flymake--delete-overlay (flymake--really-all-overlays))
-    (setq flymake--state (make-hash-table))
     (setq flymake--recent-changes nil)

     (when flymake-start-on-flymake-mode (flymake-start t))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Wed, 17 Jul 2024 17:26:02 GMT) Full text and rfc822 format available.

Message #47 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Eshel Yaron <me <at> eshelyaron.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: gerd.moellmann <at> gmail.com, Spencer Baugh <sbaugh <at> janestreet.com>,
 Eli Zaretskii <eliz <at> gnu.org>, 69809 <at> debbugs.gnu.org, sbaugh <at> catern.com
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Wed, 17 Jul 2024 19:25:39 +0200
João Távora <joaotavora <at> gmail.com> writes:

> On Wed, Jul 17, 2024 at 2:08 PM Eshel Yaron <me <at> eshelyaron.com> wrote:
>>
>> Hi João,
>>
>> João Távora <joaotavora <at> gmail.com> writes:
>>
>> > On Wed, Jul 17, 2024 at 9:20 AM João Távora <joaotavora <at> gmail.com> wrote:
>> >>
>> >> On Wed, Jul 17, 2024 at 7:12 AM Eshel Yaron <me <at> eshelyaron.com> wrote:
>> >>
>> >> > > Yes, this seems good for emacs-30.  Thanks Eshel!
>> >> > Great, thanks.  Since this is a change in eglot.el, let me also ask João
>> >> > before installing: João, any objections to the change above?
>> >>
>> >> I'd like to understand what problem it is solving.
>> >
>> > I've read a bit of the thread.  There seems to be an error involved,
>> > but I didn't see a backtrace for this error.  Can someone produce it?
>>
>> Sure, here's one (also see the recipe I posted upthread):
>
> Thanks. Is the backtrace below what's unequivocally (or close)
> produced by that recipe?

Yes, that's what I see.

> Anyway, can you try this patch?

That seems to work too :)

> diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
> index e72f25fd0cd..74db9b56dd9 100644
> --- a/lisp/progmodes/flymake.el
> +++ b/lisp/progmodes/flymake.el
> @@ -991,7 +991,7 @@ flymake--highlight-line
>  ;; third-party compatibility.
>  (define-obsolete-function-alias 'flymake-display-warning 'message-box "26.1")
>
> -(defvar-local flymake--state nil
> +(defvar-local flymake--state (make-hash-table)
>    "State of a buffer's multiple Flymake backends.
>  The keys to this hash table are functions as found in
>  `flymake-diagnostic-functions'.  The values are structures
> @@ -1396,7 +1396,6 @@ flymake-mode
>      ;; reinitializing `flymake--state' in the next line.
>      ;; See https://github.com/joaotavora/eglot/issues/223.
>      (mapc #'flymake--delete-overlay (flymake--really-all-overlays))
> -    (setq flymake--state (make-hash-table))
>      (setq flymake--recent-changes nil)
>
>      (when flymake-start-on-flymake-mode (flymake-start t))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Wed, 17 Jul 2024 17:40:01 GMT) Full text and rfc822 format available.

Message #50 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: gerd.moellmann <at> gmail.com, Spencer Baugh <sbaugh <at> janestreet.com>,
 Eli Zaretskii <eliz <at> gnu.org>, 69809 <at> debbugs.gnu.org, sbaugh <at> catern.com
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Wed, 17 Jul 2024 18:38:27 +0100
On Wed, Jul 17, 2024 at 6:25 PM Eshel Yaron <me <at> eshelyaron.com> wrote:
>
> João Távora <joaotavora <at> gmail.com> writes:
>
> > On Wed, Jul 17, 2024 at 2:08 PM Eshel Yaron <me <at> eshelyaron.com> wrote:
> >>
> >> Hi João,
> >>
> >> João Távora <joaotavora <at> gmail.com> writes:
> >>
> >> > On Wed, Jul 17, 2024 at 9:20 AM João Távora <joaotavora <at> gmail.com> wrote:
> >> >>
> >> >> On Wed, Jul 17, 2024 at 7:12 AM Eshel Yaron <me <at> eshelyaron.com> wrote:
> >> >>
> >> >> > > Yes, this seems good for emacs-30.  Thanks Eshel!
> >> >> > Great, thanks.  Since this is a change in eglot.el, let me also ask João
> >> >> > before installing: João, any objections to the change above?
> >> >>
> >> >> I'd like to understand what problem it is solving.
> >> >
> >> > I've read a bit of the thread.  There seems to be an error involved,
> >> > but I didn't see a backtrace for this error.  Can someone produce it?
> >>
> >> Sure, here's one (also see the recipe I posted upthread):
> >
> > Thanks. Is the backtrace below what's unequivocally (or close)
> > produced by that recipe?
>
> Yes, that's what I see.
>
> > Anyway, can you try this patch?
>
> That seems to work too :)

I understand the source of _this_ problem, and the line I changed
addresses it.  My worry is that my fix also creates more problems,
but it seems cleaner.  It has to be tested, particularly with Eglot reconnects.

Anyway the fix that someone proposed -- to refrain from issuing `flymake-mode`
when flymake-mode  is already active -- isn't right.  It's just
papering over a bug
waiting to appear again when someone does that in another mode hook.

The correct fix is similar to what I did, fixing the state management/cleanup
in flymake.el.  Maybe the reason for brutally resetting flymake--state doesn't
apply anymore: it doesn't seem right at all.

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Wed, 17 Jul 2024 23:55:02 GMT) Full text and rfc822 format available.

Message #53 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: gerd.moellmann <at> gmail.com, Spencer Baugh <sbaugh <at> janestreet.com>,
 Eli Zaretskii <eliz <at> gnu.org>, 69809 <at> debbugs.gnu.org, sbaugh <at> catern.com
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Thu, 18 Jul 2024 00:54:20 +0100
[Message part 1 (text/plain, inline)]
On Wed, Jul 17, 2024 at 6:38 PM João Távora <joaotavora <at> gmail.com> wrote:

> > > Anyway, can you try this patch?
> >
> > That seems to work too :)
>
> I understand the source of _this_ problem, and the line I changed
> addresses it.  My worry is that my fix also creates more problems,
> but it seems cleaner.

Indeed it did create some subtle problems with "foreign diagnostics".
I made a better patch, attached. It should fix the Eglot/flymake-cc
scenario and be a net improvement for Flymake.  Also adds a new
Flymake test.

 Spencer please have a look and push it if you agree.

João
[0001-Flymake-improve-idempotence-of-flymake-mode-bug-6980.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Thu, 18 Jul 2024 00:11:01 GMT) Full text and rfc822 format available.

Message #56 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: gerd.moellmann <at> gmail.com, Spencer Baugh <sbaugh <at> janestreet.com>,
 Eli Zaretskii <eliz <at> gnu.org>, 69809 <at> debbugs.gnu.org, sbaugh <at> catern.com
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Thu, 18 Jul 2024 01:10:49 +0100
[Message part 1 (text/plain, inline)]
And here's another more ambitious cleanup patch.
Be more careful with this one, test it with as many
Flymake backends as you can find.

On Thu, Jul 18, 2024 at 12:54 AM João Távora <joaotavora <at> gmail.com> wrote:
>
> On Wed, Jul 17, 2024 at 6:38 PM João Távora <joaotavora <at> gmail.com> wrote:
>
> > > > Anyway, can you try this patch?
> > >
> > > That seems to work too :)
> >
> > I understand the source of _this_ problem, and the line I changed
> > addresses it.  My worry is that my fix also creates more problems,
> > but it seems cleaner.
>
> Indeed it did create some subtle problems with "foreign diagnostics".
> I made a better patch, attached. It should fix the Eglot/flymake-cc
> scenario and be a net improvement for Flymake.  Also adds a new
> Flymake test.
>
>  Spencer please have a look and push it if you agree.
>
> João



-- 
João Távora
[0001-Flymake-more-ambitious-cleanup-in-flymake-mode-bug-6.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Wed, 24 Jul 2024 16:26:01 GMT) Full text and rfc822 format available.

Message #59 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: gerd.moellmann <at> gmail.com, sbaugh <at> catern.com, Eli Zaretskii <eliz <at> gnu.org>,
 Eshel Yaron <me <at> eshelyaron.com>, 69809 <at> debbugs.gnu.org
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Wed, 24 Jul 2024 12:25:00 -0400
João Távora <joaotavora <at> gmail.com> writes:
> On Wed, Jul 17, 2024 at 6:38 PM João Távora <joaotavora <at> gmail.com> wrote:
>
>> > > Anyway, can you try this patch?
>> >
>> > That seems to work too :)
>>
>> I understand the source of _this_ problem, and the line I changed
>> addresses it.  My worry is that my fix also creates more problems,
>> but it seems cleaner.
>
> Indeed it did create some subtle problems with "foreign diagnostics".
> I made a better patch, attached. It should fix the Eglot/flymake-cc
> scenario and be a net improvement for Flymake.  Also adds a new
> Flymake test.
>
>  Spencer please have a look and push it if you agree.

Yes, this seems good to me, thank you for the improved patch!

I unfortunately don't have commit access, so perhaps someone else can
install the patch.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Thu, 25 Jul 2024 07:29:01 GMT) Full text and rfc822 format available.

Message #62 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: joaotavora <at> gmail.com, Spencer Baugh <sbaugh <at> janestreet.com>
Cc: gerd.moellmann <at> gmail.com, sbaugh <at> catern.com, me <at> eshelyaron.com,
 69809 <at> debbugs.gnu.org
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Thu, 25 Jul 2024 10:28:40 +0300
> From: Spencer Baugh <sbaugh <at> janestreet.com>
> Cc: Eshel Yaron <me <at> eshelyaron.com>,  gerd.moellmann <at> gmail.com,  Eli
>   Zaretskii <eliz <at> gnu.org>,  69809 <at> debbugs.gnu.org,  sbaugh <at> catern.com
> Date: Wed, 24 Jul 2024 12:25:00 -0400
> 
> >  Spencer please have a look and push it if you agree.
> 
> Yes, this seems good to me, thank you for the improved patch!
> 
> I unfortunately don't have commit access, so perhaps someone else can
> install the patch.

I tried installing the last patch posted by João, but it failed to
apply, even with the -3 option and with options that ignore whitespace
changes.

João, please either install this on the emacs-30 branch or post an
updated patch that will apply cleanly.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Thu, 25 Jul 2024 07:47:01 GMT) Full text and rfc822 format available.

Message #65 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: gerd.moellmann <at> gmail.com, Spencer Baugh <sbaugh <at> janestreet.com>,
 sbaugh <at> catern.com, me <at> eshelyaron.com, 69809 <at> debbugs.gnu.org
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Thu, 25 Jul 2024 08:45:12 +0100
[Message part 1 (text/plain, inline)]
On Thu, Jul 25, 2024 at 8:28 AM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Spencer Baugh <sbaugh <at> janestreet.com>
> > Cc: Eshel Yaron <me <at> eshelyaron.com>,  gerd.moellmann <at> gmail.com,  Eli
> >   Zaretskii <eliz <at> gnu.org>,  69809 <at> debbugs.gnu.org,  sbaugh <at> catern.com
> > Date: Wed, 24 Jul 2024 12:25:00 -0400
> >
> > >  Spencer please have a look and push it if you agree.
> >
> > Yes, this seems good to me, thank you for the improved patch!
> >
> > I unfortunately don't have commit access, so perhaps someone else can
> > install the patch.
>
> I tried installing the last patch posted by João, but it failed to
> apply, even with the -3 option and with options that ignore whitespace
> changes.
>
> João, please either install this on the emacs-30 branch or post an
> updated patch that will apply cleanly.
>

I posted two patches (as attached .patch files) Maybe that's the issue.
Not 100% what patches Spencer has tested or greenlighting.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Thu, 25 Jul 2024 10:52:02 GMT) Full text and rfc822 format available.

Message #68 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: João Távora <joaotavora <at> gmail.com>
Cc: gerd.moellmann <at> gmail.com, sbaugh <at> janestreet.com, sbaugh <at> catern.com,
 me <at> eshelyaron.com, 69809 <at> debbugs.gnu.org
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Thu, 25 Jul 2024 13:50:50 +0300
> From: João Távora <joaotavora <at> gmail.com>
> Date: Thu, 25 Jul 2024 08:45:12 +0100
> Cc: Spencer Baugh <sbaugh <at> janestreet.com>, me <at> eshelyaron.com, gerd.moellmann <at> gmail.com, 
> 	69809 <at> debbugs.gnu.org, sbaugh <at> catern.com
> 
> On Thu, Jul 25, 2024 at 8:28 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>  > From: Spencer Baugh <sbaugh <at> janestreet.com>
>  > Cc: Eshel Yaron <me <at> eshelyaron.com>,  gerd.moellmann <at> gmail.com,  Eli
>  >   Zaretskii <eliz <at> gnu.org>,  69809 <at> debbugs.gnu.org,  sbaugh <at> catern.com
>  > Date: Wed, 24 Jul 2024 12:25:00 -0400
>  > 
>  > >  Spencer please have a look and push it if you agree.
>  > 
>  > Yes, this seems good to me, thank you for the improved patch!
>  > 
>  > I unfortunately don't have commit access, so perhaps someone else can
>  > install the patch.
> 
>  I tried installing the last patch posted by João, but it failed to
>  apply, even with the -3 option and with options that ignore whitespace
>  changes.
> 
>  João, please either install this on the emacs-30 branch or post an
>  updated patch that will apply cleanly.
> 
> I posted two patches (as attached .patch files) Maybe that's the issue.  
> Not 100% what patches Spencer has tested or greenlighting.

I tried to install the latter one, since you said it was an
improvement over the previous one.  If you suggest to install the
previous one, the one that Spencer approved, I can try doing that
instead.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Thu, 25 Jul 2024 11:50:02 GMT) Full text and rfc822 format available.

Message #71 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: gerd.moellmann <at> gmail.com, sbaugh <at> janestreet.com, sbaugh <at> catern.com,
 me <at> eshelyaron.com, 69809 <at> debbugs.gnu.org
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Thu, 25 Jul 2024 12:49:17 +0100
[Message part 1 (text/plain, inline)]
On Thu, Jul 25, 2024 at 11:51 AM Eli Zaretskii <eliz <at> gnu.org> wrote:

>
> I tried to install the latter one, since you said it was an
> improvement over the previous one.  If you suggest to install the
> previous one, the one that Spencer approved, I can try doing that
> instead.
>

Yes, it's an improvement, but it needs the earlier one.  And it's "more
ambitious", i.e. I would
think it requires more testing. Tests passed as far as I remember, though.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69809; Package emacs. (Sat, 27 Jul 2024 07:27:02 GMT) Full text and rfc822 format available.

Message #74 received at 69809 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: João Távora <joaotavora <at> gmail.com>
Cc: gerd.moellmann <at> gmail.com, sbaugh <at> janestreet.com, sbaugh <at> catern.com,
 me <at> eshelyaron.com, 69809 <at> debbugs.gnu.org
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Sat, 27 Jul 2024 10:26:03 +0300
> From: João Távora <joaotavora <at> gmail.com>
> Date: Thu, 25 Jul 2024 12:49:17 +0100
> Cc: sbaugh <at> janestreet.com, me <at> eshelyaron.com, gerd.moellmann <at> gmail.com, 
> 	69809 <at> debbugs.gnu.org, sbaugh <at> catern.com
> 
> On Thu, Jul 25, 2024 at 11:51 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>  I tried to install the latter one, since you said it was an
>  improvement over the previous one.  If you suggest to install the
>  previous one, the one that Spencer approved, I can try doing that
>  instead.
> 
> Yes, it's an improvement, but it needs the earlier one.  And it's "more ambitious", i.e. I would 
> think it requires more testing. Tests passed as far as I remember, though.

Feel free to install the changes you think will fix this.  If you are
not sure some changes are safe or tested enough, they should go to
master, not the emacs-30.




Reply sent to João Távora <joaotavora <at> gmail.com>:
You have taken responsibility. (Tue, 14 Jan 2025 17:53:02 GMT) Full text and rfc822 format available.

Notification sent to Gerd Möllmann <gerd.moellmann <at> gmail.com>:
bug acknowledged by developer. (Tue, 14 Jan 2025 17:53:02 GMT) Full text and rfc822 format available.

Message #79 received at 69809-done <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, 69809-done <at> debbugs.gnu.org
Cc: gerd.moellmann <at> gmail.com, sbaugh <at> janestreet.com, me <at> eshelyaron.com,
 sbaugh <at> catern.com
Subject: Re: bug#69809: 30.0.50; flymake: error in process sentinel
Date: Tue, 14 Jan 2025 17:52:46 +0000
On Sat, Jul 27, 2024 at 8:26 AM Eli Zaretskii <eliz <at> gnu.org> wrote:

> Feel free to install the changes you think will fix this.  If you are
> not sure some changes are safe or tested enough, they should go to
> master, not the emacs-30.

I've pushed these changes to master after consulting with Spencer.

According to feedback up-thread they effectively fix the bug, so I'm closing it.

João




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 12 Feb 2025 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 126 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.