diff options
| author | Richard M. Stallman | 2001-11-24 23:59:28 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-11-24 23:59:28 +0000 |
| commit | 388d6ab529801240f42a2dffec4d7a6a1c5fa560 (patch) | |
| tree | 02040131123ca36326f91775255dfa5f9a8dac5e | |
| parent | fa3f40906560f82ba487b752c4d8ecf453306871 (diff) | |
| download | emacs-388d6ab529801240f42a2dffec4d7a6a1c5fa560.tar.gz emacs-388d6ab529801240f42a2dffec4d7a6a1c5fa560.zip | |
(temporary-file-directory): Use defcustom.
(small-temporary-file-directory): Likewise.
(normal-backup-enable-predicate): Move down in file
after definition of temporary-file-directory.
| -rw-r--r-- | lisp/files.el | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/lisp/files.el b/lisp/files.el index e86c9d8db54..db2cf49ab61 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -133,23 +133,6 @@ This variable is relevant only if `backup-by-copying' and | |||
| 133 | :type '(choice (const nil) integer) | 133 | :type '(choice (const nil) integer) |
| 134 | :group 'backup) | 134 | :group 'backup) |
| 135 | 135 | ||
| 136 | (defun normal-backup-enable-predicate (name) | ||
| 137 | "Default `backup-enable-predicate' function. | ||
| 138 | Checks for files in `temporary-file-directory' or | ||
| 139 | `small-temporary-file-directory'." | ||
| 140 | (not (or (let ((comp (compare-strings temporary-file-directory 0 nil | ||
| 141 | name 0 nil))) | ||
| 142 | ;; Directory is under temporary-file-directory. | ||
| 143 | (and (not (eq comp t)) | ||
| 144 | (< comp (- (length temporary-file-directory))))) | ||
| 145 | (if small-temporary-file-directory | ||
| 146 | (let ((comp (compare-strings small-temporary-file-directory | ||
| 147 | 0 nil | ||
| 148 | name 0 nil))) | ||
| 149 | ;; Directory is under small-temporary-file-directory. | ||
| 150 | (and (not (eq comp t)) | ||
| 151 | (< comp (- (length small-temporary-file-directory))))))))) | ||
| 152 | |||
| 153 | (defvar backup-enable-predicate 'normal-backup-enable-predicate | 136 | (defvar backup-enable-predicate 'normal-backup-enable-predicate |
| 154 | "Predicate that looks at a file name and decides whether to make backups. | 137 | "Predicate that looks at a file name and decides whether to make backups. |
| 155 | Called with an absolute file name as argument, it returns t to enable backup.") | 138 | Called with an absolute file name as argument, it returns t to enable backup.") |
| @@ -201,7 +184,7 @@ If the buffer is visiting a new file, the value is nil.") | |||
| 201 | "Non-nil if visited file was read-only when visited.") | 184 | "Non-nil if visited file was read-only when visited.") |
| 202 | (make-variable-buffer-local 'buffer-file-read-only) | 185 | (make-variable-buffer-local 'buffer-file-read-only) |
| 203 | 186 | ||
| 204 | (defvar temporary-file-directory | 187 | (defcustom temporary-file-directory |
| 205 | (file-name-as-directory | 188 | (file-name-as-directory |
| 206 | (cond ((memq system-type '(ms-dos windows-nt)) | 189 | (cond ((memq system-type '(ms-dos windows-nt)) |
| 207 | (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp")) | 190 | (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp")) |
| @@ -209,14 +192,18 @@ If the buffer is visiting a new file, the value is nil.") | |||
| 209 | (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "SYS$SCRATCH:")) | 192 | (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "SYS$SCRATCH:")) |
| 210 | (t | 193 | (t |
| 211 | (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "/tmp")))) | 194 | (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "/tmp")))) |
| 212 | "The directory for writing temporary files.") | 195 | "The directory for writing temporary files." |
| 196 | :group 'files | ||
| 197 | :type 'directory) | ||
| 213 | 198 | ||
| 214 | (defvar small-temporary-file-directory | 199 | (defcustom small-temporary-file-directory |
| 215 | (if (eq system-type 'ms-dos) (getenv "TMPDIR")) | 200 | (if (eq system-type 'ms-dos) (getenv "TMPDIR")) |
| 216 | "The directory for writing small temporary files. | 201 | "The directory for writing small temporary files. |
| 217 | If non-nil, this directory is used instead of `temporary-file-directory' | 202 | If non-nil, this directory is used instead of `temporary-file-directory' |
| 218 | by programs that create small temporary files. This is for systems that | 203 | by programs that create small temporary files. This is for systems that |
| 219 | have fast storage with limited space, such as a RAM disk.") | 204 | have fast storage with limited space, such as a RAM disk." |
| 205 | :group 'files | ||
| 206 | :type 'directory) | ||
| 220 | 207 | ||
| 221 | ;; The system null device. (Should reference NULL_DEVICE from C.) | 208 | ;; The system null device. (Should reference NULL_DEVICE from C.) |
| 222 | (defvar null-device "/dev/null" "The system null device.") | 209 | (defvar null-device "/dev/null" "The system null device.") |
| @@ -2313,6 +2300,23 @@ ignored." | |||
| 2313 | :type '(repeat (cons (regexp :tag "Regexp matching filename") | 2300 | :type '(repeat (cons (regexp :tag "Regexp matching filename") |
| 2314 | (directory :tag "Backup directory name")))) | 2301 | (directory :tag "Backup directory name")))) |
| 2315 | 2302 | ||
| 2303 | (defun normal-backup-enable-predicate (name) | ||
| 2304 | "Default `backup-enable-predicate' function. | ||
| 2305 | Checks for files in `temporary-file-directory' or | ||
| 2306 | `small-temporary-file-directory'." | ||
| 2307 | (not (or (let ((comp (compare-strings temporary-file-directory 0 nil | ||
| 2308 | name 0 nil))) | ||
| 2309 | ;; Directory is under temporary-file-directory. | ||
| 2310 | (and (not (eq comp t)) | ||
| 2311 | (< comp (- (length temporary-file-directory))))) | ||
| 2312 | (if small-temporary-file-directory | ||
| 2313 | (let ((comp (compare-strings small-temporary-file-directory | ||
| 2314 | 0 nil | ||
| 2315 | name 0 nil))) | ||
| 2316 | ;; Directory is under small-temporary-file-directory. | ||
| 2317 | (and (not (eq comp t)) | ||
| 2318 | (< comp (- (length small-temporary-file-directory))))))))) | ||
| 2319 | |||
| 2316 | (defun make-backup-file-name (file) | 2320 | (defun make-backup-file-name (file) |
| 2317 | "Create the non-numeric backup file name for FILE. | 2321 | "Create the non-numeric backup file name for FILE. |
| 2318 | Normally this will just be the file's name with `~' appended. | 2322 | Normally this will just be the file's name with `~' appended. |