From e8718522c22db801a7a89266cc5a9ee40c3fcbe0 Mon Sep 17 00:00:00 2001 From: Phil Sainty Date: Sun, 10 Jan 2021 14:43:16 +1300 Subject: [PATCH] Make `global-so-long-mode' handle unrecognised file types * lisp/so-long.el (so-long-target-modes): Add `fundamental-mode' * etc/NEWS: Describe changes. This doesn't affect buffers which are simply in `fundamental-mode' by default. It only affects buffers for which `set-auto-mode' has been called (normally via `find-file') without establishing a different major mode. --- etc/NEWS | 7 +++++++ lisp/so-long.el | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 9f22d78159c..66d240016cf 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2861,6 +2861,13 @@ personal key ring. 10000 characters and 500 lines respectively, to reduce the likelihood of false-positives when 'global-so-long-mode' is enabled. +--- +*** 'so-long-target-modes' now includes 'fundamental-mode' by default, +meaning that 'global-so-long-mode' will also process files which were +not recognised. (This only has an effect if 'set-auto-mode' chooses +'fundamental-mode'; buffers which are simply in 'fundamental-mode' by +default are unaffected.) + * New Modes and Packages in Emacs 28.1 diff --git a/lisp/so-long.el b/lisp/so-long.el index 58857deb477..bcb670f654f 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -393,6 +393,7 @@ ;; ;; 1.1 - Increase `so-long-threshold' from 250 to 10,000. ;; - Increase `so-long-max-lines' from 5 to 500. +;; - Include `fundamental-mode' in `so-long-target-modes'. ;; 1.0 - Included in Emacs 27.1, and in GNU ELPA for prior versions of Emacs. ;; - New global mode `global-so-long-mode' to enable/disable the library. ;; - New user option `so-long-action'. @@ -528,7 +529,7 @@ See `so-long-detected-long-line-p' for details." :package-version '(so-long . "1.0")) (defcustom so-long-target-modes - '(prog-mode css-mode sgml-mode nxml-mode) + '(prog-mode css-mode sgml-mode nxml-mode fundamental-mode) "`so-long' affects only these modes and their derivatives. Our primary use-case is minified programming code, so `prog-mode' covers @@ -541,7 +542,7 @@ files would prevent Emacs from handling them correctly." ;; Use 'symbol', as 'function' may be unknown => mismatch. :type '(choice (repeat :tag "Specified modes" symbol) (const :tag "All modes" t)) - :package-version '(so-long . "1.0")) + :package-version '(so-long . "1.1")) (defcustom so-long-invisible-buffer-function #'so-long-deferred "Function called in place of `so-long' when the buffer is not displayed. -- 2.39.2