]> git.eshelyaron.com Git - emacs.git/commitdiff
Revert "Silence warning when requiring ruby-ts-mode"
authorStefan Kangas <stefankangas@gmail.com>
Sat, 30 Dec 2023 00:06:41 +0000 (01:06 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 2 Jan 2024 07:32:07 +0000 (08:32 +0100)
This reverts commit bf81706988f6b1b9d6e8033c8227f0129e04ef03.

We deliberately don't silence these warnings, so that a user who loads
the mode without having the grammar installed sees the warning and
realizes the problem in time to fix it.

(cherry picked from commit fe2b68d405251498518b279a17a87f4cbcf82479)

lisp/progmodes/ruby-ts-mode.el

index 78a911d21894cc2fc7dc7d7117c66b4db109ed30..4cfe7e45d5e480e4891f071ce92a858b7a8bce01 100644 (file)
@@ -1196,6 +1196,15 @@ leading double colon is not added."
 
   (setq-local syntax-propertize-function #'ruby-ts--syntax-propertize))
 
+(defun ruby-ts--parser-after-change (ranges parser)
+  ;; Make sure we re-syntax-propertize the full node that is being
+  ;; edited.  This is most pertinent to multi-line complex nodes such
+  ;; as heredocs.
+  (when ranges
+    (with-current-buffer (treesit-parser-buffer parser)
+      (syntax-ppss-flush-cache (cl-loop for r in ranges
+                                        minimize (car r))))))
+
 (if (treesit-ready-p 'ruby)
     ;; Copied from ruby-mode.el.
     (add-to-list 'auto-mode-alist