; Small fixes for the recently added 'mhtml-ts-mode'
* lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode): Add autoload cookie. * lisp/treesit.el (treesit-modify-indent-rules): Use 'rules' instead of 'js--treesit-indent-rules'.
This commit is contained in:
parent
c380a72679
commit
1a8493f0a5
3 changed files with 5 additions and 8 deletions
4
etc/NEWS
4
etc/NEWS
|
@ -1392,14 +1392,11 @@ language symbol. For example, 'cpp' is translated to "C++". A new
|
|||
variable 'treesit-language-display-name-alist' holds the translations of
|
||||
language symbols where that translation is not trivial.
|
||||
|
||||
+++
|
||||
++++
|
||||
*** New function 'treesit-merge-font-lock-feature-list'.
|
||||
This function merges two tree-sitter font-lock feature lists. Returns a
|
||||
new font-lock feature list with no duplicates in the same level. It can
|
||||
be used to merge font-lock feature lists in a multi-language major mode.
|
||||
|
||||
+++
|
||||
*** New function 'treesit-replace-font-lock-feature-settings'.
|
||||
Given two tree-sitter font-lock settings, it replaces the feature in the
|
||||
second font-lock settings with the same feature in the first font-lock
|
||||
|
@ -1407,7 +1404,6 @@ settings. In a multi-language major mode it is sometimes necessary to
|
|||
replace features from one of the major modes, with others that are
|
||||
better suited to the new multilingual context.
|
||||
|
||||
+++
|
||||
*** New function 'treesit-modify-indent-rules'.
|
||||
Given two tree-sitter indent rules, it replaces, adds, or prepends the
|
||||
new rules to the old ones, then returns the new tree-sitter indent
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; mhtml-ts-mode.el --- Major mode for HTML using tree-sitter -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2024-2025 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Vincenzo Pupillo <v.pupillo@gmail.com>
|
||||
;; Maintainer: Vincenzo Pupillo <v.pupillo@gmail.com>
|
||||
|
@ -248,7 +248,7 @@ For NODE, OVERRIDE, START, and END, see `treesit-font-lock-rules'."
|
|||
'font-lock-variable-name-face
|
||||
override start end)))
|
||||
|
||||
;; Embedded languages should be indented according to the language
|
||||
;; Embedded languages should be indented according to the language
|
||||
;; that embeds them.
|
||||
;; This function signature complies with `treesit-simple-indent-rules'
|
||||
;; ANCHOR.
|
||||
|
@ -440,6 +440,7 @@ Calls REPORT-FN directly. Requires tidy."
|
|||
(process-send-region mhtml-ts-mode--flymake-process (point-min) (point-max))
|
||||
(process-send-eof mhtml-ts-mode--flymake-process)))))
|
||||
|
||||
;;;###autoload
|
||||
(define-derived-mode mhtml-ts-mode html-ts-mode
|
||||
'("HTML+" (:eval (let ((lang (mhtml-ts-mode--language-at-point (point))))
|
||||
(cond ((eq lang 'html) "")
|
||||
|
|
|
@ -1322,7 +1322,7 @@ and leave settings for other languages unchanged."
|
|||
Returns a new font lock feature list with no duplicates in the same level.
|
||||
It can be used to merge font lock feature lists in a multi-language major mode.
|
||||
FEATURES-LIST-1 and FEATURES-LIST-2 are list of lists of feature symbols."
|
||||
(let ((result nil)
|
||||
(let ((result nil)
|
||||
(features-1 (car features-list-1))
|
||||
(features-2 (car features-list-2)))
|
||||
(while (or features-1 features-2)
|
||||
|
@ -2551,7 +2551,7 @@ NEW-RULES replace rule in RULES which the same anchor."
|
|||
(error "No rules for language %s in RULES" lang))
|
||||
((not (alist-get lang new-rules))
|
||||
(error "No rules for language %s in NEW-RULES" lang))
|
||||
(t (let* ((copy-of-rules (copy-tree js--treesit-indent-rules))
|
||||
(t (let* ((copy-of-rules (copy-tree rules))
|
||||
(lang-rules (alist-get lang copy-of-rules))
|
||||
(lang-new-rules (alist-get lang new-rules)))
|
||||
(cond
|
||||
|
|
Loading…
Add table
Reference in a new issue