diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2024-04-01 17:58:04 +0800 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2024-04-01 17:58:04 +0800 |
commit | 3af419ed0f0bf23320f8a7ac3479e2c50c353cde (patch) | |
tree | fa45f6aee9812f8684ca888823c89cdcc89e6ddb /lisp/progmodes/ruby-ts-mode.el | |
parent | 101801ca13632ae17b486f690701b9cb36868676 (diff) | |
parent | 87be53846bfbf5a6387cb5a40105bd0fc5b48b38 (diff) | |
download | emacs-3af419ed0f0bf23320f8a7ac3479e2c50c353cde.tar.gz |
Merge upstream Git snapshot into athena/unstable
Diffstat (limited to 'lisp/progmodes/ruby-ts-mode.el')
-rw-r--r-- | lisp/progmodes/ruby-ts-mode.el | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 598eaa461ff..7133cb0b5b0 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1133,6 +1133,7 @@ leading double colon is not added." "singleton_class" "module" "method" + "singleton_method" "array" "hash" "parenthesized_statements" @@ -1178,6 +1179,19 @@ leading double colon is not added." ;; Imenu. (setq-local imenu-create-index-function #'ruby-ts--imenu) + ;; Outline minor mode. + (setq-local treesit-outline-predicate + (rx bos (or "singleton_method" + "method" + "alias" + "class" + "module") + eos)) + ;; Restore default values of outline variables + ;; to use `treesit-outline-predicate'. + (kill-local-variable 'outline-regexp) + (kill-local-variable 'outline-level) + (setq-local treesit-simple-indent-rules (ruby-ts--indent-rules)) ;; Font-lock. @@ -1196,19 +1210,11 @@ leading double colon is not added." (setq-local syntax-propertize-function #'ruby-ts--syntax-propertize)) +(derived-mode-add-parents 'ruby-ts-mode '(ruby-mode)) + (if (treesit-ready-p 'ruby) - ;; Copied from ruby-mode.el. - (add-to-list 'auto-mode-alist - (cons (concat "\\(?:\\.\\(?:" - "rbw?\\|ru\\|rake\\|thor" - "\\|jbuilder\\|rabl\\|gemspec\\|podspec" - "\\)" - "\\|/" - "\\(?:Gem\\|Rake\\|Cap\\|Thor" - "\\|Puppet\\|Berks\\|Brew" - "\\|Vagrant\\|Guard\\|Pod\\)file" - "\\)\\'") - 'ruby-ts-mode))) + (add-to-list 'major-mode-remap-defaults + '(ruby-mode . ruby-ts-mode))) (provide 'ruby-ts-mode) |