[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/typst-ts-mode 271cedb1de 066/246: feat: add customization
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/typst-ts-mode 271cedb1de 066/246: feat: add customization option to enable raw block highlighting |
Date: |
Fri, 14 Feb 2025 16:54:01 -0500 (EST) |
branch: elpa/typst-ts-mode
commit 271cedb1deec34bd51f5f1bf611d584fa6880b18
Author: Meow King <mr.meowking@anche.no>
Commit: Meow King <mr.meowking@anche.no>
feat: add customization option to enable raw block highlighting
---
typst-ts-mode.el | 47 +++++++++++++++++++++++++++++------------------
1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index a68b6d76d3..f515df8b13 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -33,6 +33,8 @@
;; 3. rememeber git commit --amend instead directly
;; 4. add more predefined configurations
+;; add documentations
+
;; BUGS find:
;;
;; 1. update raw block language will not delete the old local parser
@@ -64,6 +66,11 @@
:type 'integer
:group 'typst-ts)
+(defcustom typst-ts-mode-enable-raw-blocks-highlight t
+ "Whether to enable raw block highlighting."
+ :type 'boolean
+ :group 'typst-ts)
+
(defcustom typst-ts-mode-highlight-raw-blocks-at-startup t
"Whether to highlight raw blocks at *mode startup*.
Note: this may take some time for documents with lot of raw blocks."
@@ -802,9 +809,9 @@ PROC: process; OUTPUT: new output from PROC."
(erase-buffer)
(let ((window (get-buffer-window))
(re (rx bol "error:" (+ not-newline) "\n" (+ blank) "┌─ "
- (+ not-newline) ":" ;; file
- (+ num) ":" ;; start-line
- (+ num) "\n"
+ (+ not-newline) ":" ; file
+ (+ num) ":" ; start-line
+ (+ num) "\n" ; start-col
(+ (+ (or blank num)) "│" (* not-newline) "\n")))
(next-match-start-pos 0)
res-output)
@@ -1015,7 +1022,8 @@ See `treesit-language-at-point-function'."
:syntax-table typst-ts-mode-syntax-table
:after-hook
;; it seems like the following code only works in this place (after-hook)
- (when typst-ts-mode-highlight-raw-blocks-at-startup
+ (when (and typst-ts-mode-enable-raw-blocks-highlight
+ typst-ts-mode-highlight-raw-blocks-at-startup)
;; since currently local parsers haven't created, we cannot only load
;; those necessary parsers
(cl-loop for setting in typst-ts-embedding-lang-settings
@@ -1033,11 +1041,13 @@ See `treesit-language-at-point-function'."
(unless (treesit-ready-p 'typst)
(error "Tree-sitter for Typst isn't available"))
- (let ((parser (treesit-parser-create 'typst)))
- (when typst-ts-mode-highlight-raw-block
- (treesit-parser-add-notifier
- parser
- 'typst-ts-els-include-dynamically)))
+ (if typst-ts-mode-enable-raw-blocks-highlight
+ (let ((parser (treesit-parser-create 'typst)))
+ (when typst-ts-mode-highlight-raw-block
+ (treesit-parser-add-notifier
+ parser
+ 'typst-ts-els-include-dynamically)))
+ (treesit-parser-create 'typst))
;; Comments.
(typst-ts-mode-comment-setup)
@@ -1073,15 +1083,16 @@ See `treesit-language-at-point-function'."
(file-name-nondirectory buffer-file-name)
typst-ts-mode-compile-options))
- (setq-local treesit-language-at-point-function
- 'typst-ts-mode--language-at-point)
- (setq-local treesit-range-settings
- (typst-ts-mode--treesit-range-rules
- (append
- (cl-loop for setting in typst-ts-embedding-lang-settings
- when (treesit-ready-p (car setting) t)
- collect (car setting))
- '(typst))))
+ (when typst-ts-mode-enable-raw-blocks-highlight
+ (setq-local treesit-language-at-point-function
+ 'typst-ts-mode--language-at-point)
+ (setq-local treesit-range-settings
+ (typst-ts-mode--treesit-range-rules
+ (append
+ (cl-loop for setting in typst-ts-embedding-lang-settings
+ when (treesit-ready-p (car setting) t)
+ collect (car setting))
+ '(typst)))))
;; Outline
(setq-local outline-regexp typst-ts-mode-outline-regexp)
- [nongnu] elpa/typst-ts-mode 6a1ff662e1 194/246: fix(editing): typst-ts-mode-return on item newline issue, (continued)
- [nongnu] elpa/typst-ts-mode 6a1ff662e1 194/246: fix(editing): typst-ts-mode-return on item newline issue, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 075b450e44 199/246: chore, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode a6e6940956 202/246: refactor: do not `kill-line` because it will be in kill-ring, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 709e77733e 208/246: fix+chore: indentation rules for item, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 97ccb33aeb 215/246: chore: prefix argument handling for `typst-ts-compile` command, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 2c82246569 216/246: fix: `typst-ts-compile` preview doc by default, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 13b9894a4f 217/246: feat: #16 swapping numbered items works now, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 07cf3bcc89 229/246: Added function `typst-ts-preview`, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode f643036cc2 239/246: fix: having point after last column did not count as item #33, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 7c01c6821c 243/246: Merge pull request 'Add an option to customize the preview function.' (#36) from tkpapp/typst-ts-mode:tp/customize-preview-function into develop, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 271cedb1de 066/246: feat: add customization option to enable raw block highlighting,
ELPA Syncer <=
- [nongnu] elpa/typst-ts-mode fded764913 069/246: fix(els): remove language tag map duplication, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode d6cd6d7283 076/246: feat: Also auto insert numbered list., ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 49a3981040 083/246: fix: Only search for the current line., ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 0454e44977 087/246: feat: Autoincrement on enter and fix heading insertion., ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 078b2efbb9 089/246: fix: disable echoing indentation debug information, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 3d373bba6f 095/246: fix: fix outline recognization error when section indent offset is not nil, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 2d25a0ac3f 097/246: refactor: `typst-ts-mode-insert--item`, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 893430dc14 100/246: merge `develop` branch, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode d8d36ba3e9 110/246: doc: update README.md, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 42c080fa64 122/246: fix(compabiilty): Emacs29 treesit-lparser-list -> typst-ts-utils-parser-list, ELPA Syncer, 2025/02/14