summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Sainty <psainty@orcon.net.nz>2021-01-10 15:20:51 +1300
committerPhil Sainty <psainty@orcon.net.nz>2021-03-21 16:02:42 +1300
commit723bf5ddee08fd2af6646e0cf82c94d8111667b5 (patch)
treef9ff769b46c1033747a59cb8e81fb09a8d16716c
parenta2f279032faf41635fb7104b7094596c2a63ca26 (diff)
downloademacs-723bf5ddee08fd2af6646e0cf82c94d8111667b5.tar.gz
; * 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).
-rw-r--r--lisp/so-long.el7
-rw-r--r--test/lisp/so-long-tests/so-long-tests.el9
-rw-r--r--test/lisp/so-long-tests/spelling-tests.el2
3 files changed, 11 insertions, 7 deletions
diff --git a/lisp/so-long.el b/lisp/so-long.el
index cb0df5f2947..94028a77c7d 100644
--- a/lisp/so-long.el
+++ b/lisp/so-long.el
@@ -1342,14 +1342,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)))
@@ -1364,7 +1365,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 a6d8721ffc8..56c20e63b55 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 0be8555bdd2..f778b646635 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")