From 3be64f0f310337d3042226060edcf1c83aa09621 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Mon, 17 Feb 2025 19:40:20 +0200 Subject: [PATCH] ; 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'. (cherry picked from commit 1a8493f0a5fcd45c7e992dbf42cfbb0346edcaff) --- lisp/textmodes/mhtml-ts-mode.el | 5 +++-- lisp/treesit.el | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/textmodes/mhtml-ts-mode.el b/lisp/textmodes/mhtml-ts-mode.el index 9be1a14c257..bdb016d67dc 100644 --- a/lisp/textmodes/mhtml-ts-mode.el +++ b/lisp/textmodes/mhtml-ts-mode.el @@ -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 ;; Maintainer: Vincenzo Pupillo @@ -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) "") diff --git a/lisp/treesit.el b/lisp/treesit.el index f121b15141a..f6f9a9952b7 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -1318,7 +1318,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) @@ -2543,7 +2543,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 -- 2.39.5