branch: externals/autorevert-tail-truncate commit 70653777a521aa43ff52bd94117de3bdc282d459 Author: shipmints <shipmi...@gmail.com> Commit: shipmints <shipmi...@gmail.com>
Remove auto-revert-tail-mode-on-log-files in favor of documentation --- README.md | 20 ++++++++++++++++++++ autorevert-tail-truncate.el | 6 ------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 804e477ec6..cc344a26bc 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,26 @@ Or, if you use Emacs 30+, uncomment the :vc stanza, below. (auto-revert-tail-mode-on-log-files)) ``` +To invoke the mode interactively, use `M-x auto-revert-tail-truncate-mode`. + +To enable `auto-revert-tail-truncate-mode` automatically when viewing files of certain modes, add something like the following to their major-mode hooks. + +``` elisp +(defun my/fundamental-mode-hook () + (auto-revert-tail-truncate-mode)) +(add-hook 'fundamental-mode-hook #'my/fundamental-mode-hook) +``` + +If you want to enable `auto-revert-tail-truncate-mode` only for buffers with file names that have a .log suffix, but not others that share the same major mode, consider the following. + +``` elisp +(defun my/fundamental-mode-hook () + (when (and buffer-file-name + (string-match-p "\\.log\\'" buffer-file-name)) + (auto-revert-tail-truncate-mode))) +(add-hook 'fundamental-mode-hook #'my/fundamental-mode-hook) +``` + ## Coda I put this into the package because the earliest Emacs I can easily support is 29.x. This will likely be altered if the package is diff --git a/autorevert-tail-truncate.el b/autorevert-tail-truncate.el index 95c8c0f16c..ec6cc2cb02 100644 --- a/autorevert-tail-truncate.el +++ b/autorevert-tail-truncate.el @@ -192,12 +192,6 @@ Invoke programmatically specifying FILENAME." (auto-revert-tail-truncate-mode)) (pop-to-buffer buf))) -;;;###autoload -(defun auto-revert-tail-mode-on-log-files () - "Enable `auto-revert-tail-truncate-mode' for all *.log files." - (interactive) - (add-to-list 'auto-mode-alist '("\\.log\\'" . auto-revert-tail-truncate-mode))) - (provide 'autorevert-tail-truncate) ;;; autorevert-tail-truncate.el ends here