comparison lisp/files.el @ 16544:9fffc9e5fc42

(revert-buffer): Doc fix. (wildcard-to-regexp): Don't treat [] as special.
author Richard M. Stallman <rms@gnu.org>
date Sat, 09 Nov 1996 09:04:52 +0000
parents 590593175cc7
children 4176f951b342
comparison
equal deleted inserted replaced
16543:6f891b1ba617 16544:9fffc9e5fc42
2195 2195
2196 If `revert-buffer-function' is used to override the normal revert 2196 If `revert-buffer-function' is used to override the normal revert
2197 mechanism, this hook is not used.") 2197 mechanism, this hook is not used.")
2198 2198
2199 (defun revert-buffer (&optional ignore-auto noconfirm preserve-modes) 2199 (defun revert-buffer (&optional ignore-auto noconfirm preserve-modes)
2200 "Replace the buffer text with the text of the visited file on disk. 2200 "Replace current buffer text with the text of the visited file on disk.
2201 This undoes all changes since the file was visited or saved. 2201 This undoes all changes since the file was visited or saved.
2202 With a prefix argument, offer to revert from latest auto-save file, if 2202 With a prefix argument, offer to revert from latest auto-save file, if
2203 that is more recent than the visited file. 2203 that is more recent than the visited file.
2204
2205 This command also works for special buffers that contain text which
2206 doesn't come from a file, but reflects some other data base instead:
2207 for example, Dired buffers and buffer-list buffers. In these cases,
2208 it reconstructs the buffer contents from the appropriate data base.
2204 2209
2205 When called from Lisp, the first argument is IGNORE-AUTO; only offer 2210 When called from Lisp, the first argument is IGNORE-AUTO; only offer
2206 to revert from the auto-save file when this is nil. Note that the 2211 to revert from the auto-save file when this is nil. Note that the
2207 sense of this argument is the reverse of the prefix argument, for the 2212 sense of this argument is the reverse of the prefix argument, for the
2208 sake of backward compatibility. IGNORE-AUTO is optional, defaulting 2213 sake of backward compatibility. IGNORE-AUTO is optional, defaulting
2213 2218
2214 Optional third argument PRESERVE-MODES non-nil means don't alter 2219 Optional third argument PRESERVE-MODES non-nil means don't alter
2215 the files modes. Normally we reinitialize them using `normal-mode'. 2220 the files modes. Normally we reinitialize them using `normal-mode'.
2216 2221
2217 If the value of `revert-buffer-function' is non-nil, it is called to 2222 If the value of `revert-buffer-function' is non-nil, it is called to
2218 do the work. 2223 do all the work for this command. Otherwise, the hooks
2219 2224 `before-revert-hook' and `after-revert-hook' are run at the beginning
2220 The default revert function runs the hook `before-revert-hook' at the 2225 and the end, and if `revert-buffer-insert-file-contents-function' is
2221 beginning and `after-revert-hook' at the end." 2226 non-nil, it is called instead of rereading visited file contents."
2227
2222 ;; I admit it's odd to reverse the sense of the prefix argument, but 2228 ;; I admit it's odd to reverse the sense of the prefix argument, but
2223 ;; there is a lot of code out there which assumes that the first 2229 ;; there is a lot of code out there which assumes that the first
2224 ;; argument should be t to avoid consulting the auto-save file, and 2230 ;; argument should be t to avoid consulting the auto-save file, and
2225 ;; there's no straightforward way to encourage authors to notice a 2231 ;; there's no straightforward way to encourage authors to notice a
2226 ;; reversal of the argument sense. So I'm just changing the user 2232 ;; reversal of the argument sense. So I'm just changing the user
2534 j) 2540 j)
2535 (setq 2541 (setq
2536 result 2542 result
2537 (concat result 2543 (concat result
2538 (cond 2544 (cond
2545 ((and (eq ch ?\[)
2546 (< (1+ i) len)
2547 (eq (aref wildcard (1+ i)) ?\]))
2548 "\\[")
2539 ((eq ch ?\[) ; [...] maps to regexp char class 2549 ((eq ch ?\[) ; [...] maps to regexp char class
2540 (progn 2550 (progn
2541 (setq i (1+ i)) 2551 (setq i (1+ i))
2542 (concat 2552 (concat
2543 (cond 2553 (cond