Subject: bug#78365: 31.0.50; make-mode has no way to turn off confirmations before saving when it thinks there may be a syntax error

From: Eli Zaretskii <[email-masked]>
Date: Sun, 11 May 2025 08:06:48 +0300

> From: Lynn Winebarger <[email-masked]>
> Date: Sat, 10 May 2025 20:01:01 -0400
> 
> I've been hacking on Makefiles, and I habitually save while rewriting,
> not just when I have a finished edit.  I may also have autosave turned
> on.  There were annoying confirmation requests when that happened, and
> if I did not notice (maybe due to autosave), the requests pile up and
> once a later one has been answered, an earlier one reappears but either
> can't accept the input or maybe there were a bunch of warnings queued
> up.

AFAIU, autosave is not supposed to run these hooks, so if that
happened to you, it's a bug.  Can you show a recipe for reproducing
this?

> Or maybe there was some kind of implicit loop, where confirming the
> save after some timer ran out caused another confirmation request.  I
> don't know.  But there's no customization to let the user decide whether
> they want this intrusive behavior.

It would be good to understand the problem and its causes before we
discuss the possible solutions.  Especially since your proposed
solution is quite a blunt weapon.  These functions are placed on
write-file-functions for a reason.

> diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
> index d5fdd063825..ec1ac4e9d4f 100644
> --- a/lisp/progmodes/make-mode.el
> +++ b/lisp/progmodes/make-mode.el
> @@ -188,6 +188,15 @@ makefile-cleanup-continuations
>  to MODIFY A FILE WITHOUT YOUR CONFIRMATION when \"it seems necessary\"."
>    :type 'boolean)
>  
> +(defcustom makefile-write-check-hooks
> +  '(makefile-warn-suspicious-lines
> +    makefile-warn-continuations
> +    makefile-cleanup-continuations)
> +  "List of functions to run when writing the buffer to a file.
> +The defaults on the list require confirmation to save when a
> +suspicious line or line continuation is detected."
> +  :type 'list)

The :version tag is missing.  Also, this kind of change warrants a
NEWS entry.

(But I'm still not sure this change is TRT for solving the problems
you described, for lack of details.)