From 5fdeb3c881962c3fffb1806cf4352f342d8bcf6b Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Thu, 2 Apr 2026 23:30:08 -0700 Subject: [PATCH] Filter out some range settings in markdown-ts-mode * lisp/textmodes/markdown-ts-mode.el: (markdown-ts--add-config-for-mode): Filter out functional queries. --- lisp/textmodes/markdown-ts-mode.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/textmodes/markdown-ts-mode.el b/lisp/textmodes/markdown-ts-mode.el index cc3eaf03e15..657d6bc466d 100644 --- a/lisp/textmodes/markdown-ts-mode.el +++ b/lisp/textmodes/markdown-ts-mode.el @@ -40,6 +40,7 @@ (require 'treesit) (require 'subr-x) (require 'outline) +(require 'seq) (treesit-declare-unavailable-functions) @@ -296,7 +297,12 @@ the same features enabled in MODE." (plist-get configs :simple-indent))) (setq treesit-range-settings (append treesit-range-settings - (plist-get configs :range))) + ;; Filter out function queries, because they are + ;; usually some hack and might escape the code block. + ;; Case in point: c-ts-mode's range setting. + (seq-filter (lambda (setting) + (not (functionp (car setting)))) + (plist-get configs :range)))) (setq-local indent-line-function #'treesit-indent) (setq-local indent-region-function #'treesit-indent-region)))