emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/so-long bb5fa1b 4/7: Make `global-so-long-mode' handle unrecogni


From: Phil
Subject: scratch/so-long bb5fa1b 4/7: Make `global-so-long-mode' handle unrecognised file types
Date: Sun, 10 Jan 2021 08:06:59 -0500 (EST)

branch: scratch/so-long
commit bb5fa1b7b5de44c1608cebef6d630b7f8e1669ff
Author: Phil Sainty <psainty@orcon.net.nz>
Commit: Phil Sainty <psainty@orcon.net.nz>

    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 | 8 ++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 87124e0..9d90792 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1884,6 +1884,13 @@ used instead.
 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 8973cd4..bab9e88 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'.
@@ -524,7 +525,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
@@ -537,7 +538,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.
@@ -1896,6 +1897,9 @@ If it appears in `%s', you should remove it."
       (unless global-so-long-mode
         (global-so-long-mode 1)))
     (makunbound 'so-long-mode-enabled))
+  ;; Update to version 1.1 from earlier versions:
+  (when (version< so-long-version "1.1")
+    (add-to-list 'so-long-target-modes 'fundamental-mode))
   ;; Update to version 1.N:
   ;; (when (version< so-long-version "1.N") ...)
   ;;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]