From 6adc193ad66445acd84caba6973424ecbd21da26 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Sat, 21 Jan 2023 12:24:55 +0100 Subject: Move c-like common utils into own library (bug#60961) * lisp/progmodes/c-ts-common.el: New file. * lisp/progmodes/c-ts-mode.el (treesit-induce-sparse-tree): Remove unused declaration. (c-ts-mode--indent-styles): Refer to the new library. (c-ts-mode--looking-at-star, c-ts-mode--comment-start-after-first-star, c-ts-mode--comment-2nd-line-matcher, c-ts-mode--comment-2nd-line-anchor, c-ts-mode--comment-regexp, c-ts-mode--fill-paragraph, c-ts-mode--fill-block-comment): Move to c-ts-common and expose as public. (c-ts-mode-comment-setup): Move to c-ts-common. * lisp/progmodes/csharp-mode.el (c-ts-common): Require new library. (csharp-ts-mode--indent-rules): Refer to the new symbols. (csharp-ts-mode): Use new function. * lisp/progmodes/java-ts-mode.el (c-ts-common): Require new library. (java-ts-mode--indent-rules): Refer to the new symbols. (java-ts-mode): Use new function. * lisp/progmodes/js.el (c-ts-common): Require new library. (js--treesit-indent-rules): Refer to the new symbols. (js-ts-mode): Use new function. * lisp/progmodes/rust-ts-mode.el (c-ts-common): Require new library. (rust-ts-mode--indent-rules): Refer to the new symbols. (rust-ts-mode): Use new function. * lisp/progmodes/typescript-ts-mode.el (c-ts-common): Require new library. (typescript-ts-mode--indent-rules): Refer to the new symbols. (typescript-ts-base-mode): Use new function. --- lisp/progmodes/js.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lisp/progmodes/js.el') diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 176024863f1..b5c912b8b0d 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -54,7 +54,7 @@ (require 'json) (require 'prog-mode) (require 'treesit) -(require 'c-ts-mode) ; For comment indent and filling. +(require 'c-ts-common) ; For comment indent and filling. (eval-when-compile (require 'cl-lib) @@ -3428,8 +3428,8 @@ This function is intended for use in `after-change-functions'." ((node-is ")") parent-bol 0) ((node-is "]") parent-bol 0) ((node-is ">") parent-bol 0) - ((and (parent-is "comment") c-ts-mode--looking-at-star) - c-ts-mode--comment-start-after-first-star -1) + ((and (parent-is "comment") c-ts-common-looking-at-star) + c-ts-common-comment-start-after-first-star -1) ((parent-is "comment") prev-adaptive-prefix 0) ((parent-is "ternary_expression") parent-bol js-indent-level) ((parent-is "member_expression") parent-bol js-indent-level) @@ -3806,7 +3806,7 @@ Currently there are `js-mode' and `js-ts-mode'." ;; Which-func. (setq-local which-func-imenu-joiner-function #'js--which-func-joiner) ;; Comment. - (c-ts-mode-comment-setup) + (c-ts-common-comment-setup) (setq-local comment-multi-line t) ;; Electric-indent. (setq-local electric-indent-chars -- cgit v1.2.3