[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/treesit-fold 75e72c658a 332/417: feat: Add Org support
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/treesit-fold 75e72c658a 332/417: feat: Add Org support |
Date: |
Mon, 1 Jul 2024 10:03:00 -0400 (EDT) |
branch: elpa/treesit-fold
commit 75e72c658ad8d8aac3af554a6b51b3c5c22dd0aa
Author: JenChieh <jcs090218@gmail.com>
Commit: Jen-Chieh Shen <jcs090218@gmail.com>
feat: Add Org support
---
CHANGELOG.md | 1 +
README.md | 2 +-
ts-fold-parsers.el | 12 +++++++++++-
ts-fold.el | 11 +++++++++++
4 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b378811a23..0b91e7e5d4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for
recommendations on how
* perf: Render indicators in display range (#97)
* fix: Don't render indicators on non-foldable node
(342eb5ee1f242ac03bc7e7bbe8d67be8711423ae)
* Add `Groovy` and `Jenkinsfile` support (#98)
+* Add `Org` support (#100)
## 0.2.0
> Released Sep 01, 2023
diff --git a/README.md b/README.md
index 9fce1ab4ef..df42b881dd 100644
--- a/README.md
+++ b/README.md
@@ -125,7 +125,7 @@ These languages are fairly complete:
- LaTex / Lisp / Lua
- Make / Markdown
- Nix / Noir
-- OCaml
+- OCaml / Org
- Perl / PHP / Python
- R / Ruby / Rust / reStructuredText
- Scala / Scheme / SQL / Swift
diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index 898d0b8d4e..51fbeaf676 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -66,7 +66,11 @@
(declare-function ts-fold-range-lua-do-loop "ts-fold.el")
(declare-function ts-fold-range-lua-repeat "ts-fold.el")
(declare-function ts-fold-range-make-recipe "ts-fold.el")
-(declare-function ts-fold-range-ocaml "ts-fold.el")
+(declare-function ts-fold-range-ocaml-comment "ts-fold.el")
+(declare-function ts-fold-range-ocaml-module-definition "ts-fold.el")
+(declare-function ts-fold-range-ocaml-type-definition "ts-fold.el")
+(declare-function ts-fold-range-ocaml-value-definition "ts-fold.el")
+(declare-function ts-fold-range-org-body "ts-fold.el")
(declare-function ts-fold-range-clojure-function "ts-fold.el")
(declare-function ts-fold-range-pascal-comment "ts-fold.el")
(declare-function ts-fold-range-python-def "ts-fold.el")
@@ -396,6 +400,12 @@
(type_definition . ts-fold-range-ocaml-type-definition)
(value_definition . ts-fold-range-ocaml-value-definition)))
+(defun ts-fold-parsers-org ()
+ "Rule set for Org."
+ '((body . ts-fold-range-org-body)
+ (block . ts-fold-range-seq)
+ (comment . ts-fold-range-seq)))
+
(defun ts-fold-parsers-pascal ()
"Rule set for Pascal."
'((comment . ts-fold-range-pascal-comment)))
diff --git a/ts-fold.el b/ts-fold.el
index 411a86aef7..a3aea6c091 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -111,6 +111,7 @@
(noir-mode . ,(ts-fold-parsers-noir))
(nix-mode . ,(ts-fold-parsers-nix))
(ocaml-mode . ,(ts-fold-parsers-ocaml))
+ (org-mode . ,(ts-fold-parsers-org))
(pascal-mode . ,(ts-fold-parsers-pascal))
(perl-mode . ,(ts-fold-parsers-perl))
(php-mode . ,(ts-fold-parsers-php))
@@ -961,6 +962,16 @@ more information."
;;- OCaml
+(defun ts-fold-range-org-body (node offset)
+ "Define fold range for `body' in Org.
+
+For arguments NODE and OFFSET, see function `ts-fold-range-seq' for
+more information."
+ (when-let*
+ ((parent (tsc-get-parent node))
+ (parent (tsc-get-parent parent)))
+ (ts-fold--cons-add (cons -1 0) (ts-fold-range-seq node offset))))
+
(defun ts-fold-range-pascal-comment (node offset)
"Define fold range for `comment' in Pascal.
- [nongnu] elpa/treesit-fold 630b896b3f 277/417: feat: Add Haskell support (#65), (continued)
- [nongnu] elpa/treesit-fold 630b896b3f 277/417: feat: Add Haskell support (#65), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 08abd98ba4 272/417: feat: Add Dart support (#62), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold d20c3663f9 380/417: Update desc, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 2bb351bcf3 385/417: feat: Add on fold hook, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c14893d4ff 343/417: perf: Use built-in function for indentation, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 858fb6fe1c 325/417: Update CHANGELOG.md, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 581af904c1 286/417: feat: Add GDScript support (#72), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 07da6590aa 348/417: feat: Add LLVM MIR support, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 03644fb5fa 341/417: fix(indicators): Rely on range itself, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 6ec049b140 310/417: feat: Add Make support (#90), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 75e72c658a 332/417: feat: Add Org support,
ELPA Syncer <=
- [nongnu] elpa/treesit-fold 9b25eeeb0b 404/417: chore: Update mouse face docstring, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 6b759ca36e 402/417: Update README.org (#4), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a9d4c2ec53 296/417: feat: Add XML support (#80), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 5c45efb2d5 316/417: Update CHANGELOG.md, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold abb1c53bd4 336/417: Bump version for next release, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 544390c602 329/417: fix: Fold line comment with same indentation, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 7fdaf447cc 245/417: Change global mode to turn on with tree-sitter (#41), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 07fe2d17f4 249/417: feature: Add minor-mode for line comment (#45), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 458903e88d 250/417: fix: Fix nil tree-sitter-node, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 6ada31e372 251/417: changelog, ELPA Syncer, 2024/07/01