;;; Code:
+(defvar font-lock-keywords)
+
+
(defgroup backup nil
"Backups of edited data files."
:group 'files)
(hack-local-variables)))
;; Turn font lock off and on, to make sure it takes account of
;; whatever file local variables are relevant to it.
- (when (and font-lock-mode (eq (car font-lock-keywords) t))
+ (when (and font-lock-mode
+ ;; Font-lock-mode (now in font-core.el) can be ON when
+ ;; font-lock.el still hasn't been loaded.
+ (boundp 'font-lock-keywords)
+ (eq (car font-lock-keywords) t))
(setq font-lock-keywords (cadr font-lock-keywords))
(font-lock-mode 1))
(t (setq buffer-read-only (not buffer-read-only))
(force-mode-line-update)))
(if (vc-backend buffer-file-name)
- (message (substitute-command-keys
+ (message "%s" (substitute-command-keys
(concat "File is under version-control; "
"use \\[vc-next-action] to check in/out"))))))
before calling this function. You can redefine this for customization.
See also `auto-save-file-name-p'."
(if buffer-file-name
- (let ((list auto-save-file-name-transforms)
- (filename buffer-file-name)
- result uniq)
- ;; Apply user-specified translations
- ;; to the file name.
- (while (and list (not result))
- (if (string-match (car (car list)) filename)
- (setq result (replace-match (cadr (car list)) t nil
- filename)
- uniq (car (cddr (car list)))))
- (setq list (cdr list)))
- (if result
- (if uniq
- (setq filename (concat
- (file-name-directory result)
- (subst-char-in-string
- ?/ ?!
- (replace-regexp-in-string "!" "!!"
- filename))))
- (setq filename result)))
- (setq result
- (if (and (eq system-type 'ms-dos)
- (not (msdos-long-file-names)))
- ;; We truncate the file name to DOS 8+3 limits
- ;; before doing anything else, because the regexp
- ;; passed to string-match below cannot handle
- ;; extensions longer than 3 characters, multiple
- ;; dots, and other atrocities.
- (let ((fn (dos-8+3-filename
- (file-name-nondirectory buffer-file-name))))
- (string-match
- "\\`\\([^.]+\\)\\(\\.\\(..?\\)?.?\\|\\)\\'"
- fn)
- (concat (file-name-directory buffer-file-name)
- "#" (match-string 1 fn)
- "." (match-string 3 fn) "#"))
- (concat (file-name-directory filename)
- "#"
- (file-name-nondirectory filename)
- "#")))
- ;; Make sure auto-save file names don't contain characters
- ;; invalid for the underlying filesystem.
- (if (and (memq system-type '(ms-dos windows-nt))
- ;; Don't modify remote (ange-ftp) filenames
- (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" result)))
- (convert-standard-filename result)
- result))
+ (let ((handler (find-file-name-handler buffer-file-name
+ 'make-auto-save-file-name)))
+ (if handler
+ (funcall handler 'make-auto-save-file-name)
+ (let ((list auto-save-file-name-transforms)
+ (filename buffer-file-name)
+ result uniq)
+ ;; Apply user-specified translations
+ ;; to the file name.
+ (while (and list (not result))
+ (if (string-match (car (car list)) filename)
+ (setq result (replace-match (cadr (car list)) t nil
+ filename)
+ uniq (car (cddr (car list)))))
+ (setq list (cdr list)))
+ (if result
+ (if uniq
+ (setq filename (concat
+ (file-name-directory result)
+ (subst-char-in-string
+ ?/ ?!
+ (replace-regexp-in-string "!" "!!"
+ filename))))
+ (setq filename result)))
+ (setq result
+ (if (and (eq system-type 'ms-dos)
+ (not (msdos-long-file-names)))
+ ;; We truncate the file name to DOS 8+3 limits
+ ;; before doing anything else, because the regexp
+ ;; passed to string-match below cannot handle
+ ;; extensions longer than 3 characters, multiple
+ ;; dots, and other atrocities.
+ (let ((fn (dos-8+3-filename
+ (file-name-nondirectory buffer-file-name))))
+ (string-match
+ "\\`\\([^.]+\\)\\(\\.\\(..?\\)?.?\\|\\)\\'"
+ fn)
+ (concat (file-name-directory buffer-file-name)
+ "#" (match-string 1 fn)
+ "." (match-string 3 fn) "#"))
+ (concat (file-name-directory filename)
+ "#"
+ (file-name-nondirectory filename)
+ "#")))
+ ;; Make sure auto-save file names don't contain characters
+ ;; invalid for the underlying filesystem.
+ (if (and (memq system-type '(ms-dos windows-nt))
+ ;; Don't modify remote (ange-ftp) filenames
+ (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" result)))
+ (convert-standard-filename result)
+ result))))
;; Deal with buffers that don't have any associated files. (Mail
;; mode tends to create a good number of these.)