Thread View: gnu.epoch.misc
2 messages
2 total messages
Started by Karim Esseghir
Thu, 22 Apr 1993 22:42
auto-save file protections
Author: Karim Esseghir
Date: Thu, 22 Apr 1993 22:42
Date: Thu, 22 Apr 1993 22:42
14 lines
1200 bytes
1200 bytes
Hello everyone,
I would like the auto-save file created for the *mail* buffer to be
protected against read/write from other users. How do I make emacs/
epoch do this automatically upon creating the file?
Thanks.
--
- Karim -
"The real danger is not that computers will begin to think
like men, but that men will begin to think like computers."
-Sydney Harris
Re: auto-save file protections
Author: Simon Marshall
Date: Fri, 23 Apr 1993 15:25
Date: Fri, 23 Apr 1993 15:25
41 lines
2511 bytes
2511 bytes
In article <C5wprE.Cs7@rice.edu> karim@rice.edu (Karim Esseghir) writes:
>I would like the auto-save file created for the *mail* buffer to be
>protected against read/write from other users. How do I make emacs/
>epoch do this automatically upon creating the file?
This is the general answer. It applies to files as well as buffers.
;;; Stuff to prevent autosaves from being readable.
;;; Simon Marshall (S.Marshall@dcs.hull.ac.uk).
(defvar auto-save-directory "~/AutoSaves"
"*Name of directory to put auto saved files.
Should not end in a slash, and should be created with group and other
permissions restricted.")
(defun make-auto-save-file-name ()
"Return file name to use for auto-saves of current buffer.
Files are in auto-save-directory.
Does not consider auto-save-visited-file-name; that is checked
before calling this function.
You can redefine this for customization.
See also auto-save-file-name-p."
(let ((auto-save (if buffer-file-name
(concat buffer-file-name "#")
(expand-file-name (concat "%" (buffer-name) "#")))))
(concat auto-save-directory "/" (replace-in-string auto-save "/" "#"))))
(defun replace-in-string (str from to)
"Edit string STR, by replacing the substrings FROM to the substring TO"
(let ((start (string-match from str)))
(if start
(concat (substring str 0 start) to
(replace-in-string (substring str (+ start (length from)))
from to))
str)))
Have fun. Simon.
--
Simon Marshall, Dept. of Computer Science, University of Hull, Hull HU6 7RX, UK
"Football isn't about life and death. It's more important than that." Bill
Email: S.Marshall@cs.hull.ac.uk Phone: +44 482 465951 Fax: 466666 Shankley
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads