GNU bug report logs - #62260
30.0.50; [PATCH] Restrict auto-save file mode

Previous Next

Package: emacs;

Reported by: Manuel Giraud <manuel <at> ledu-giraud.fr>

Date: Sat, 18 Mar 2023 15:19:01 UTC

Severity: normal

Tags: patch

Merged with 57395

Found in versions 28.1, 30.0.50

Full log


View this message in rfc822 format

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 62260 <at> debbugs.gnu.org
Subject: bug#62260: 30.0.50; [PATCH] Restrict auto-save file mode
Date: Mon, 20 Mar 2023 12:41:34 +0100
Manuel Giraud <manuel <at> ledu-giraud.fr> writes:

> Hi Michael,

Hi Manuel,

> 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?

Best regards, Michael.




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.