diff options
author | Juri Linkov <juri@linkov.net> | 2024-12-29 19:57:28 +0200 |
---|---|---|
committer | Juri Linkov <juri@linkov.net> | 2024-12-29 19:57:28 +0200 |
commit | ec8dd27f008bca810209354a189d241479fe4d32 (patch) | |
tree | b6ecead64dfbfa113edf2a62a0a857529619d91a /lisp/emacs-lisp | |
parent | 3c50edb2b500c6ac18696e99c3f8df597dea54d4 (diff) | |
download | emacs-ec8dd27f008bca810209354a189d241479fe4d32.tar.gz emacs-ec8dd27f008bca810209354a189d241479fe4d32.tar.bz2 emacs-ec8dd27f008bca810209354a189d241479fe4d32.zip |
Add new variable 'up-list-function' for 'treesit-up-list'
* lisp/emacs-lisp/lisp.el (up-list-function): New variable (bug#73404).
(up-list-default-function): New function.
(up-list): Split part to 'up-list-default-function'.
* lisp/treesit.el (treesit-up-list): New function.
(treesit-major-mode-setup): Set 'up-list-function' to
'treesit-up-list'.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/lisp.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 2f0561096a5..2d2a283da33 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -239,6 +239,10 @@ On error, location of point is unspecified." (interactive "^p\nd\nd") (up-list (- (or arg 1)) escape-strings no-syntax-crossing)) +(defvar up-list-function nil + "If non-nil, `up-list' delegates to this function. +Should take the same arguments and behave similarly to `up-list'.") + (defun up-list (&optional arg escape-strings no-syntax-crossing) "Move forward out of one level of parentheses. This command will also work on other parentheses-like expressions @@ -255,6 +259,12 @@ end of a list broken across multiple strings. On error, location of point is unspecified." (interactive "^p\nd\nd") + (if up-list-function + (funcall up-list-function arg escape-strings no-syntax-crossing) + (up-list-default-function arg escape-strings no-syntax-crossing))) + +(defun up-list-default-function (&optional arg escape-strings no-syntax-crossing) + "Default function for `up-list-function'." (or arg (setq arg 1)) (let ((inc (if (> arg 0) 1 -1)) (pos nil)) |