aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sainty2019-11-18 21:27:13 +1300
committerPhil Sainty2019-11-18 21:27:13 +1300
commitccb8bbd581adac2cc1c770c266b5fd52da5c9402 (patch)
treea4e00fdc443747599ed042e863756a81f331bd64
parent952bd2050d7a9b48ed4d7413248ef467d7992077 (diff)
parent33676820bdb0fac8ebd43ab098ad13d8098f3586 (diff)
downloademacs-ccb8bbd581adac2cc1c770c266b5fd52da5c9402.tar.gz
emacs-ccb8bbd581adac2cc1c770c266b5fd52da5c9402.zip
Merge branch 'scratch/so-long-updates'
-rw-r--r--lisp/so-long.el147
-rw-r--r--test/lisp/so-long-tests/so-long-tests.el18
2 files changed, 62 insertions, 103 deletions
diff --git a/lisp/so-long.el b/lisp/so-long.el
index 7d54594dd30..33b7155d044 100644
--- a/lisp/so-long.el
+++ b/lisp/so-long.el
@@ -272,13 +272,13 @@
272;; (setq so-long-threshold 1000) 272;; (setq so-long-threshold 1000)
273;; (setq so-long-max-lines 100) 273;; (setq so-long-max-lines 100)
274;; ;; Additional target major modes to trigger for. 274;; ;; Additional target major modes to trigger for.
275;; (mapc (apply-partially 'add-to-list 'so-long-target-modes) 275;; (mapc (apply-partially #'add-to-list 'so-long-target-modes)
276;; '(sgml-mode nxml-mode)) 276;; '(sgml-mode nxml-mode))
277;; ;; Additional buffer-local minor modes to disable. 277;; ;; Additional buffer-local minor modes to disable.
278;; (mapc (apply-partially 'add-to-list 'so-long-minor-modes) 278;; (mapc (apply-partially #'add-to-list 'so-long-minor-modes)
279;; '(diff-hl-mode diff-hl-amend-mode diff-hl-flydiff-mode)) 279;; '(diff-hl-mode diff-hl-amend-mode diff-hl-flydiff-mode))
280;; ;; Additional variables to override. 280;; ;; Additional variables to override.
281;; (mapc (apply-partially 'add-to-list 'so-long-variable-overrides) 281;; (mapc (apply-partially #'add-to-list 'so-long-variable-overrides)
282;; '((show-trailing-whitespace . nil) 282;; '((show-trailing-whitespace . nil)
283;; (truncate-lines . nil)))) 283;; (truncate-lines . nil))))
284 284
@@ -415,15 +415,6 @@
415 415
416(declare-function longlines-mode "longlines") 416(declare-function longlines-mode "longlines")
417(defvar longlines-mode) 417(defvar longlines-mode)
418
419(declare-function outline-next-visible-heading "outline")
420(declare-function outline-previous-visible-heading "outline")
421(declare-function outline-toggle-children "outline")
422(declare-function outline-toggle-children "outline")
423
424(declare-function ad-find-advice "advice")
425(declare-function ad-remove-advice "advice")
426
427(defvar so-long-enabled nil 418(defvar so-long-enabled nil
428 "Set to nil to prevent `so-long' from being triggered automatically. 419 "Set to nil to prevent `so-long' from being triggered automatically.
429 420
@@ -463,8 +454,7 @@ Has no effect if `global-so-long-mode' is not enabled.")
463 454
464See `so-long-detected-long-line-p' for details." 455See `so-long-detected-long-line-p' for details."
465 :type 'integer 456 :type 'integer
466 :package-version '(so-long . "1.0") 457 :package-version '(so-long . "1.0"))
467 :group 'so-long)
468 458
469(defcustom so-long-max-lines 5 459(defcustom so-long-max-lines 5
470 "Number of non-blank, non-comment lines to test for excessive length. 460 "Number of non-blank, non-comment lines to test for excessive length.
@@ -478,8 +468,7 @@ be counted.
478See `so-long-detected-long-line-p' for details." 468See `so-long-detected-long-line-p' for details."
479 :type '(choice (integer :tag "Limit") 469 :type '(choice (integer :tag "Limit")
480 (const :tag "Unlimited" nil)) 470 (const :tag "Unlimited" nil))
481 :package-version '(so-long . "1.0") 471 :package-version '(so-long . "1.0"))
482 :group 'so-long)
483 472
484(defcustom so-long-skip-leading-comments t 473(defcustom so-long-skip-leading-comments t
485 "Non-nil to ignore all leading comments and whitespace. 474 "Non-nil to ignore all leading comments and whitespace.
@@ -490,8 +479,7 @@ comments following the shebang will be ignored.
490 479
491See `so-long-detected-long-line-p' for details." 480See `so-long-detected-long-line-p' for details."
492 :type 'boolean 481 :type 'boolean
493 :package-version '(so-long . "1.0") 482 :package-version '(so-long . "1.0"))
494 :group 'so-long)
495 483
496(defcustom so-long-target-modes 484(defcustom so-long-target-modes
497 '(prog-mode css-mode sgml-mode nxml-mode) 485 '(prog-mode css-mode sgml-mode nxml-mode)
@@ -507,8 +495,7 @@ files would prevent Emacs from handling them correctly."
507 ;; Use 'symbol', as 'function' may be unknown => mismatch. 495 ;; Use 'symbol', as 'function' may be unknown => mismatch.
508 :type '(choice (repeat :tag "Specified modes" symbol) 496 :type '(choice (repeat :tag "Specified modes" symbol)
509 (const :tag "All modes" t)) 497 (const :tag "All modes" t))
510 :package-version '(so-long . "1.0") 498 :package-version '(so-long . "1.0"))
511 :group 'so-long)
512 499
513(defcustom so-long-invisible-buffer-function #'so-long-deferred 500(defcustom so-long-invisible-buffer-function #'so-long-deferred
514 "Function called in place of `so-long' when the buffer is not displayed. 501 "Function called in place of `so-long' when the buffer is not displayed.
@@ -538,8 +525,7 @@ the mentioned options might interfere with some intended processing."
538 :type '(radio (const so-long-deferred) 525 :type '(radio (const so-long-deferred)
539 (const :tag "nil: Call so-long as normal" nil) 526 (const :tag "nil: Call so-long as normal" nil)
540 (function :tag "Custom function")) 527 (function :tag "Custom function"))
541 :package-version '(so-long . "1.0") 528 :package-version '(so-long . "1.0"))
542 :group 'so-long)
543 529
544(defcustom so-long-predicate 'so-long-detected-long-line-p 530(defcustom so-long-predicate 'so-long-detected-long-line-p
545 "Function, called after `set-auto-mode' to decide whether action is needed. 531 "Function, called after `set-auto-mode' to decide whether action is needed.
@@ -552,8 +538,7 @@ then `so-long' will be invoked.
552Defaults to `so-long-detected-long-line-p'." 538Defaults to `so-long-detected-long-line-p'."
553 :type '(radio (const so-long-detected-long-line-p) 539 :type '(radio (const so-long-detected-long-line-p)
554 (function :tag "Custom function")) 540 (function :tag "Custom function"))
555 :package-version '(so-long . "1.0") 541 :package-version '(so-long . "1.0"))
556 :group 'so-long)
557 542
558;; Silence byte-compiler warning. `so-long-action-alist' is defined below 543;; Silence byte-compiler warning. `so-long-action-alist' is defined below
559;; as a user option; but the definition sequence required for its setter 544;; as a user option; but the definition sequence required for its setter
@@ -605,8 +590,7 @@ subsequently called."
605 (function :tag "Action") 590 (function :tag "Action")
606 (function :tag "Revert"))) 591 (function :tag "Revert")))
607 :set #'so-long--action-alist-setter 592 :set #'so-long--action-alist-setter
608 :package-version '(so-long . "1.0") 593 :package-version '(so-long . "1.0"))
609 :group 'so-long)
610(put 'so-long-action-alist 'risky-local-variable t) 594(put 'so-long-action-alist 'risky-local-variable t)
611 595
612(defcustom so-long-action 'so-long-mode 596(defcustom so-long-action 'so-long-mode
@@ -630,8 +614,7 @@ Each action likewise determines the behaviour of `so-long-revert'.
630If the value is nil, or not defined in `so-long-action-alist', then no action 614If the value is nil, or not defined in `so-long-action-alist', then no action
631will be taken." 615will be taken."
632 :type (so-long--action-type) 616 :type (so-long--action-type)
633 :package-version '(so-long . "1.0") 617 :package-version '(so-long . "1.0"))
634 :group 'so-long)
635 618
636(defvar-local so-long-function nil 619(defvar-local so-long-function nil
637 "The function called by `so-long'. 620 "The function called by `so-long'.
@@ -701,8 +684,7 @@ an example."
701 (const so-long-inhibit) 684 (const so-long-inhibit)
702 (const :tag "nil: Use so-long-function as normal" nil) 685 (const :tag "nil: Use so-long-function as normal" nil)
703 (function :tag "Custom function")) 686 (function :tag "Custom function"))
704 :package-version '(so-long . "1.0") 687 :package-version '(so-long . "1.0"))
705 :group 'so-long)
706(make-variable-buffer-local 'so-long-file-local-mode-function) 688(make-variable-buffer-local 'so-long-file-local-mode-function)
707 689
708;; `provided-mode-derived-p' was added in 26.1 690;; `provided-mode-derived-p' was added in 26.1
@@ -779,8 +761,7 @@ disabled modes are re-enabled by calling them with the numeric argument 1.
779Please submit bug reports to recommend additional modes for this list, whether 761Please submit bug reports to recommend additional modes for this list, whether
780they are in Emacs core, GNU ELPA, or elsewhere." 762they are in Emacs core, GNU ELPA, or elsewhere."
781 :type '(repeat symbol) ;; not function, as may be unknown => mismatch. 763 :type '(repeat symbol) ;; not function, as may be unknown => mismatch.
782 :package-version '(so-long . "1.0") 764 :package-version '(so-long . "1.0"))
783 :group 'so-long)
784 765
785(defcustom so-long-variable-overrides 766(defcustom so-long-variable-overrides
786 '((bidi-paragraph-direction . left-to-right) 767 '((bidi-paragraph-direction . left-to-right)
@@ -813,24 +794,21 @@ scanned to find the next position."
813 (show-paren-mode boolean) 794 (show-paren-mode boolean)
814 (truncate-lines boolean) 795 (truncate-lines boolean)
815 (which-func-mode boolean)) 796 (which-func-mode boolean))
816 :package-version '(so-long . "1.0") 797 :package-version '(so-long . "1.0"))
817 :group 'so-long)
818 798
819(defcustom so-long-hook nil 799(defcustom so-long-hook nil
820 "List of functions to call after `so-long' is called. 800 "List of functions to call after `so-long' is called.
821 801
822See also `so-long-revert-hook'." 802See also `so-long-revert-hook'."
823 :type 'hook 803 :type 'hook
824 :package-version '(so-long . "1.0") 804 :package-version '(so-long . "1.0"))
825 :group 'so-long)
826 805
827(defcustom so-long-revert-hook nil 806(defcustom so-long-revert-hook nil
828 "List of functions to call after `so-long-revert' is called. 807 "List of functions to call after `so-long-revert' is called.
829 808
830See also `so-long-hook'." 809See also `so-long-hook'."
831 :type 'hook 810 :type 'hook
832 :package-version '(so-long . "1.0") 811 :package-version '(so-long . "1.0"))
833 :group 'so-long)
834 812
835(defcustom so-long-mode-line-label "So Long" 813(defcustom so-long-mode-line-label "So Long"
836 "Text label of `so-long-mode-line-info' when long lines are detected. 814 "Text label of `so-long-mode-line-info' when long lines are detected.
@@ -838,20 +816,17 @@ See also `so-long-hook'."
838If nil, no mode line indicator will be displayed." 816If nil, no mode line indicator will be displayed."
839 :type '(choice (string :tag "String") 817 :type '(choice (string :tag "String")
840 (const :tag "None" nil)) 818 (const :tag "None" nil))
841 :package-version '(so-long . "1.0") 819 :package-version '(so-long . "1.0"))
842 :group 'so-long)
843 820
844(defface so-long-mode-line-active 821(defface so-long-mode-line-active
845 '((t :inherit mode-line-emphasis)) 822 '((t :inherit mode-line-emphasis))
846 "Face for `so-long-mode-line-info' when mitigations are active." 823 "Face for `so-long-mode-line-info' when mitigations are active."
847 :package-version '(so-long . "1.0") 824 :package-version '(so-long . "1.0"))
848 :group 'so-long)
849 825
850(defface so-long-mode-line-inactive 826(defface so-long-mode-line-inactive
851 '((t :inherit mode-line-inactive)) 827 '((t :inherit mode-line-inactive))
852 "Face for `so-long-mode-line-info' when mitigations have been reverted." 828 "Face for `so-long-mode-line-info' when mitigations have been reverted."
853 :package-version '(so-long . "1.0") 829 :package-version '(so-long . "1.0"))
854 :group 'so-long)
855 830
856;; Modes that go slowly and line lengths excessive 831;; Modes that go slowly and line lengths excessive
857;; Font-lock performance becoming oppressive 832;; Font-lock performance becoming oppressive
@@ -914,7 +889,7 @@ If RESET is non-nil, remove any existing values before storing the new ones."
914 (help-map (make-sparse-keymap "Help"))) 889 (help-map (make-sparse-keymap "Help")))
915 ;; `so-long-revert'. 890 ;; `so-long-revert'.
916 (define-key-after map [so-long-revert] 891 (define-key-after map [so-long-revert]
917 '(menu-item "Revert to normal" so-long-menu-item-revert 892 '(menu-item "Revert to normal" so-long-revert
918 :enable (and so-long-revert-function 893 :enable (and so-long-revert-function
919 so-long--active))) 894 so-long--active)))
920 ;; `so-long-menu-item-replace-action' over `so-long-action-alist'. 895 ;; `so-long-menu-item-replace-action' over `so-long-action-alist'.
@@ -927,12 +902,19 @@ If RESET is non-nil, remove any existing values before storing the new ones."
927 `(menu-item 902 `(menu-item
928 ,label 903 ,label
929 ,(let ((sym (make-symbol "so-long-menu-item-replace-action"))) 904 ,(let ((sym (make-symbol "so-long-menu-item-replace-action")))
930 ;; Using a symbol here, so that `describe-key' on the menu item 905 ;; We make a symbol so that `describe-key' on the menu item
931 ;; produces the `so-long-menu-item-replace-action' documentation. 906 ;; produces something more descriptive than byte code. There is
932 (defalias sym 907 ;; no interned `so-long-menu-item-replace-action' which might
933 (apply-partially #'so-long-menu-item-replace-action item) 908 ;; make this slightly confusing -- but only in the rare situation
934 (documentation #'so-long-menu-item-replace-action)) 909 ;; when someone uses `describe-key' on one of these menu items,
935 (put sym 'interactive-form '(interactive)) 910 ;; and then wants to find more information. We mitigate this by
911 ;; making the following docstring very clear.
912 (defalias sym (lambda () (interactive "@") (so-long key))
913 ;; We use "@" as commands in the mode-line menu may be
914 ;; triggered by mouse when some other window is selected.
915 "Revert the current action and invoke the chosen replacement.
916
917This commmand calls `so-long' with the selected action as an argument.")
936 sym) 918 sym)
937 :enable (not (and so-long--active 919 :enable (not (and so-long--active
938 (eq ',actionfunc so-long-function) 920 (eq ',actionfunc so-long-function)
@@ -948,39 +930,6 @@ If RESET is non-nil, remove any existing values before storing the new ones."
948 '(menu-item "Customize" so-long-customize)) 930 '(menu-item "Customize" so-long-customize))
949 map)) 931 map))
950 932
951(defun so-long-menu-click-window ()
952 "Return the window for a click in the So Long menu.
953
954Commands in the mode-line menu may be triggered by mouse when some other window
955is selected, so we need to make sure we are acting on the correct buffer."
956 ;; Refer to (info "(elisp) Click Events") regarding the form of the mouse
957 ;; position list for clicks in the mode line.
958 (or (and (mouse-event-p last-nonmenu-event)
959 (windowp (car (cadr last-nonmenu-event))) ; cXXXr only available
960 (car (cadr last-nonmenu-event))) ; since Emacs 26.1
961 (selected-window)))
962
963(defun so-long-menu-item-revert ()
964 "Invoke `so-long-revert'."
965 (interactive)
966 (with-selected-window (so-long-menu-click-window)
967 (so-long-revert)))
968
969(defun so-long-menu-item-replace-action (replacement)
970 "Revert the current action and invoke the specified replacement.
971
972REPLACEMENT is a `so-long-action-alist' item."
973 (interactive)
974 (with-selected-window (so-long-menu-click-window)
975 (when so-long--active
976 (so-long-revert))
977 (cl-destructuring-bind (_key _label actionfunc revertfunc)
978 replacement
979 (setq so-long-function actionfunc)
980 (setq so-long-revert-function revertfunc)
981 (setq this-command 'so-long)
982 (so-long))))
983
984;;;###autoload 933;;;###autoload
985(defun so-long-commentary () 934(defun so-long-commentary ()
986 "View the so-long documentation in `outline-mode'." 935 "View the so-long documentation in `outline-mode'."
@@ -1001,6 +950,10 @@ REPLACEMENT is a `so-long-action-alist' item."
1001 (rename-buffer buf) 950 (rename-buffer buf)
1002 ;; Enable `outline-mode' and `view-mode' for user convenience. 951 ;; Enable `outline-mode' and `view-mode' for user convenience.
1003 (outline-mode) 952 (outline-mode)
953 (declare-function outline-next-visible-heading "outline")
954 (declare-function outline-previous-visible-heading "outline")
955 (declare-function outline-toggle-children "outline")
956 (declare-function outline-toggle-children "outline")
1004 (view-mode 1) 957 (view-mode 1)
1005 ;; Add some custom local bindings. 958 ;; Add some custom local bindings.
1006 (let ((map (make-sparse-keymap))) 959 (let ((map (make-sparse-keymap)))
@@ -1614,8 +1567,12 @@ This command is called automatically when long lines are detected, when
1614 1567
1615The effects of the action can be undone by calling `so-long-revert'. 1568The effects of the action can be undone by calling `so-long-revert'.
1616 1569
1617If ACTION is provided, it is used instead of `so-long-action'. With a prefix 1570If ACTION is provided, it is used instead of `so-long-action'.
1618argument, select the action to use interactively." 1571
1572With a prefix argument, select the action to use interactively.
1573
1574If an action was already active in the buffer, it will be reverted before
1575invoking the new action."
1619 (interactive 1576 (interactive
1620 (list (and current-prefix-arg 1577 (list (and current-prefix-arg
1621 (intern 1578 (intern
@@ -1625,6 +1582,10 @@ argument, select the action to use interactively."
1625 ;; Ensure that `so-long-deferred' only triggers `so-long' once (at most). 1582 ;; Ensure that `so-long-deferred' only triggers `so-long' once (at most).
1626 (remove-hook 'window-configuration-change-hook #'so-long :local) 1583 (remove-hook 'window-configuration-change-hook #'so-long :local)
1627 (unless so-long--calling 1584 (unless so-long--calling
1585 ;; Revert the existing action, if any.
1586 (when so-long--active
1587 (so-long-revert))
1588 ;; Invoke the new action.
1628 (let ((so-long--calling t)) 1589 (let ((so-long--calling t))
1629 (so-long--ensure-enabled) 1590 (so-long--ensure-enabled)
1630 ;; ACTION takes precedence if supplied. 1591 ;; ACTION takes precedence if supplied.
@@ -1665,7 +1626,9 @@ automatically by `global-so-long-mode').
1665For the default action, reverting will restore the original major mode, and 1626For the default action, reverting will restore the original major mode, and
1666restore the minor modes and settings which were overridden when `so-long' was 1627restore the minor modes and settings which were overridden when `so-long' was
1667invoked." 1628invoked."
1668 (interactive) 1629 (interactive "@")
1630 ;; We use "@" as commands in the mode-line menu may be triggered by mouse
1631 ;; when some other window is selected.
1669 (unless so-long--calling 1632 (unless so-long--calling
1670 (let ((so-long--calling t)) 1633 (let ((so-long--calling t))
1671 (when so-long-revert-function 1634 (when so-long-revert-function
@@ -1674,10 +1637,6 @@ invoked."
1674 (let ((inhibit-read-only t)) 1637 (let ((inhibit-read-only t))
1675 (run-hooks 'so-long-revert-hook))))) 1638 (run-hooks 'so-long-revert-hook)))))
1676 1639
1677;; Duplicate the `so-long-revert' documentation for the menu item.
1678(put 'so-long-menu-item-revert 'function-documentation
1679 (documentation 'so-long-revert t))
1680
1681;;;###autoload 1640;;;###autoload
1682(defun so-long-enable () 1641(defun so-long-enable ()
1683 "Enable the so-long library's functionality. 1642 "Enable the so-long library's functionality.
@@ -1848,6 +1807,8 @@ If it appears in `%s', you should remove it."
1848 (when (version< so-long-version "1.0") 1807 (when (version< so-long-version "1.0")
1849 (remove-hook 'change-major-mode-hook 'so-long-change-major-mode) 1808 (remove-hook 'change-major-mode-hook 'so-long-change-major-mode)
1850 (require 'advice) 1809 (require 'advice)
1810 (declare-function ad-find-advice "advice")
1811 (declare-function ad-remove-advice "advice")
1851 (when (ad-find-advice 'hack-local-variables 'after 'so-long--file-local-mode) 1812 (when (ad-find-advice 'hack-local-variables 'after 'so-long--file-local-mode)
1852 (ad-remove-advice 'hack-local-variables 'after 'so-long--file-local-mode) 1813 (ad-remove-advice 'hack-local-variables 'after 'so-long--file-local-mode)
1853 (ad-activate 'hack-local-variables)) 1814 (ad-activate 'hack-local-variables))
@@ -1897,10 +1858,10 @@ If it appears in `%s', you should remove it."
1897; LocalWords: customize customized customizing Customization globalized amongst 1858; LocalWords: customize customized customizing Customization globalized amongst
1898; LocalWords: initialized profiler boolean minified pre redisplay config keymap 1859; LocalWords: initialized profiler boolean minified pre redisplay config keymap
1899; LocalWords: noerror selectable mapc sgml nxml hl flydiff defs arg Phil Sainty 1860; LocalWords: noerror selectable mapc sgml nxml hl flydiff defs arg Phil Sainty
1900; LocalWords: defadvice nadvice whitespace ie bos eos eobp origmode un Un cXXXr 1861; LocalWords: defadvice nadvice whitespace ie bos eos eobp origmode un Un setq
1901; LocalWords: docstring auf wiedersehen longlines alist autoload Refactored Inc 1862; LocalWords: docstring auf wiedersehen longlines alist autoload Refactored Inc
1902; LocalWords: MERCHANTABILITY RET REGEXP VAR ELPA WS mitigations EmacsWiki eval 1863; LocalWords: MERCHANTABILITY RET REGEXP VAR ELPA WS mitigations EmacsWiki eval
1903; LocalWords: setq rx filename filenames 1864; LocalWords: rx filename filenames
1904 1865
1905;; So long, farewell, auf wiedersehen, goodbye 1866;; So long, farewell, auf wiedersehen, goodbye
1906;; You have to go, this code is minified 1867;; You have to go, this code is minified
diff --git a/test/lisp/so-long-tests/so-long-tests.el b/test/lisp/so-long-tests/so-long-tests.el
index 99af5e91ba0..ae834421667 100644
--- a/test/lisp/so-long-tests/so-long-tests.el
+++ b/test/lisp/so-long-tests/so-long-tests.el
@@ -259,26 +259,24 @@
259 (so-long-tests-assert-and-revert (or action 'so-long-mode))))) 259 (so-long-tests-assert-and-revert (or action 'so-long-mode)))))
260 260
261(ert-deftest so-long-tests-so-long-menu-item-replace-action () 261(ert-deftest so-long-tests-so-long-menu-item-replace-action ()
262 "Test using the `so-long-menu-item-replace-action' menu item." 262 "Test using the `so-long-menu' action commands."
263 (with-temp-buffer 263 (with-temp-buffer
264 ;; Due to (with-selected-window (so-long-menu-click-window) ...)
265 ;; (used by `so-long-menu-item-replace-action'), our temp buffer
266 ;; must be in the selected window.
267 (set-window-buffer nil (current-buffer))
268 (insert "#!emacs\n") 264 (insert "#!emacs\n")
269 (normal-mode) 265 (normal-mode)
270 (so-long-tests-remember) 266 (so-long-tests-remember)
271 (insert (make-string (1+ so-long-threshold) ?x)) 267 (insert (make-string (1+ so-long-threshold) ?x))
272 (let (action) 268 (let ((menu (so-long-menu))
269 action
270 command)
273 (dolist (item so-long-action-alist) 271 (dolist (item so-long-action-alist)
274 ;; n.b. Any existing action is first reverted. 272 (setq action (car item)
275 (so-long-menu-item-replace-action item) 273 command (lookup-key menu (vector action)))
276 (setq action (car item)) 274 (funcall command)
277 (so-long-tests-assert-active action)) 275 (so-long-tests-assert-active action))
278 ;; After all actions have been used, revert to normal and assert 276 ;; After all actions have been used, revert to normal and assert
279 ;; that the most recent action to have been applied is the one 277 ;; that the most recent action to have been applied is the one
280 ;; we have just reverted. 278 ;; we have just reverted.
281 (so-long-menu-item-revert) 279 (funcall (lookup-key menu [so-long-revert]))
282 (so-long-tests-assert-reverted action)))) 280 (so-long-tests-assert-reverted action))))
283 281
284(ert-deftest so-long-tests-major-mode () 282(ert-deftest so-long-tests-major-mode ()