emacs-devel
[Top][All Lists]
Advanced

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

Re: master 2ef6f943abd: Add option to control default outlining in 'C-h


From: Robert Pluim
Subject: Re: master 2ef6f943abd: Add option to control default outlining in 'C-h b'
Date: Tue, 25 Apr 2023 12:11:57 +0200

>>>>> On Tue, 25 Apr 2023 12:09:58 +0300, Eli Zaretskii <eliz@gnu.org> said:

    >> This code and the defcustom is new in emacs-29, so we can still change
    >> it to be a predicate instead. At least we should document is better

    Eli> Agreed.  Patches welcome.

I assumed you were agreeing to the code change, which looks like this:

diff --git a/lisp/outline.el b/lisp/outline.el
index 0e90c59c285..266b3a168f6 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -1517,10 +1517,11 @@ outline-default-rules
 
 When nil, the subtree is hidden unconditionally.
 
-When equal to a list, each element should be one of the following:
+When equal to a list, each element should be one of the
+following, which are checked in order:
 
 - A cons cell with CAR `match-regexp' and CDR a regexp, the
-  subtree will be hidden when the outline heading match the
+  subtree will be hidden when the outline heading matches the
   regexp.
 
 - `subtree-has-long-lines' to only show the heading branches when
@@ -1532,9 +1533,9 @@ outline-default-rules
 
 - A cons cell of the form (custom-function . FUNCTION) where
   FUNCTION is a lambda function or function name which will be
-  called without arguments with point at the beginning of the
-  heading and the match data set appropriately, the function
-  being expected to toggle the heading visibility."
+  called without arguments, with point at the beginning of the
+  heading, and the match data set appropriately.  If the function
+  returns nil the subtree will be shown, otherwise it is hidden."
   :version "29.1"
   :type '(choice (const :tag "Hide subtree" nil)
                  (set :tag "Show subtree unless"
@@ -1649,9 +1650,10 @@ outline--show-headings-up-to-level
                  ;; show only branches when long lines are detected
                  ;; in subtree
                  (outline-show-branches))
-                (custom-function
-                 ;; call custom function if defined
-                 (funcall custom-function))
+                ;; call custom function if defined
+                ((and custom-function
+                      (funcall custom-function))
+                 (outline-hide-entry))
                 (t
                  ;; if no previous clause succeeds, show subtree
                  (outline-show-subtree))))))

Robert
-- 



reply via email to

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