From b456ffc994b58009f1b0dfc34153214f613eb18c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 13 Jan 2026 09:11:24 -0500 Subject: [PATCH] (forward-list-function): Give it a default value * lisp/emacs-lisp/lisp.el (forward-list-function): Give it a default value. (forward-list): Simplify. --- lisp/emacs-lisp/lisp.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 1f1115b2f18..4d4efba76b0 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -147,7 +147,7 @@ This command assumes point is not in a string or comment." "Default function for `forward-list-function'." (goto-char (or (scan-lists (point) arg 0) (buffer-end arg)))) -(defvar forward-list-function nil +(defvar forward-list-function #'forward-list-default-function "If non-nil, `forward-list' delegates to this function. Should take the same arguments and behave similarly to `forward-list'.") @@ -169,9 +169,9 @@ report errors as appropriate for this kind of usage." "No next group" "No previous group")))) (or arg (setq arg 1)) - (if forward-list-function - (funcall forward-list-function arg) - (forward-list-default-function arg)))) + (funcall (or forward-list-function + #'forward-list-default-function) + arg))) (defun backward-list (&optional arg interactive) "Move backward across one balanced group of parentheses.