:type '(choice (const nil) integer)
:group 'backup)
-(defvar backup-enable-predicate
- (lambda (name)
- (not (or (let ((comp (compare-strings temporary-file-directory 0 nil
- name 0 nil)))
- ;; Directory is under temporary-file-directory.
- (and (not (eq comp t))
- (< comp -1)))
- (if small-temporary-file-directory
- (let ((comp (compare-strings small-temporary-file-directory
- 0 nil
- name 0 nil)))
- ;; Directory is under small-temporary-file-directory.
- (and (not (eq comp t))
- (< comp -1)))))))
+(defun normal-backup-enable-predicate (name)
+ "Default `backup-enable-predicate' function.
+Checks for files in `temporary-file-directory' or
+`small-temporary-file-directory'."
+ (not (or (let ((comp (compare-strings temporary-file-directory 0 nil
+ name 0 nil)))
+ ;; Directory is under temporary-file-directory.
+ (and (not (eq comp t))
+ (< comp -1)))
+ (if small-temporary-file-directory
+ (let ((comp (compare-strings small-temporary-file-directory
+ 0 nil
+ name 0 nil)))
+ ;; Directory is under small-temporary-file-directory.
+ (and (not (eq comp t))
+ (< comp -1)))))))
+
+(defvar backup-enable-predicate 'normal-backup-enable-predicate
"Predicate that looks at a file name and decides whether to make backups.
-Called with an absolute file name as argument, it returns t to enable backup.
-The default version checks for files in `temporary-file-directory' or
-`small-temporary-file-directory'.")
+Called with an absolute file name as argument, it returns t to enable backup.")
(defcustom buffer-offer-save nil
"*Non-nil in a buffer means always offer to save buffer on exit.
(defun convert-standard-filename (filename)
"Convert a standard file's name to something suitable for the current OS.
This function's standard definition is trivial; it just returns the argument.
-However, on some systems, the function is redefined
-with a definition that really does change some file names."
+However, on some systems, the function is redefined with a definition
+that really does change some file names to canonicalize certain
+patterns and to guarantee valid names."
filename)
\f
(defun pwd ()
;; and replace the leading "x:" with "/drive_x".
(or (file-name-absolute-p file)
(setq file (expand-file-name file))) ; make defaults explicit
+ ;; Replace any invalid file-name characters (for the
+ ;; case of backing up remote files).
+ (setq file (convert-standard-filename file))
(setq dir-sep-string (char-to-string directory-sep-char))
(or (eq directory-sep-char ?/)
(subst-char-in-string ?/ ?\\ file))
(defvar auto-save-hook nil
"Normal hook run just before auto-saving.")
-(defvar after-save-hook nil
- "Normal hook that is run after a buffer is saved to its file.")
+(defcustom after-save-hook nil
+ "Normal hook that is run after a buffer is saved to its file."
+ :options '(executable-make-buffer-file-executable-if-script-p)
+ :type 'hook
+ :group 'files)
(defvar save-buffer-coding-system nil
"If non-nil, use this coding system for saving the buffer.
(cond ((and tempsetmodes (not setmodes))
;; Change the mode back, after writing.
(setq setmodes (file-modes buffer-file-name))
- (set-file-modes buffer-file-name 511)))
+ (set-file-modes buffer-file-name (logior setmodes 128))))
(write-region (point-min) (point-max)
buffer-file-name nil t buffer-file-truename)))
setmodes))