Function: logview-revert-buffer
logview-revert-buffer is an interactive and natively compiled function
defined in logview.el.
Signature
(logview-revert-buffer)
Documentation
Revert the buffer preserving active filters.
This command won't ask for confirmation unless the buffer is modified.
This can be seen as an alternative to auto-revert-mode: instead
of automatic reverting you ask for it explicitly. It should be
as simple as typing \<logview-mode-map>M-x logview-revert-buffer (logview-revert-buffer), as no confirmations are asked.
If the buffer is narrowed and its contents got changed in the
beginning (see logview-reassurance-chars), for example due to
log rotation, this function also widens it. Narrowing
restrictions most likely wouldn't make any sense with new text.
Key Bindings
logview-mode-map X
Source Code
;; Defined in /nix/store/3zkn9hgpv447zb8nrg55d9x2ynmmrk40-emacs-packages-deps/share/emacs/site-lisp/elpa/logview-20260218.2013/logview.el
(defun logview-revert-buffer ()
"Revert the buffer preserving active filters.
This command won't ask for confirmation unless the buffer is
modified.
This can be seen as an alternative to `auto-revert-mode': instead
of automatic reverting you ask for it explicitly. It should be
as simple as typing `\\<logview-mode-map>\\[logview-revert-buffer]', as no confirmations are asked.
If the buffer is narrowed and its contents got changed in the
beginning (see `logview-reassurance-chars'), for example due to
log rotation, this function also widens it. Narrowing
restrictions most likely wouldn't make any sense with new text."
(interactive)
(let* ((narrowed (buffer-narrowed-p))
(reassurance-chars (max logview-reassurance-chars 1))
(first-characters (when narrowed
(logview--temporarily-widening
(buffer-substring-no-properties
(point-min)
(min (point-max) reassurance-chars)))))
(revert-without-query (when buffer-file-name (list (regexp-quote buffer-file-name))))
(was-read-only buffer-read-only))
(revert-buffer nil nil t)
;; Apparently 'revert-buffer' resets this.
(read-only-mode (if was-read-only 1 0))
(if narrowed
(let ((same-contents (logview--temporarily-widening
(string= (buffer-substring-no-properties
(point-min) (min (point-max) reassurance-chars))
first-characters))))
(if same-contents
(message "Reverted the buffer; kept the narrowing as the start contents is the same")
(logview-widen)
(message "Reverted the buffer; widened it as narrowing is likely obsolete with new contents")))
(message "Reverted the buffer"))))