Subject: Re: bug#62260: 30.0.50; [PATCH] Restrict auto-save file mode

From: Manuel Giraud <[email-masked]>
Date: Mon, 20 Mar 2023 15:15:59 +0100

Michael Albinus <[email-masked]> writes:

[...]

> (defun my-find-file-hook ()
>   (and buffer-file-name
>        (member (file-remote-p buffer-file-name 'method) '("doas" "ksu" "su" "sudo"))
>        (auto-save-mode 0)))
> (add-hook 'find-file-hook 'my-find-file-hook)

Hi Michael,

Thanks for this method, I'll try that.

> @Eli: We have already remote-file-name-inhibit-auto-save-visited. Shall
> we define another user option remote-file-name-inhibit-auto-save, which
> could be used similarly?

It is a good idea and will be more simple for the end user than the hook
you proposed above.  That said, I think an important aspect of bug#57395
is to consider what remote/sudo file is "dangerous" and what isn't.

So maybe, it would be better to have an option
'dangerous-file-name-inhibit-auto-save' and have a "piece of code" (so
easy to say 😅) that check whether a file is a dangerous one or not…  Or
maybe it is over engineering things.

Best regards,
-- 
Manuel Giraud