• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/

Lines Matching +defs:auto +defs:mode +defs:list

43 ;; `global-auto-revert-non-file-buffers' is non-nil, it also applies
49 ;; intervals of `auto-revert-interval'. The default is every five
63 ;; behavior may be mode dependent.
66 ;; contains a third minor mode, Auto Revert Tail Mode, which does so
75 ;; M-x auto-revert-mode RET
76 ;; M-x auto-revert-tail-mode RET
79 ;; M-x global-auto-revert-mode RET
82 ;; customise the option `global-auto-revert-mode' or the following
84 ;; (global-auto-revert-mode 1)
86 ;; The function `turn-on-auto-revert-mode' could be added to any major
87 ;; mode hook to activate Auto-Revert Mode for all buffers in that
88 ;; mode. For example, the following line will activate Auto-Revert
89 ;; Mode in all C mode buffers:
91 ;; (add-hook 'c-mode-hook 'turn-on-auto-revert-mode)
107 (defgroup auto-revert nil
118 ;;; What's this?: ;; Autoload for the benefit of `make-mode-line-mouse-sensitive'.
120 (defvar auto-revert-mode nil
122 Never set this variable directly, use the command `auto-revert-mode' instead.")
123 (put 'auto-revert-mode 'permanent-local t)
125 (defvar auto-revert-tail-mode nil
128 `auto-revert-tail-mode' instead.")
129 (put 'auto-revert-tail-mode 'permanent-local t)
131 (defvar auto-revert-timer nil
134 (defcustom auto-revert-interval 5
141 `auto-revert-set-timer' after setting the variable. Otherwise,
143 calls `auto-revert-set-timer' for internal reasons or in your
145 :group 'auto-revert
149 (and (boundp 'auto-revert-timer)
150 auto-revert-timer
151 (auto-revert-set-timer))))
153 (defcustom auto-revert-stop-on-user-input t
161 :group 'auto-revert
164 (defcustom auto-revert-verbose t
167 :group 'auto-revert
170 (defcustom auto-revert-mode-text " ARev"
171 "String to display in the mode line when Auto-Revert Mode is active.
175 :group 'auto-revert
178 (defcustom auto-revert-tail-mode-text " Tail"
179 "String to display in the mode line when Auto-Revert Tail Mode is active.
182 :group 'auto-revert
186 (defcustom auto-revert-mode-hook nil
189 :group 'auto-revert
192 (defcustom global-auto-revert-mode-text ""
195 The default is nothing since when this mode is active this text doesn't
196 vary over time, or between buffers. Hence mode line text
198 :group 'auto-revert
201 (defcustom global-auto-revert-mode-hook nil
203 :group 'auto-revert
206 (defcustom global-auto-revert-non-file-buffers nil
207 "When nil, Global Auto-Revert mode operates only on file-visiting buffers.
211 reverted by Global Auto-Revert mode. These include the Buffer
213 directories. Dired buffers do not auto-revert as a result of
217 Use this option with care since it could lead to excessive auto-reverts.
219 :group 'auto-revert
223 (defcustom global-auto-revert-ignore-modes ()
225 :group 'auto-revert
228 (defcustom auto-revert-load-hook nil
231 :group 'auto-revert
234 (defcustom auto-revert-check-vc-info nil
242 version control number in the mode line, as well as other version
247 control info every `auto-revert-interval' seconds. Nevertheless,
251 :group 'auto-revert
255 (defvar global-auto-revert-ignore-buffer nil
259 (make-variable-buffer-local 'global-auto-revert-ignore-buffer)
263 (defvar auto-revert-buffer-list ()
267 buffers to this list.
269 The timer function `auto-revert-buffers' is responsible for purging
270 the list of old buffers.")
272 (defvar auto-revert-remaining-buffers ()
275 (defvar auto-revert-tail-pos 0
280 (set (make-local-variable 'auto-revert-tail-pos)
286 (define-minor-mode auto-revert-mode
289 With arg, turn Auto Revert mode on if and only if arg is positive.
290 This is a minor mode that affects only the current buffer.
291 Use `global-auto-revert-mode' to automatically revert all buffers.
292 Use `auto-revert-tail-mode' if you know that the file will only grow
294 :group 'auto-revert :lighter auto-revert-mode-text
295 (if auto-revert-mode
296 (if (not (memq (current-buffer) auto-revert-buffer-list))
297 (push (current-buffer) auto-revert-buffer-list))
298 (setq auto-revert-buffer-list
299 (delq (current-buffer) auto-revert-buffer-list)))
300 (auto-revert-set-timer)
301 (when auto-revert-mode
302 (auto-revert-buffers)
303 (setq auto-revert-tail-mode nil)))
307 (defun turn-on-auto-revert-mode ()
311 (add-hook 'c-mode-hook 'turn-on-auto-revert-mode)"
312 (auto-revert-mode 1))
316 (define-minor-mode auto-revert-tail-mode
318 With arg, turn Tail mode on iff arg is positive.
320 When Tail mode is enabled, the tail of the file is constantly
326 You can edit the buffer and turn this mode off and on again as
330 Use `auto-revert-mode' for changes other than appends!"
331 :group 'find-file :lighter auto-revert-tail-mode-text
332 (when auto-revert-tail-mode
334 (auto-revert-tail-mode 0)
337 (not auto-revert-tail-pos) ; library was loaded only after finding file
339 (auto-revert-tail-mode 0)
341 (add-hook 'before-save-hook (lambda () (auto-revert-tail-mode 0)) nil t)
342 (or (local-variable-p 'auto-revert-tail-pos) ; don't lose prior position
343 (set (make-local-variable 'auto-revert-tail-pos)
345 ;; let auto-revert-mode set up the mechanism for us if it isn't already
346 (or auto-revert-mode
347 (let ((auto-revert-tail-mode t))
348 (auto-revert-mode 1)))
349 (setq auto-revert-mode nil))))
353 (defun turn-on-auto-revert-tail-mode ()
357 (add-hook 'my-logfile-mode-hook 'turn-on-auto-revert-tail-mode)"
358 (auto-revert-tail-mode 1))
362 (define-minor-mode global-auto-revert-mode
365 With arg, turn Auto Revert mode on globally if and only if arg is positive.
366 This is a minor mode that affects all buffers.
367 Use `auto-revert-mode' to revert a particular buffer."
368 :global t :group 'auto-revert :lighter global-auto-revert-mode-text
369 (auto-revert-set-timer)
370 (when global-auto-revert-mode
371 (auto-revert-buffers)))
374 (defun auto-revert-set-timer ()
379 will use an up-to-date value of `auto-revert-interval'"
381 (if (timerp auto-revert-timer)
382 (cancel-timer auto-revert-timer))
383 (setq auto-revert-timer
384 (if (or global-auto-revert-mode auto-revert-buffer-list)
385 (run-with-timer auto-revert-interval
386 auto-revert-interval
387 'auto-revert-buffers))))
389 (defun auto-revert-active-p ()
390 "Check if auto-revert is active (in current buffer or globally)."
391 (or auto-revert-mode
392 auto-revert-tail-mode
394 global-auto-revert-mode
395 (not global-auto-revert-ignore-buffer)
396 (not (memq major-mode
397 global-auto-revert-ignore-modes)))))
399 (defun auto-revert-handler ()
402 (when (or auto-revert-tail-mode (not (buffer-modified-p)))
409 (and (or auto-revert-mode
410 global-auto-revert-non-file-buffers)
417 (when (and auto-revert-verbose
431 (if auto-revert-tail-mode
432 (auto-revert-tail-handler)
435 ;; when the file's mode changes, but that is less common.
437 (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes)))
443 ;; do want to reset the mode for VC, so we do it manually.
444 (when (or revert auto-revert-check-vc-info)
447 (defun auto-revert-tail-handler ()
453 (when (> size auto-revert-tail-pos)
459 (insert-file-contents file nil auto-revert-tail-pos size)))
460 (run-mode-hooks 'after-revert-hook)
462 (setq auto-revert-tail-pos size)
466 (defun auto-revert-buffers ()
469 Should `global-auto-revert-mode' be active all file buffers are checked.
471 Should `auto-revert-mode' be active in some buffers, those buffers
477 `global-auto-revert-non-file-buffers' is non-nil and Global
481 checked are stored in the variable `auto-revert-remaining-buffers'.
483 To avoid starvation, the buffers in `auto-revert-remaining-buffers'
487 Auto-Revert mode from `auto-revert-buffer-list', and for canceling
490 (let ((bufs (if global-auto-revert-mode
491 (buffer-list)
492 auto-revert-buffer-list))
496 ;; the buffers are in `auto-revert-remaining-buffers'. The two
498 ;; head of the list.
499 (dolist (buf auto-revert-remaining-buffers)
507 (not (and auto-revert-stop-on-user-input
513 ;; non-standard way, for example by changing major mode.
514 (if (and (not auto-revert-mode)
515 (not auto-revert-tail-mode)
516 (memq buf auto-revert-buffer-list))
517 (setq auto-revert-buffer-list
518 (delq buf auto-revert-buffer-list)))
519 (when (auto-revert-active-p) (auto-revert-handler)))
520 ;; Remove dead buffer from `auto-revert-buffer-list'.
521 (setq auto-revert-buffer-list
522 (delq buf auto-revert-buffer-list))))
524 (setq auto-revert-remaining-buffers bufs)
526 (when (and (not global-auto-revert-mode)
527 (null auto-revert-buffer-list))
528 (cancel-timer auto-revert-timer)
529 (setq auto-revert-timer nil)))))
535 (run-hooks 'auto-revert-load-hook)