* lisp/help.el (describe-bindings): Use the outline-default-rules feature.
authorJuri Linkov <juri@linkov.net>
Wed, 23 Nov 2022 18:33:18 +0000 (20:33 +0200)
committerJuri Linkov <juri@linkov.net>
Wed, 23 Nov 2022 18:34:27 +0000 (20:34 +0200)
Set buffer-local outline-default-state to 1, and outline-default-rules
to match "Key translations", instead of searching and hiding this section
explicitly.

lisp/help.el

index f956111a52f5ea492d12ff68aa69290eb06ae6bf..8e1b325141e64e4b537357d7e3e166b39224ab85 100644 (file)
@@ -747,14 +747,15 @@ or a buffer name."
           (setq-local outline-level (lambda () 1))
           (setq-local outline-minor-mode-cycle t
                       outline-minor-mode-highlight t
-                      outline-minor-mode-use-buttons 'insert)
+                      outline-minor-mode-use-buttons 'insert
+                      ;; Hide the longest body.
+                      outline-default-state 1
+                      outline-default-rules
+                      '((match-regexp . "Key translations")))
           (outline-minor-mode 1)
           (save-excursion
             (goto-char (point-min))
             (let ((inhibit-read-only t))
-              ;; Hide the longest body.
-              (when (re-search-forward "Key translations" nil t)
-               (outline-hide-subtree))
               ;; Hide ^Ls.
               (while (search-forward "\n\f\n" nil t)
                (put-text-property (1+ (match-beginning 0)) (1- (match-end 0))