diff options
| author | Glenn Morris | 2014-04-03 22:09:35 -0400 |
|---|---|---|
| committer | Glenn Morris | 2014-04-03 22:09:35 -0400 |
| commit | 8a1d24b11ef7bfed0752896cbfbcdd793f100b03 (patch) | |
| tree | 23cfe23968dcc68b9649c745d76eae05d0ab720c | |
| parent | 0360792967fa95567a9ec2d767f3a33563c1bbc5 (diff) | |
| download | emacs-8a1d24b11ef7bfed0752896cbfbcdd793f100b03.tar.gz emacs-8a1d24b11ef7bfed0752896cbfbcdd793f100b03.zip | |
Doc updates for buffer-stale-function now applying to file buffers too
* doc/emacs/arevert-xtra.texi (Supporting additional buffers):
* doc/lispref/backups.texi (Reverting):
Update for buffer-stale-function also applying to file-buffers.
* lisp/autorevert.el (auto-revert-buffers):
* lisp/files.el (buffer-stale--default-function)
(buffer-stale-function, revert-buffer--default): Doc tweaks.
* etc/NEWS: Related edits.
| -rw-r--r-- | doc/emacs/ChangeLog | 2 | ||||
| -rw-r--r-- | doc/emacs/arevert-xtra.texi | 6 | ||||
| -rw-r--r-- | doc/lispref/ChangeLog | 2 | ||||
| -rw-r--r-- | doc/lispref/backups.texi | 4 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/autorevert.el | 2 | ||||
| -rw-r--r-- | lisp/files.el | 12 |
8 files changed, 30 insertions, 9 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index bd593f49db3..c0581424833 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | * files.texi (Backup Names): | 3 | * files.texi (Backup Names): |
| 4 | * arevert-xtra.texi (Supporting additional buffers): | 4 | * arevert-xtra.texi (Supporting additional buffers): |
| 5 | Update for default values of some -function vars no longer being nil. | 5 | Update for default values of some -function vars no longer being nil. |
| 6 | (Supporting additional buffers): | ||
| 7 | Update for buffer-stale-function also applying to file-buffers. | ||
| 6 | 8 | ||
| 7 | 2014-03-16 Dmitry Gutov <dgutov@yandex.ru> | 9 | 2014-03-16 Dmitry Gutov <dgutov@yandex.ru> |
| 8 | 10 | ||
diff --git a/doc/emacs/arevert-xtra.texi b/doc/emacs/arevert-xtra.texi index 0f05d1db0e1..dcb73bc96de 100644 --- a/doc/emacs/arevert-xtra.texi +++ b/doc/emacs/arevert-xtra.texi | |||
| @@ -107,11 +107,11 @@ To support auto-reverting the buffer must first of all have a suitable | |||
| 107 | @code{revert-buffer-function}. @xref{Definition of | 107 | @code{revert-buffer-function}. @xref{Definition of |
| 108 | revert-buffer-function,, Reverting, elisp, the Emacs Lisp Reference Manual}. | 108 | revert-buffer-function,, Reverting, elisp, the Emacs Lisp Reference Manual}. |
| 109 | 109 | ||
| 110 | In addition, it must have a @code{buffer-stale-function}. | 110 | In addition, it must have a suitable @code{buffer-stale-function}. |
| 111 | 111 | ||
| 112 | @c FIXME only defvar in all of doc/emacs! | 112 | @c FIXME only defvar in all of doc/emacs! |
| 113 | @defvar buffer-stale-function | 113 | @defvar buffer-stale-function |
| 114 | The value of this variable is a function to check whether a non-file | 114 | The value of this variable is a function to check whether a |
| 115 | buffer needs reverting. This should be a function with one optional | 115 | buffer needs reverting. This should be a function with one optional |
| 116 | argument @var{noconfirm}. The function should return non-@code{nil} | 116 | argument @var{noconfirm}. The function should return non-@code{nil} |
| 117 | if the buffer should be reverted. The buffer is current when this | 117 | if the buffer should be reverted. The buffer is current when this |
| @@ -132,7 +132,7 @@ If you just want to automatically auto-revert every | |||
| 132 | @code{auto-revert-interval} seconds (like the Buffer Menu), use: | 132 | @code{auto-revert-interval} seconds (like the Buffer Menu), use: |
| 133 | 133 | ||
| 134 | @example | 134 | @example |
| 135 | (set (make-local-variable 'buffer-stale-function) | 135 | (setq-local buffer-stale-function |
| 136 | #'(lambda (&optional noconfirm) 'fast)) | 136 | #'(lambda (&optional noconfirm) 'fast)) |
| 137 | @end example | 137 | @end example |
| 138 | 138 | ||
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 456c2cbdc12..1fb664893f8 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | * backups.texi (Making Backups, Reverting): | 3 | * backups.texi (Making Backups, Reverting): |
| 4 | Update for default values of some -function vars no longer being nil. | 4 | Update for default values of some -function vars no longer being nil. |
| 5 | (Reverting): Update for buffer-stale-function | ||
| 6 | also applying to file-buffers. | ||
| 5 | 7 | ||
| 6 | 2014-03-25 Eli Zaretskii <eliz@gnu.org> | 8 | 2014-03-25 Eli Zaretskii <eliz@gnu.org> |
| 7 | 9 | ||
diff --git a/doc/lispref/backups.texi b/doc/lispref/backups.texi index 9fa97fc1300..63f8f227c84 100644 --- a/doc/lispref/backups.texi +++ b/doc/lispref/backups.texi | |||
| @@ -764,7 +764,9 @@ may or may not run this hook. | |||
| 764 | @c FIXME? Move this section from arevert-xtra to here? | 764 | @c FIXME? Move this section from arevert-xtra to here? |
| 765 | @defvar buffer-stale-function | 765 | @defvar buffer-stale-function |
| 766 | The value of this variable specifies a function to call to check | 766 | The value of this variable specifies a function to call to check |
| 767 | whether a non-file buffer needs reverting | 767 | whether a buffer needs reverting. The default value only handles |
| 768 | buffers that are visiting files, by checking their modification time. | ||
| 769 | Buffers that are not visiting files require a custom function | ||
| 768 | @iftex | 770 | @iftex |
| 769 | (@pxref{Supporting additional buffers,,, emacs-xtra, Specialized Emacs Features}). | 771 | (@pxref{Supporting additional buffers,,, emacs-xtra, Specialized Emacs Features}). |
| 770 | @end iftex | 772 | @end iftex |
| @@ -1401,11 +1401,14 @@ argument, with the same interpretation as the returned value of | |||
| 1401 | 1401 | ||
| 1402 | ** Revert and Autorevert changes | 1402 | ** Revert and Autorevert changes |
| 1403 | 1403 | ||
| 1404 | FIXME buffer-stale-function no longer just for non-file buffers? | 1404 | +++ |
| 1405 | *** The default values of `buffer-stale-function', `revert-buffer-function', | 1405 | *** The default values of `buffer-stale-function', `revert-buffer-function', |
| 1406 | and `revert-buffer-insert-file-contents-function' are no longer nil. | 1406 | and `revert-buffer-insert-file-contents-function' are no longer nil. |
| 1407 | Instead they default to functions that do what the nil value used to. | 1407 | Instead they default to functions that do what the nil value used to. |
| 1408 | 1408 | ||
| 1409 | +++ | ||
| 1410 | *** `buffer-stale-function' is now used for buffers visiting files too. | ||
| 1411 | |||
| 1409 | --- | 1412 | --- |
| 1410 | *** If Emacs is compiled with file notification support, it uses notifications | 1413 | *** If Emacs is compiled with file notification support, it uses notifications |
| 1411 | instead of checking file time stamps. To disable this, set the user option | 1414 | instead of checking file time stamps. To disable this, set the user option |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c35be3ec270..f6340047e0a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2014-04-04 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * files.el (buffer-stale--default-function) | ||
| 4 | (buffer-stale-function, revert-buffer--default): | ||
| 5 | * autorevert.el (auto-revert-buffers): Doc tweaks. | ||
| 6 | |||
| 1 | 2014-04-03 Eli Zaretskii <eliz@gnu.org> | 7 | 2014-04-03 Eli Zaretskii <eliz@gnu.org> |
| 2 | 8 | ||
| 3 | * international/characters.el: Preload uni-mirrored.el. (Bug#17169) | 9 | * international/characters.el: Preload uni-mirrored.el. (Bug#17169) |
diff --git a/lisp/autorevert.el b/lisp/autorevert.el index a08bf7fee6a..f1074e22e51 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el | |||
| @@ -672,7 +672,7 @@ Should `auto-revert-mode' be active in some buffers, those buffers | |||
| 672 | are checked. | 672 | are checked. |
| 673 | 673 | ||
| 674 | Non-file buffers that have a custom `revert-buffer-function' and | 674 | Non-file buffers that have a custom `revert-buffer-function' and |
| 675 | a `buffer-stale-function' are reverted either when Auto-Revert | 675 | `buffer-stale-function' are reverted either when Auto-Revert |
| 676 | Mode is active in that buffer, or when the variable | 676 | Mode is active in that buffer, or when the variable |
| 677 | `global-auto-revert-non-file-buffers' is non-nil and Global | 677 | `global-auto-revert-non-file-buffers' is non-nil and Global |
| 678 | Auto-Revert Mode is active. | 678 | Auto-Revert Mode is active. |
diff --git a/lisp/files.el b/lisp/files.el index d5c6028ff47..e721a813a59 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -5349,13 +5349,16 @@ This should not be relied upon.") | |||
| 5349 | "Default function to use for `buffer-stale-function'. | 5349 | "Default function to use for `buffer-stale-function'. |
| 5350 | This function ignores its argument. | 5350 | This function ignores its argument. |
| 5351 | This returns non-nil if the current buffer is visiting a readable file | 5351 | This returns non-nil if the current buffer is visiting a readable file |
| 5352 | whose modification time does not match that of the buffer." | 5352 | whose modification time does not match that of the buffer. |
| 5353 | |||
| 5354 | This function only handles buffers that are visiting files. | ||
| 5355 | Non-file buffers need a custom function" | ||
| 5353 | (and buffer-file-name | 5356 | (and buffer-file-name |
| 5354 | (file-readable-p buffer-file-name) | 5357 | (file-readable-p buffer-file-name) |
| 5355 | (not (verify-visited-file-modtime (current-buffer))))) | 5358 | (not (verify-visited-file-modtime (current-buffer))))) |
| 5356 | 5359 | ||
| 5357 | (defvar buffer-stale-function #'buffer-stale--default-function | 5360 | (defvar buffer-stale-function #'buffer-stale--default-function |
| 5358 | "Function to check whether a non-file buffer needs reverting. | 5361 | "Function to check whether a buffer needs reverting. |
| 5359 | This should be a function with one optional argument NOCONFIRM. | 5362 | This should be a function with one optional argument NOCONFIRM. |
| 5360 | Auto Revert Mode passes t for NOCONFIRM. The function should return | 5363 | Auto Revert Mode passes t for NOCONFIRM. The function should return |
| 5361 | non-nil if the buffer should be reverted. A return value of | 5364 | non-nil if the buffer should be reverted. A return value of |
| @@ -5450,7 +5453,10 @@ start and end. | |||
| 5450 | 5453 | ||
| 5451 | Calls `revert-buffer-insert-file-contents-function' to reread the | 5454 | Calls `revert-buffer-insert-file-contents-function' to reread the |
| 5452 | contents of the visited file, with two arguments: the first is the file | 5455 | contents of the visited file, with two arguments: the first is the file |
| 5453 | name, the second is non-nil if reading an auto-save file." | 5456 | name, the second is non-nil if reading an auto-save file. |
| 5457 | |||
| 5458 | This function only handles buffers that are visiting files. | ||
| 5459 | Non-file buffers need a custom function." | ||
| 5454 | (with-current-buffer (or (buffer-base-buffer (current-buffer)) | 5460 | (with-current-buffer (or (buffer-base-buffer (current-buffer)) |
| 5455 | (current-buffer)) | 5461 | (current-buffer)) |
| 5456 | (let* ((auto-save-p (and (not ignore-auto) | 5462 | (let* ((auto-save-p (and (not ignore-auto) |