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

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

[nongnu] elpa/treesit-fold fbb5510d5c 290/417: feat: Add LaTex support (


From: ELPA Syncer
Subject: [nongnu] elpa/treesit-fold fbb5510d5c 290/417: feat: Add LaTex support (#76)
Date: Mon, 1 Jul 2024 10:02:36 -0400 (EDT)

branch: elpa/treesit-fold
commit fbb5510d5c46b9463c5f3844f2d35cab619a8115
Author: Jen-Chieh Shen <jcs090218@gmail.com>
Commit: GitHub <noreply@github.com>

    feat: Add LaTex support (#76)
---
 CHANGELOG.md       | 1 +
 README.md          | 7 +------
 ts-fold-parsers.el | 7 +++++++
 ts-fold-summary.el | 6 ++++++
 ts-fold.el         | 1 +
 5 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5177103cc6..510c5f11e1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -34,6 +34,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for 
recommendations on how
 * Add Scheme support (#73)
 * Add Beancount support (#74)
 * Add Verilog support (#75)
+* Add LaTex support (#76)
 
 ## 0.1.0
 > Released Oct 18, 2021
diff --git a/README.md b/README.md
index 276af85532..07ed19f153 100644
--- a/README.md
+++ b/README.md
@@ -19,11 +19,6 @@ to provide code folding based on the tree-sitter syntax tree.
 
 <!-- markdown-toc start - Don't edit this section. Run M-x 
markdown-toc-refresh-toc -->
 
-<!---
-your comment goes here
-and here
--->
-
 **Table of Contents**
 
 - [💾 Installation](#-installation)
@@ -125,7 +120,7 @@ These languages are fairly complete:
 - Haskell / HTML
 - Jai / Java / JavaScript / JSX / JSON / Julia
 - Kotlin
-- Lua
+- LaTex / Lua
 - Markdown
 - Nix
 - Perl / PHP / Python
diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index 1ffe47acd7..a2c0c78a91 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -258,6 +258,13 @@
     (multiline_comment      . ts-fold-range-c-like-comment)
     (line_comment           . ts-fold-range-c-like-comment)))
 
+(defun ts-fold-parsers-latex ()
+  "Rule set for LaTex."
+  '((curly_group . ts-fold-range-seq)
+    (line_comment
+     . (lambda (node offset)
+         (ts-fold-range-line-comment node offset "%")))))
+
 (defun ts-fold-parsers-lua ()
   "Rule set for Lua."
   '((expression_list      . ts-fold-range-seq)
diff --git a/ts-fold-summary.el b/ts-fold-summary.el
index 0f3d47768d..caa6f70614 100644
--- a/ts-fold-summary.el
+++ b/ts-fold-summary.el
@@ -140,6 +140,10 @@ type of content by checking the word boundary's existence."
   "Extract summary from DOC-STR in Rust."
   (ts-fold-summary--generic doc-str "///"))
 
+(defun ts-fold-summary-tex-doc (doc-str)
+  "Extract summary from DOC-STR in Tex family."
+  (ts-fold-summary--generic doc-str "%"))
+
 (defun ts-fold-summary-c-macro (doc-str)
   "Parse C macro summary from DOC-STR."
   (when (ts-fold--is-face doc-str
@@ -213,6 +217,7 @@ type of content by checking the word boundary's existence."
     (css-mode          . ts-fold-summary-javadoc)
     (dart-mode         . ts-fold-summary-javadoc)
     (emacs-lisp-mode   . ts-fold-summary-elisp)
+    (elixir-mode       . ts-fold-summary-ruby-doc)
     (gdscript-mode     . ts-fold-summary-ruby-doc)
     (go-mode           . ts-fold-summary-go)
     (haskell-mode      . ts-fold-summary-lua-doc)
@@ -225,6 +230,7 @@ type of content by checking the word boundary's existence."
     (js3-mode          . ts-fold-summary-javadoc)
     (julia-mode        . ts-fold-summary-julia-doc)
     (kotlin-mode       . ts-fold-summary-javadoc)
+    (latex-mode        . ts-fold-summary-tex-doc)
     (lua-mode          . ts-fold-summary-lua-doc)
     (markdown-mode     . ts-fold-summary-markdown)
     (objc-mode         . ts-fold-summary-c)
diff --git a/ts-fold.el b/ts-fold.el
index dea42f5f17..ed93a90e8e 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -85,6 +85,7 @@
     (jsonc-mode      . ,(ts-fold-parsers-json))
     (julia-mode      . ,(ts-fold-parsers-julia))
     (kotlin-mode     . ,(ts-fold-parsers-kotlin))
+    (latex-mode      . ,(ts-fold-parsers-latex))
     (lua-mode        . ,(ts-fold-parsers-lua))
     (markdown-mode   . ,(ts-fold-parsers-markdown))
     (nix-mode        . ,(ts-fold-parsers-nix))



reply via email to

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