GNU bug report logs -
#71504
30.0.50; FR: Fix suggestions ("quick fix") for Flymake diagnostics
Previous Next
Full log
View this message in rfc822 format
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Eshel Yaron <me <at> eshelyaron.com>
>> Cc: sbaugh <at> janestreet.com, 71504 <at> debbugs.gnu.org
>> Date: Tue, 16 Jul 2024 11:49:45 +0200
>>
>> > If this is okay with Spencer, I think this should go to the master
>> > branch, with the following two nits fixed:
>> >
>> > . the doc string of flymake-make-diagnostic should explicitly tell
>> > that :fix-function is for backends to be set to the appropriate
>> > fixup function
>> > . this is documented in flymake.texi
>>
>> Thanks, will do. Note that to apply a fix suggestion, this patch uses
>> function refactor-apply-edits from my library refactor.el. This is the
>> "general purpose function for applying code changes" I mentioned in a
>> previous message in this thread. So to land this on master we need to
>> also add (at least a part of) refactor.el. I'm happy to contribute the
>> library wholesale, FWIW.
>>
>> You can find the latest version of refactor.el here:
>>
>> https://git.sr.ht/~eshel/emacs/blob/main/lisp/progmodes/refactor.el
>
> Couldn't refactor-apply-edits be replaced with something that doesn't
> depend on the rest of the library?
Yes, that's certainly doable. refactor-apply-edits can apply edits in
different ways depending on the value of refactor-apply-edits-function:
1. Apply all edits at once, without further confirmation.
2. Preview changes inline, and query about applying each change in turn.
(This is like query-replace with inline before/after preview.)
3. Summarize edits in a diff buffer, let the user take it from there.
I guess that for applying fix suggestions for Flymake diagnostics we can
extract just the couple of functions that apply all edits at once.
> I'd prefer not to delay the fixit support in Eglot until we decide
> whether or not to add refactor.el. Adding refactor.el could then be a
> separate discussion (and I do think having refactoring capabilities in
> Emacs is long overdue).
SGTM. (I assume you meant Flymake rather than Eglot?)
I'll put together an updated patch once Spencer confirms.
Eshel
This bug report was last modified 1 year and 60 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.