Mercurial > emacs
comparison lisp/autorevert.el @ 21288:1b06a18f33fd
Various doc fixes, mainly grammar.
author | Dave Love <fx@gnu.org> |
---|---|
date | Wed, 25 Mar 1998 19:13:11 +0000 |
parents | b644667dcd19 |
children | 1c0712c77155 |
comparison
equal
deleted
inserted
replaced
21287:f61d91aef100 | 21288:1b06a18f33fd |
---|---|
1 ;; autorevert --- Revert buffers when file on disk change. | 1 ;; autorevert --- Revert buffers when file on disk change. |
2 | 2 |
3 ;; Copyright (C) 1997 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1997, 1998 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Anders Lindgren <andersl@csd.uu.se> | 5 ;; Author: Anders Lindgren <andersl@csd.uu.se> |
6 ;; Created: 1 Jun 1997 | 6 ;; Created: 1 Jun 1997 |
7 ;; Date: 3 Jul 1997 | 7 ;; Date: 3 Jul 1997 |
8 | 8 |
26 ;;; Commentary: | 26 ;;; Commentary: |
27 | 27 |
28 ;; Introduction: | 28 ;; Introduction: |
29 ;; | 29 ;; |
30 ;; Whenever a file that Emacs is editing has been changed by another | 30 ;; Whenever a file that Emacs is editing has been changed by another |
31 ;; program the user normally have to execute the command `revert-buffer' | 31 ;; program the user normally has to execute the command `revert-buffer' |
32 ;; to load the new content of the file into Emacs. | 32 ;; to load the new content of the file into Emacs. |
33 ;; | 33 ;; |
34 ;; This package contains two minor modes: Global Auto-Revert Mode and | 34 ;; This package contains two minor modes: Global Auto-Revert Mode and |
35 ;; Auto-Revert Mode. Both modes automatically reverts buffers | 35 ;; Auto-Revert Mode. Both modes automatically revert buffers |
36 ;; whenever the corresponding files have been changed on disk. | 36 ;; whenever the corresponding files have been changed on disk. |
37 ;; | 37 ;; |
38 ;; Auto-Revert Mode can be activated for individual buffers. | 38 ;; Auto-Revert Mode can be activated for individual buffers. |
39 ;; Global Auto-Revert Mode applies to all file buffers. | 39 ;; Global Auto-Revert Mode applies to all file buffers. |
40 ;; | 40 ;; |
41 ;; Both modes operates by checking the time stamp of all files at | 41 ;; Both modes operate by checking the time stamp of all files at |
42 ;; given intervals, the default is every five seconds. The check is | 42 ;; intervals of `auto-revert-interval'. The default is every five |
43 ;; aborted whenever the user actually use Emacs. Hopefully you will | 43 ;; seconds. The check is aborted whenever the user actually uses |
44 ;; never even notice that this package is active (except that your | 44 ;; Emacs. You should never even notice that this package is active |
45 ;; buffers will be reverted, of course). | 45 ;; (except that your buffers will be reverted, of course). |
46 | |
47 ;; Installation: | |
48 ;; | |
49 ;; To install this package, place it in somewhere on Emacs' load-path, | |
50 ;; byte-compile it (not necessary), and place the following lines in | |
51 ;; the appropriate init file: | |
52 ;; | |
53 ;; (autoload 'auto-revert-mode "autorevert" nil t) | |
54 ;; (autoload 'turn-on-auto-revert-mode "autorevert" nil nil) | |
55 ;; (autoload 'global-auto-revert-mode "autorevert" nil t) | |
56 | 46 |
57 ;; Usage: | 47 ;; Usage: |
58 ;; | 48 ;; |
59 ;; Go to the appropriate buffer and press: | 49 ;; Go to the appropriate buffer and press: |
60 ;; M-x auto-revert-mode RET | 50 ;; M-x auto-revert-mode RET |
61 ;; | 51 ;; |
62 ;; To activate Global Auto-Revert Mode, press: | 52 ;; To activate Global Auto-Revert Mode, press: |
63 ;; M-x global-auto-revert-mode RET | 53 ;; M-x global-auto-revert-mode RET |
64 ;; | 54 ;; |
65 ;; To activate Global Auto-Revert Mode every time Emacs is started the | 55 ;; To activate Global Auto-Revert Mode every time Emacs is started |
66 ;; following line could be added to your ~/.emacs: | 56 ;; customise the option `global-auto-revert-mode' or the following |
57 ;; line could be added to your ~/.emacs: | |
67 ;; (global-auto-revert-mode 1) | 58 ;; (global-auto-revert-mode 1) |
68 ;; | 59 ;; |
69 ;; The function `turn-on-auto-revert-mode' could be added to any major | 60 ;; The function `turn-on-auto-revert-mode' could be added to any major |
70 ;; mode hook to activate Auto-Revert Mode for all buffers in that | 61 ;; mode hook to activate Auto-Revert Mode for all buffers in that |
71 ;; mode. For example, the following line will activate Auto-Revert | 62 ;; mode. For example, the following line will activate Auto-Revert |
85 ;; | 76 ;; |
86 ;; The two modes will be placed next to Auto Save Mode under the | 77 ;; The two modes will be placed next to Auto Save Mode under the |
87 ;; Files group under Emacs. | 78 ;; Files group under Emacs. |
88 | 79 |
89 (defgroup auto-revert nil | 80 (defgroup auto-revert nil |
90 "Revert individual buffer when file on disk change. | 81 "Revert individual buffers when files on disk change. |
91 | 82 |
92 Auto-Revert Mode can be activated for individual buffer. | 83 Auto-Revert Mode can be activated for individual buffer. |
93 Global Auto-Revert Mode applies to all buffers." | 84 Global Auto-Revert Mode applies to all buffers." |
94 :group 'files) | 85 :group 'files) |
95 | 86 |
97 ;; Variables: | 88 ;; Variables: |
98 | 89 |
99 (defvar auto-revert-mode nil | 90 (defvar auto-revert-mode nil |
100 "*Non-nil when Auto-Revert Mode is active. | 91 "*Non-nil when Auto-Revert Mode is active. |
101 | 92 |
102 Do never set this variable directly, use the command | 93 Never set this variable directly, use the command `auto-revert-mode' |
103 `auto-revert-mode' instead.") | 94 instead.") |
104 | 95 |
105 (defcustom global-auto-revert-mode nil | 96 (defcustom global-auto-revert-mode nil |
106 "When on, buffers are automatically reverted when files on disk change. | 97 "When on, buffers are automatically reverted when files on disk change. |
107 | 98 |
108 Set this variable when using \\[customize] only. Otherwise, use the | 99 Set this variable using \\[customize] only. Otherwise, use the |
109 command `global-auto-revert-mode' instead." | 100 command `global-auto-revert-mode'." |
110 :group 'auto-revert | 101 :group 'auto-revert |
111 :initialize 'custom-initialize-default | 102 :initialize 'custom-initialize-default |
112 :set '(lambda (symbol value) | 103 :set '(lambda (symbol value) |
113 (global-auto-revert-mode (or value 0))) | 104 (global-auto-revert-mode (or value 0))) |
114 :type 'boolean | 105 :type 'boolean |
148 | 139 |
149 (defcustom global-auto-revert-mode-text "" | 140 (defcustom global-auto-revert-mode-text "" |
150 "String to display when Global Auto-Revert Mode is active. | 141 "String to display when Global Auto-Revert Mode is active. |
151 | 142 |
152 The default is nothing since when this mode is active this text doesn't | 143 The default is nothing since when this mode is active this text doesn't |
153 vary neither over time, nor between buffers. Hence a mode line text | 144 vary over time, or between buffers. Hence mode line text |
154 would only waste precious space." | 145 would only waste precious space." |
155 :group 'auto-revert | 146 :group 'auto-revert |
156 :type 'string) | 147 :type 'string) |
157 | 148 |
158 (defcustom global-auto-revert-mode-hook nil | 149 (defcustom global-auto-revert-mode-hook nil |
190 :type 'hook) | 181 :type 'hook) |
191 | 182 |
192 (defvar global-auto-revert-ignore-buffer nil | 183 (defvar global-auto-revert-ignore-buffer nil |
193 "*When non-nil, Global Auto-Revert Mode will not revert this buffer. | 184 "*When non-nil, Global Auto-Revert Mode will not revert this buffer. |
194 | 185 |
195 This variable becomes buffer local when set in any faishon.") | 186 This variable becomes buffer local when set in any fashion.") |
196 (make-variable-buffer-local 'global-auto-revert-ignore-buffer) | 187 (make-variable-buffer-local 'global-auto-revert-ignore-buffer) |
197 | 188 |
198 | 189 |
199 ;; Internal variables: | 190 ;; Internal variables: |
200 | 191 |
216 | 207 |
217 ;; Functions: | 208 ;; Functions: |
218 | 209 |
219 ;;;###autoload | 210 ;;;###autoload |
220 (defun auto-revert-mode (&optional arg) | 211 (defun auto-revert-mode (&optional arg) |
221 "Revert buffer when file on disk change. | 212 "Toggle reverting buffer when file on disk changes. |
222 | 213 |
223 This is a minor mode that affect only the current buffer. | 214 With arg, turn Auto Revert mode on if and only if arg is positive. |
215 This is a minor mode that affects only the current buffer. | |
224 Use `global-auto-revert-mode' to automatically revert all buffers." | 216 Use `global-auto-revert-mode' to automatically revert all buffers." |
225 (interactive "P") | 217 (interactive "P") |
226 (make-local-variable 'auto-revert-mode) | 218 (make-local-variable 'auto-revert-mode) |
227 (setq auto-revert-mode | 219 (setq auto-revert-mode |
228 (if (null arg) | 220 (if (null arg) |
254 | 246 |
255 ;;;###autoload | 247 ;;;###autoload |
256 (defun global-auto-revert-mode (&optional arg) | 248 (defun global-auto-revert-mode (&optional arg) |
257 "Revert any buffer when file on disk change. | 249 "Revert any buffer when file on disk change. |
258 | 250 |
259 This is a minor mode that affect all buffers. | 251 With arg, turn Auto Revert mode on globally if and only if arg is positive. |
252 This is a minor mode that affects all buffers. | |
260 Use `auto-revert-mode' to revert a particular buffer." | 253 Use `auto-revert-mode' to revert a particular buffer." |
261 (interactive "P") | 254 (interactive "P") |
262 (setq global-auto-revert-mode | 255 (setq global-auto-revert-mode |
263 (if (null arg) | 256 (if (null arg) |
264 (not global-auto-revert-mode) | 257 (not global-auto-revert-mode) |
295 Non-file buffers that have a custom `revert-buffer-function' are | 288 Non-file buffers that have a custom `revert-buffer-function' are |
296 reverted either when Auto-Revert Mode is active in that buffer, or | 289 reverted either when Auto-Revert Mode is active in that buffer, or |
297 when the variable `global-auto-revert-non-file-buffers' is non-nil | 290 when the variable `global-auto-revert-non-file-buffers' is non-nil |
298 and Global Auto-Revert Mode is active. | 291 and Global Auto-Revert Mode is active. |
299 | 292 |
300 This function stops whenever the user use Emacs. The buffers not | 293 This function stops whenever there is user input. The buffers not |
301 checked are stored in the variable `auto-revert-remaining-buffers'. | 294 checked are stored in the variable `auto-revert-remaining-buffers'. |
302 | 295 |
303 To avoid starvation, the buffers in `auto-revert-remaining-buffers' | 296 To avoid starvation, the buffers in `auto-revert-remaining-buffers' |
304 are checked first the next time this function is called. | 297 are checked first the next time this function is called. |
305 | 298 |
306 This function is also responslible for removing buffers no longer in | 299 This function is also responsible for removing buffers no longer in |
307 Auto-Revert mode from `auto-revert-buffer-list', and for canceling | 300 Auto-Revert mode from `auto-revert-buffer-list', and for canceling |
308 the timer when no buffers need to be checked." | 301 the timer when no buffers need to be checked." |
309 (let ((bufs (if global-auto-revert-mode | 302 (let ((bufs (if global-auto-revert-mode |
310 (buffer-list) | 303 (buffer-list) |
311 auto-revert-buffer-list)) | 304 auto-revert-buffer-list)) |