comparison lisp/files.el @ 17894:488536bc29c2

(path-separator, parse-colon-path): Doc fixes. (revert-without-query): Renamed from find-file-revert-without-query. (find-file-noselect): Use new option. (revert-buffer): Check the option here too.
author Richard M. Stallman <rms@gnu.org>
date Tue, 20 May 1997 05:27:50 +0000
parents bd60d4318daf
children 2d9818a04c36
comparison
equal deleted inserted replaced
17893:ad5fda4d4c36 17894:488536bc29c2
144 The truename of a file is found by chasing all links 144 The truename of a file is found by chasing all links
145 both at the file level and at the levels of the containing directories." 145 both at the file level and at the levels of the containing directories."
146 :type 'boolean 146 :type 'boolean
147 :group 'find-file) 147 :group 'find-file)
148 148
149 (defcustom find-file-revert-without-query 149 (defcustom revert-without-query
150 nil 150 nil
151 "*Specify which files should be reverted without query. 151 "*Specify which files should be reverted without query.
152 The value is a list of regular expressions. 152 The value is a list of regular expressions.
153 If the file name matches one of these regular expressions, 153 If the file name matches one of these regular expressions,
154 then `find-file' reverts the file without querying 154 then `revert-buffer' reverts the file without querying
155 if the file has changed on disk and you have not edited the buffer." 155 if the file has changed on disk and you have not edited the buffer."
156 :type 'boolean 156 :type 'boolean
157 :group 'find-file) 157 :group 'find-file)
158 158
159 (defvar buffer-file-number nil 159 (defvar buffer-file-number nil
364 (defvar cd-path nil 364 (defvar cd-path nil
365 "Value of the CDPATH environment variable, as a list. 365 "Value of the CDPATH environment variable, as a list.
366 Not actually set up until the first time you you use it.") 366 Not actually set up until the first time you you use it.")
367 367
368 (defvar path-separator ":" 368 (defvar path-separator ":"
369 "Character used to separate concatenated paths.") 369 "Character used to separate directories in search paths.")
370 370
371 (defun parse-colon-path (cd-path) 371 (defun parse-colon-path (cd-path)
372 "Explode a colon-separated list of paths into a string list." 372 "Explode a colon-separated search path into a list of directory names."
373 (and cd-path 373 (and cd-path
374 (let (cd-prefix cd-list (cd-start 0) cd-colon) 374 (let (cd-prefix cd-list (cd-start 0) cd-colon)
375 (setq cd-path (concat cd-path path-separator)) 375 (setq cd-path (concat cd-path path-separator))
376 (while (setq cd-colon (string-match path-separator cd-path cd-start)) 376 (while (setq cd-colon (string-match path-separator cd-path cd-start))
377 (setq cd-list 377 (setq cd-list
877 (cond ((not (file-exists-p filename)) 877 (cond ((not (file-exists-p filename))
878 (error "File %s no longer exists!" filename)) 878 (error "File %s no longer exists!" filename))
879 ;; Certain files should be reverted automatically 879 ;; Certain files should be reverted automatically
880 ;; if they have changed on disk and not in the buffer. 880 ;; if they have changed on disk and not in the buffer.
881 ((and (not (buffer-modified-p buf)) 881 ((and (not (buffer-modified-p buf))
882 (let ((tail find-file-revert-without-query) 882 (let ((tail revert-without-query)
883 (found nil)) 883 (found nil))
884 (while tail 884 (while tail
885 (if (string-match (car tail) filename) 885 (if (string-match (car tail) filename)
886 (setq found t)) 886 (setq found t))
887 (setq tail (cdr tail))) 887 (setq tail (cdr tail)))
2444 buffer-auto-save-file-name 2444 buffer-auto-save-file-name
2445 buffer-file-name))) 2445 buffer-file-name)))
2446 (cond ((null file-name) 2446 (cond ((null file-name)
2447 (error "Buffer does not seem to be associated with any file")) 2447 (error "Buffer does not seem to be associated with any file"))
2448 ((or noconfirm 2448 ((or noconfirm
2449 (and (not (buffer-modified-p))
2450 (let ((tail revert-without-query)
2451 (found nil))
2452 (while tail
2453 (if (string-match (car tail) file-name)
2454 (setq found t))
2455 (setq tail (cdr tail)))
2456 found))
2449 (yes-or-no-p (format "Revert buffer from file %s? " 2457 (yes-or-no-p (format "Revert buffer from file %s? "
2450 file-name))) 2458 file-name)))
2451 (run-hooks 'before-revert-hook) 2459 (run-hooks 'before-revert-hook)
2452 ;; If file was backed up but has changed since, 2460 ;; If file was backed up but has changed since,
2453 ;; we shd make another backup. 2461 ;; we shd make another backup.