summaryrefslogtreecommitdiff
path: root/lisp/progmodes/sh-script.el
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-12-15 17:44:07 -0800
committerYuan Fu <casouri@gmail.com>2022-12-15 17:44:07 -0800
commitcb761eb7ac4197706658a68bb853c3fc8909d84e (patch)
tree57e99afdf7c1c19d41b7e890a582144ce262901e /lisp/progmodes/sh-script.el
parent037407ad95a55df900bd508ca3c44499735d7c2a (diff)
downloademacs-cb761eb7ac4197706658a68bb853c3fc8909d84e.tar.gz
emacs-cb761eb7ac4197706658a68bb853c3fc8909d84e.tar.bz2
emacs-cb761eb7ac4197706658a68bb853c3fc8909d84e.zip
Use the new tree-sitter commands
* lisp/progmodes/c-ts-mode.el (c-ts-mode--defun-valid-p) (c-ts-mode--defun-skipper): New functions. (c-ts-base-mode): Setup defun navigation. * lisp/progmodes/sh-script.el (bash-ts-mode): Setup defun navigation. * lisp/treesit.el (treesit-beginning-of-defun) (treesit-end-of-defun): Change to new implementation, which is intended to be used as commands. (treesit-major-mode-setup): Setup remap for beginning/end-of-defun commands.
Diffstat (limited to 'lisp/progmodes/sh-script.el')
-rw-r--r--lisp/progmodes/sh-script.el2
1 files changed, 2 insertions, 0 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 76e8d5b0748..85da9e89f9a 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1613,6 +1613,7 @@ This mode automatically falls back to `sh-mode' if the buffer is
not written in Bash or sh."
:syntax-table sh-mode-syntax-table
(when (treesit-ready-p 'bash)
+ (treesit-parser-create 'bash)
(setq-local treesit-font-lock-feature-list
'(( comment function)
( command declaration-command keyword string)
@@ -1620,6 +1621,7 @@ not written in Bash or sh."
( bracket delimiter misc-punctuation operator)))
(setq-local treesit-font-lock-settings
sh-mode--treesit-settings)
+ (setq-local treesit-defun-type-regexp "function_definition")
(treesit-major-mode-setup)))
(advice-add 'bash-ts-mode :around #'sh--redirect-bash-ts-mode