Convert outline-search-function to defcustom

Make 'outline-search-function' a user option with named choices for
its predefined values, so users can configure it via Customize.
Preserves existing docstring and runtime semantics (bug#81053).

* lisp/outline.el (outline-search-function): Convert to defcustom.
* etc/NEWS: Announce it.
This commit is contained in:
Paul H. McClelland 2026-05-15 19:02:43 -04:00 committed by Juri Linkov
parent 194c28aaf2
commit 78a10d17c6
2 changed files with 20 additions and 3 deletions

View file

@ -126,6 +126,13 @@ Install it with:
(setq-local outline-search-function #'outline-search-from-regexp) (setq-local outline-search-function #'outline-search-from-regexp)
---
*** 'outline-search-function' is now a user option.
Previously a plain variable, it is now a 'defcustom'
with named choices for the predefined search functions
('outline-search-from-regexp' and 'outline-search-level')
as well as the default nil and arbitrary user functions.
* New Modes and Packages in Emacs 32.1 * New Modes and Packages in Emacs 32.1

View file

@ -61,8 +61,10 @@ The recommended way to set this is with a `Local Variables:' list
in the file it applies to.") in the file it applies to.")
;;;###autoload(put 'outline-heading-end-regexp 'safe-local-variable 'stringp) ;;;###autoload(put 'outline-heading-end-regexp 'safe-local-variable 'stringp)
(defvar outline-search-function nil (defcustom outline-search-function nil
"Function to search the next outline heading. "If non-nil, the function to search the next outline heading.
When nil, headings are found by searching for `outline-regexp'.
The function is called with four optional arguments: BOUND, MOVE, BACKWARD, The function is called with four optional arguments: BOUND, MOVE, BACKWARD,
LOOKING-AT. The first two arguments BOUND and MOVE are almost the same as LOOKING-AT. The first two arguments BOUND and MOVE are almost the same as
the BOUND and NOERROR arguments of `re-search-forward', with the difference the BOUND and NOERROR arguments of `re-search-forward', with the difference
@ -71,7 +73,15 @@ BACKWARD is non-nil, the search should search backward like
`re-search-backward' does. In case of a successful search, the `re-search-backward' does. In case of a successful search, the
function should return non-nil, move point, and set match-data function should return non-nil, move point, and set match-data
appropriately. When the argument LOOKING-AT is non-nil, it should appropriately. When the argument LOOKING-AT is non-nil, it should
imitate the function `looking-at'.") imitate the function `looking-at'."
:type '(choice (const :tag "Use `outline-regexp'" nil)
(function-item :tag "Search by `outline-regexp' (regexp-based)"
outline-search-from-regexp)
(function-item :tag "Search by `outline-level' text property"
outline-search-level)
(function :tag "Other function"))
:group 'outlines
:version "32.1")
(defvar-keymap outline-mode-prefix-map (defvar-keymap outline-mode-prefix-map
"@" #'outline-mark-subtree "@" #'outline-mark-subtree