mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-18 09:55:42 +00:00
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'.
This commit is contained in:
parent
3c50edb2b5
commit
ec8dd27f00
3 changed files with 44 additions and 1 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue