GNU bug report logs -
#62260
30.0.50; [PATCH] Restrict auto-save file mode
Previous Next
Full log
View this message in rfc822 format
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 62260 <at> debbugs.gnu.org
> Date: Mon, 20 Mar 2023 12:41:34 +0100
>
> Manuel Giraud <manuel <at> ledu-giraud.fr> writes:
>
> > Thanks for your inputs. I have tried with
> > 'auto-save-file-name-transforms' like this:
> >
> > (add-to-list 'auto-save-file-name-transforms
> > '("\\`/\\(?:doas\\|ksu\\|su\\(?:do\\)?\\):.*\\'" "/dev/null" nil))
> >
> > But now, auto-save tries to create "/dev/#null#". How can I fix it to
> > "/dev/null"?
>
> auto-save-file-name-transforms does not know the meaning of "/dev/null",
> it handles it like an ordinary file name. The following code snippet
> shall do what you want instead (untested):
>
> --8<---------------cut here---------------start------------->8---
> (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)
> --8<---------------cut here---------------end--------------->8---
>
> @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?
Fine by me, but this is not for emacs-29.
This bug report was last modified 2 years and 83 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.