emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/markdown-mode 44ac8e4f96 1/2: Add tree-sitter-based modes


From: ELPA Syncer
Subject: [nongnu] elpa/markdown-mode 44ac8e4f96 1/2: Add tree-sitter-based modes to markdown-get-lang-mode
Date: Sun, 1 Jan 2023 19:59:12 -0500 (EST)

branch: elpa/markdown-mode
commit 44ac8e4f96f03149f60cb182f8b3f1503f66f6d0
Author: Brian Leung <leungbk@posteo.net>
Commit: Brian Leung <leungbk@posteo.net>

    Add tree-sitter-based modes to markdown-get-lang-mode
---
 CHANGES.md       |  1 +
 markdown-mode.el | 14 ++++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index bb209e9d70..d202c83910 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -15,6 +15,7 @@
       `t` and `markdown-command` is a function.
     - Support newer version Eldoc ships with Emacs 28.
     - Don't spell-check against pandoc references. [GH-572][]
+    - Support tree-sitter-based major modes used by Emacs 29.
 
 *   Bug fixes:
     - Don't override table faces by link faces [GH-716][]
diff --git a/markdown-mode.el b/markdown-mode.el
index ed8f962d8e..26581014ab 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -8754,10 +8754,16 @@ mode to use is `tuareg-mode'."
 LANG is a string, and the returned major mode is a symbol."
   (cl-find-if
    'fboundp
-   (list (cdr (assoc lang markdown-code-lang-modes))
-         (cdr (assoc (downcase lang) markdown-code-lang-modes))
-         (intern (concat lang "-mode"))
-         (intern (concat (downcase lang) "-mode")))))
+   (nconc (list (cdr (assoc lang markdown-code-lang-modes))
+                (cdr (assoc (downcase lang) markdown-code-lang-modes)))
+          (and (fboundp 'treesit-language-available-p)
+               (list (and (treesit-language-available-p (intern lang))
+                          (intern (concat lang "-ts-mode")))
+                     (and (treesit-language-available-p (intern (downcase 
lang)))
+                          (intern (concat (downcase lang) "-ts-mode")))))
+          (list
+           (intern (concat lang "-mode"))
+           (intern (concat (downcase lang) "-mode"))))))
 
 (defun markdown-fontify-code-blocks-generic (matcher last)
   "Add text properties to next code block from point to LAST.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]