emacs-diffs
[Top][All Lists]
Advanced

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

master 748df22 06/11: ; * lisp/so-long.el: Minor bug fixes


From: Phil Sainty
Subject: master 748df22 06/11: ; * lisp/so-long.el: Minor bug fixes
Date: Tue, 3 Aug 2021 07:44:26 -0400 (EDT)

branch: master
commit 748df220efdd46439578f252ee18091770c82af6
Author: Phil Sainty <psainty@orcon.net.nz>
Commit: Phil Sainty <psainty@orcon.net.nz>

    ; * lisp/so-long.el: Minor bug fixes
    
    (so-long-disable-minor-modes): Don't call the mode function to disable
    the mode unless it was actually enabled.
    
    (so-long-restore-minor-modes, so-long-restore-variables): Use the
    remembered list values, which might be different to the defaults.
    
    Also comments, and spelling consistency changes for the so-long tests
    (a fixup for commit 83bc4ad369 which had only addressed so-long.el,
    and not the test files).
---
 lisp/so-long.el                           | 7 ++++---
 test/lisp/so-long-tests/so-long-tests.el  | 9 ++++++---
 test/lisp/so-long-tests/spelling-tests.el | 2 +-
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/lisp/so-long.el b/lisp/so-long.el
index 8dd2d1a..dafcfaa 100644
--- a/lisp/so-long.el
+++ b/lisp/so-long.el
@@ -1346,14 +1346,15 @@ Calls `so-long-disable-minor-modes' and 
`so-long-override-variables'."
 (defun so-long-disable-minor-modes ()
   "Disable any active minor modes listed in `so-long-minor-modes'."
   (dolist (mode (so-long-original 'so-long-minor-modes))
-    (when (and (boundp mode) mode)
+    (when (and (boundp mode)
+               (symbol-value mode))
       (funcall mode 0))))
 
 (defun so-long-restore-minor-modes ()
   "Restore the minor modes which were disabled.
 
 The modes are enabled in accordance with what was remembered in `so-long'."
-  (dolist (mode so-long-minor-modes)
+  (dolist (mode (so-long-original 'so-long-minor-modes))
     (when (and (so-long-original mode)
                (boundp mode)
                (not (symbol-value mode)))
@@ -1368,7 +1369,7 @@ The modes are enabled in accordance with what was 
remembered in `so-long'."
   "Restore the remembered values for the overridden variables.
 
 The variables are set in accordance with what was remembered in `so-long'."
-  (dolist (ovar so-long-variable-overrides)
+  (dolist (ovar (so-long-original 'so-long-variable-overrides))
     (so-long-restore-variable (car ovar))))
 
 (defun so-long-restore-variable (variable)
diff --git a/test/lisp/so-long-tests/so-long-tests.el 
b/test/lisp/so-long-tests/so-long-tests.el
index a6d8721..56c20e6 100644
--- a/test/lisp/so-long-tests/so-long-tests.el
+++ b/test/lisp/so-long-tests/so-long-tests.el
@@ -58,7 +58,7 @@
 (declare-function so-long-tests-assert-reverted "so-long-tests-helpers")
 (declare-function so-long-tests-assert-and-revert "so-long-tests-helpers")
 
-;; Enable the automated behavior for all tests.
+;; Enable the automated behaviour for all tests.
 (global-so-long-mode 1)
 
 (ert-deftest so-long-tests-threshold-under ()
@@ -180,7 +180,7 @@
       ;; From Emacs 27 the `display-buffer' call is insufficient.
       ;; The various 'window change functions' are now invoked by the
       ;; redisplay, and redisplay does nothing at all in batch mode,
-      ;; so we cannot test under this revised behavior.  Refer to:
+      ;; so we cannot test under this revised behaviour.  Refer to:
       ;; https://lists.gnu.org/r/emacs-devel/2019-10/msg00971.html
       ;; For interactive (non-batch) test runs, calling `redisplay'
       ;; does do the trick; so do that first.
@@ -405,7 +405,10 @@
          (insert ,local-vars)
          (normal-mode)
          ;; Remember the `emacs-lisp-mode' state.  The other cases
-         ;; will validate the 'reverted' state against this.
+         ;; will validate the 'reverted' state against this.  (Note
+         ;; that we haven't displayed the buffer, and therefore only
+         ;; `so-long-invisible-buffer-function' has acted, so we are
+         ;; still remembering the 'before' state.)
          (so-long-tests-remember)
          (should (eq major-mode 'emacs-lisp-mode)))
        ;; Downgrade the action from major mode to minor mode.
diff --git a/test/lisp/so-long-tests/spelling-tests.el 
b/test/lisp/so-long-tests/spelling-tests.el
index 0be8555..f778b64 100644
--- a/test/lisp/so-long-tests/spelling-tests.el
+++ b/test/lisp/so-long-tests/spelling-tests.el
@@ -57,7 +57,7 @@
             (unwind-protect
                 (cl-letf (((symbol-function 'ispell-command-loop)
                            (lambda (_miss _guess word _start _end)
-                             (message "Unrecognized word: %s." word)
+                             (message "Unrecognised word: %s." word)
                              (throw 'mistake t))))
                   (catch 'mistake
                     (find-library "so-long")



reply via email to

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