133 |
:type '(choice (const nil) integer) |
:type '(choice (const nil) integer) |
134 |
:group 'backup) |
:group 'backup) |
135 |
|
|
|
(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))))))))) |
|
|
|
|
136 |
(defvar backup-enable-predicate 'normal-backup-enable-predicate |
(defvar backup-enable-predicate 'normal-backup-enable-predicate |
137 |
"Predicate that looks at a file name and decides whether to make backups. |
"Predicate that looks at a file name and decides whether to make backups. |
138 |
Called with an absolute file name as argument, it returns t to enable backup.") |
Called with an absolute file name as argument, it returns t to enable backup.") |
184 |
"Non-nil if visited file was read-only when visited.") |
"Non-nil if visited file was read-only when visited.") |
185 |
(make-variable-buffer-local 'buffer-file-read-only) |
(make-variable-buffer-local 'buffer-file-read-only) |
186 |
|
|
187 |
(defvar temporary-file-directory |
(defcustom temporary-file-directory |
188 |
(file-name-as-directory |
(file-name-as-directory |
189 |
(cond ((memq system-type '(ms-dos windows-nt)) |
(cond ((memq system-type '(ms-dos windows-nt)) |
190 |
(or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp")) |
(or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp")) |
192 |
(or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "SYS$SCRATCH:")) |
(or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "SYS$SCRATCH:")) |
193 |
(t |
(t |
194 |
(or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "/tmp")))) |
(or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "/tmp")))) |
195 |
"The directory for writing temporary files.") |
"The directory for writing temporary files." |
196 |
|
:group 'files |
197 |
|
:type 'directory) |
198 |
|
|
199 |
(defvar small-temporary-file-directory |
(defcustom small-temporary-file-directory |
200 |
(if (eq system-type 'ms-dos) (getenv "TMPDIR")) |
(if (eq system-type 'ms-dos) (getenv "TMPDIR")) |
201 |
"The directory for writing small temporary files. |
"The directory for writing small temporary files. |
202 |
If non-nil, this directory is used instead of `temporary-file-directory' |
If non-nil, this directory is used instead of `temporary-file-directory' |
203 |
by programs that create small temporary files. This is for systems that |
by programs that create small temporary files. This is for systems that |
204 |
have fast storage with limited space, such as a RAM disk.") |
have fast storage with limited space, such as a RAM disk." |
205 |
|
:group 'files |
206 |
|
:type 'directory) |
207 |
|
|
208 |
;; The system null device. (Should reference NULL_DEVICE from C.) |
;; The system null device. (Should reference NULL_DEVICE from C.) |
209 |
(defvar null-device "/dev/null" "The system null device.") |
(defvar null-device "/dev/null" "The system null device.") |
2300 |
:type '(repeat (cons (regexp :tag "Regexp matching filename") |
:type '(repeat (cons (regexp :tag "Regexp matching filename") |
2301 |
(directory :tag "Backup directory name")))) |
(directory :tag "Backup directory name")))) |
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 |
|
|
2320 |
(defun make-backup-file-name (file) |
(defun make-backup-file-name (file) |
2321 |
"Create the non-numeric backup file name for FILE. |
"Create the non-numeric backup file name for FILE. |
2322 |
Normally this will just be the file's name with `~' appended. |
Normally this will just be the file's name with `~' appended. |