Mercurial > emacs
changeset 41458:7da74fc76e19
(temporary-file-directory): Use defcustom.
(small-temporary-file-directory): Likewise.
(normal-backup-enable-predicate): Move down in file
after definition of temporary-file-directory.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 24 Nov 2001 23:59:28 +0000 |
parents | 60f633593ee0 |
children | 36f463a17ea9 |
files | lisp/files.el |
diffstat | 1 files changed, 25 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/files.el Sat Nov 24 23:57:29 2001 +0000 +++ b/lisp/files.el Sat Nov 24 23:59:28 2001 +0000 @@ -133,23 +133,6 @@ :type '(choice (const nil) integer) :group 'backup) -(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 (- (length temporary-file-directory))))) - (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 (- (length small-temporary-file-directory))))))))) - (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.") @@ -201,7 +184,7 @@ "Non-nil if visited file was read-only when visited.") (make-variable-buffer-local 'buffer-file-read-only) -(defvar temporary-file-directory +(defcustom temporary-file-directory (file-name-as-directory (cond ((memq system-type '(ms-dos windows-nt)) (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp")) @@ -209,14 +192,18 @@ (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "SYS$SCRATCH:")) (t (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "/tmp")))) - "The directory for writing temporary files.") + "The directory for writing temporary files." + :group 'files + :type 'directory) -(defvar small-temporary-file-directory +(defcustom small-temporary-file-directory (if (eq system-type 'ms-dos) (getenv "TMPDIR")) "The directory for writing small temporary files. If non-nil, this directory is used instead of `temporary-file-directory' by programs that create small temporary files. This is for systems that -have fast storage with limited space, such as a RAM disk.") +have fast storage with limited space, such as a RAM disk." + :group 'files + :type 'directory) ;; The system null device. (Should reference NULL_DEVICE from C.) (defvar null-device "/dev/null" "The system null device.") @@ -2313,6 +2300,23 @@ :type '(repeat (cons (regexp :tag "Regexp matching filename") (directory :tag "Backup directory name")))) +(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 (- (length temporary-file-directory))))) + (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 (- (length small-temporary-file-directory))))))))) + (defun make-backup-file-name (file) "Create the non-numeric backup file name for FILE. Normally this will just be the file's name with `~' appended.