[nongnu] elpa/typst-ts-mode b390ac14fc 146/246: doc(README): add related packages

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit b390ac14fc3f9c039d44374e0c1f31cfb9e1b920
Author: Meow King 
Commit: Meow King 

doc(README): add related packages
---
 .gitignore | 2 +-
 README.md  | 5 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 7355f2a7f3..9ffda9211c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,7 @@
 *.elc
 /side/*.pdf
 makem.sh
-#*#
+\#*\#
 
 # Added by cargo
 
diff --git a/README.md b/README.md
index 86e151632f..a3cea70aa2 100644
--- a/README.md
+++ b/README.md
@@ -110,6 +110,11 @@ command [consult](https://github.com/minad/consult), you 
way want this setting.
(?f "Functions" font-lock-function-name-face))
 ```
 
+## Related Packages
+
++ [outline-indent-mode](https://sr.ht/~meow_king/outline-indent-mode/) Dynamic 
indentation based on outline
++ [tip](https://git.sr.ht/~mafty/tip) Typst Inline Preview 
+
 ## Contribute
 
 Please work on `develop` branch, which will be combined into `main` branch 
every one week or so if there are new commits.  



[elpa] externals/ellama 6615a857d6 6/6: Merge pull request #217 from s-kostyaev/improve-ctx

2025-02-14 Thread ELPA Syncer
branch: externals/ellama
commit 6615a857d62008759173bc6d709bda87a63019d0
Merge: 2b75043cd6 280b97119a
Author: Sergey Kostyaev 
Commit: GitHub 

Merge pull request #217 from s-kostyaev/improve-ctx

Improve working with context
---
 NEWS.org  | 12 ++--
 ellama.el | 39 +++
 2 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index 3a2a696fa7..459acd14a3 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -1,6 +1,14 @@
+* Version 1.1.3
+- Ensure unique elements in session and global contexts.
+- Change default transient host and port to fix ollama provider setup.
+- Deactivate ellama session on setting ellama-provider.
+- Added functionality to convert Org mode content to Markdown when
+  extracting buffer or file content for the context. This ensures that
+  any Org mode files are properly formatted as Markdown before being
+  processed further.
 * Version 1.1.2
-- Clear session context on calling reset context commant to prevent
-  suprising behaviour.
+- Clear session context when resetting context to prevent unexpected
+  behavior.
 * Version 1.1.1
 - Improve ~ellama-add-selection~.
 - Add buffer quote context element.
diff --git a/ellama.el b/ellama.el
index ae7c8ff0c8..f8d56e8e26 100644
--- a/ellama.el
+++ b/ellama.el
@@ -6,7 +6,7 @@
 ;; URL: http://github.com/s-kostyaev/ellama
 ;; Keywords: help local tools
 ;; Package-Requires: ((emacs "28.1") (llm "0.22.0") (spinner "1.7.4") 
(transient "0.7") (compat "29.1") (posframe "1.4.0"))
-;; Version: 1.1.2
+;; Version: 1.1.3
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;; Created: 8th Oct 2023
 
@@ -1084,8 +1084,8 @@ If EPHEMERAL non nil new session will not be associated 
with any file."
   (if-let* ((id ellama--current-session-id)
(session (with-current-buffer (ellama-get-session-buffer id)
   ellama--current-session)))
-  (push element (ellama-session-context session)))
-  (push element ellama--global-context)
+  (cl-pushnew element (ellama-session-context session) :test 
#'equal-including-properties))
+  (cl-pushnew element ellama--global-context :test 
#'equal-including-properties)
   (get-buffer-create ellama--context-buffer t)
   (with-current-buffer ellama--context-buffer
 (erase-buffer)
@@ -1115,7 +1115,11 @@ If EPHEMERAL non nil new session will not be associated 
with any file."
   "Extract the content of the context ELEMENT."
   (with-slots (name) element
 (with-current-buffer name
-  (buffer-substring-no-properties (point-min) (point-max)
+  (let* ((data (buffer-substring-no-properties (point-min) (point-max)))
+(content (if (derived-mode-p 'org-mode)
+ (ellama-convert-org-to-md data)
+   data)))
+   content
 
 (cl-defmethod ellama-context-element-display
   ((element ellama-context-element-buffer))
@@ -1189,7 +1193,11 @@ If EPHEMERAL non nil new session will not be associated 
with any file."
   (with-slots (name) element
 (with-temp-buffer
   (insert-file-contents name)
-  (buffer-substring-no-properties (point-min) (point-max)
+  (let* ((data (buffer-substring-no-properties (point-min) (point-max)))
+(ext (file-name-extension name)))
+   (if (string= ext "org")
+   (ellama-convert-org-to-md data)
+ data)
 
 (cl-defmethod ellama-context-element-display
   ((element ellama-context-element-file))
@@ -1503,7 +1511,10 @@ If EPHEMERAL non nil new session will not be associated 
with any file."
   "Add active region to context."
   (interactive)
   (if (region-active-p)
-  (let* ((content (buffer-substring-no-properties (region-beginning) 
(region-end)))
+  (let* ((data (buffer-substring-no-properties (region-beginning) 
(region-end)))
+(content (if (derived-mode-p 'org-mode)
+ (ellama-convert-org-to-md data)
+   data))
 (file-name (buffer-file-name))
 (buffer-name (buffer-name (current-buffer)))
  (element (if file-name
@@ -2617,8 +2628,8 @@ Call CALLBACK on result list of strings.  ARGS contains 
keys for fine control.
 (defvar ellama-transient-ollama-model-name "")
 (defvar ellama-transient-temperature 0.7)
 (defvar ellama-transient-context-length 4096)
-(defvar ellama-transient-host nil)
-(defvar ellama-transient-port nil)
+(defvar ellama-transient-host "localhost")
+(defvar ellama-transient-port 11434)
 
 (transient-define-suffix ellama-transient-set-ollama-model ()
   "Set ollama model name."
@@ -2664,10 +2675,14 @@ Call CALLBACK on result list of strings.  ARGS contains 
keys for fine control.
 (transient-define-suffix ellama-transient-set-provider ()
   "Set transient model to provider."
   (interactive)
-  (set (read
-   (completing-read "Select provider: "
-(mapcar #'prin1-to-string ellama-provider-list)))
-   (ellama-construct-ollama-provider-from-transient

[nongnu] elpa/helm updated (790b8f0963 -> 4193cde3fb)

2025-02-14 Thread ELPA Syncer
elpasync pushed a change to branch elpa/helm.

  from  790b8f0963 Merge pull request #2707 from flintforge/master
   new  d4c8296ddd Minor fixes for previous commit
   new  4193cde3fb Remove unuseful cond clause


Summary of changes:
 helm-core.el | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)



[nongnu] elpa/typst-ts-mode 8234ba29f3 196/246: fix: indentation & editing commands

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 8234ba29f341b34ad7f64d611aabce5fe2d8a8d8
Author: meowking 
Commit: meowking 

fix: indentation & editing commands
---
 typst-ts-core.el| 34 +++---
 typst-ts-editing.el | 31 ++-
 typst-ts-mode.el| 35 ++-
 3 files changed, 63 insertions(+), 37 deletions(-)

diff --git a/typst-ts-core.el b/typst-ts-core.el
index b105940a8f..6b7b8357ca 100644
--- a/typst-ts-core.el
+++ b/typst-ts-core.el
@@ -32,6 +32,12 @@
   :type 'natnum
   :group 'typst-ts)
 
+(defconst typst-ts-mode--container-node-types-regexp
+  ;; '_math_group' here is because `treesit-parent-until' doesn't hanlde node 
type alias well
+  ;; TODO file a bug
+  (regexp-opt '("block" "content" "group" "math" "_math_group"))
+  "Container node types regexp.")
+
 (defun typst-ts-core-column-at-pos (point)
   "Get the column at position POINT."
   (save-excursion
@@ -87,15 +93,29 @@ Currently the effect of FN shouldn't change line number."
 
 ;; Emacs 29 doesn't support string type PRED, so this function is created for
 ;; convenience
-(defun typst-ts-core-parent-util-type (node type include-node)
+(defun typst-ts-core-parent-util-type (node type &optional include-node 
same-context)
   "See `treesit-parent-until'.
 TYPE is an regexp expression for matching types.
-NODE TYPE INCLUDE-NODE."
-  (treesit-parent-until
-   node
-   (lambda (node)
- (string-match-p type (treesit-node-type node)))
-   include-node))
+SAME-CONTEXT: whether the parent should be in the current context with NODE.
+The following example means parent item node is in a different context with
+`hi' text node
+- #[
+hi
+]
+NODE TYPE INCLUDE-NODE see `treesit-parent-until'."
+  (let ((matched-node
+ (treesit-parent-until
+  node
+  (lambda (node)
+(let ((node-type (treesit-node-type node)))
+  (or (and same-context
+   (string-match-p
+typst-ts-mode--container-node-types-regexp node-type))
+  (string-match-p type node-type
+  include-node)))
+(when (and matched-node
+   (string-match-p type (treesit-node-type matched-node)))
+  matched-node)))
 
 (defun typst-ts-core-prev-sibling-ignore-types (node types)
   "Find previous sibling node ignoring nodes whose type matches TYPES.
diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index 39b4344962..1f20d2d20c 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -119,19 +119,21 @@ When prefix ARG is non-nil, call global return function."
(cond
 ;; on item node end
 ((and (eolp)
-  (setq node 
(typst-ts-core-get-parent-of-node-at-bol-nonwhite))
-  (equal (treesit-node-type node) "item"))
+  (setq node (typst-ts-core-parent-util-type
+  
(typst-ts-core-get-parent-of-node-at-bol-nonwhite)
+  "item" t t)))
  (let* ((item-node node)
-(child-node (treesit-node-child item-node 1))
+(has-children (treesit-node-child item-node 1))
 (next-line-node
  (typst-ts-core-get-parent-of-node-at-bol-nonwhite
   (save-excursion
 (forward-line 1)
 (point
-(next-line-node-type
- (treesit-node-type next-line-node)))
-   (if child-node
-   (if (and (equal next-line-node-type "item")
+(next-line-top-item-node
+ (typst-ts-core-parent-util-type
+  next-line-node "item" t t)))
+   (if has-children
+   (if (and next-line-top-item-node
 ;; end of buffer situation (or next line is the end
 ;; line (and no newline character))
 (not (equal
@@ -146,15 +148,18 @@ When prefix ARG is non-nil, call global return function."
  (beginning-of-line)
  (kill-line)
  ;; whether the previous line is in an item
- (let* ((prev-line-node-type
- (treesit-node-type
+ (let* ((prev-line-item-node
+ (typst-ts-core-parent-util-type
   (typst-ts-core-get-parent-of-node-at-bol-nonwhite
(save-excursion
  (forward-line -1)
- (point))
-   (if (equal "item" prev-line-node-type)
+ (point)))
+  "item" t t)))
+   (if prev-line-item-node
(progn
- (kill-line)
+ ;; sometimes there is no newlines characters

[nongnu] elpa/typst-ts-mode 5f1ff0343f 231/246: Replaced `typst-ts-mode-peview` by the improved `typst-ts-preview`

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 5f1ff0343f94f3691db6a4b380ca7e417bf21793
Author: Valentino Slavkin 
Commit: Valentino Slavkin 

Replaced `typst-ts-mode-peview` by the improved `typst-ts-preview`
---
 typst-ts-mode.el  | 10 +-
 typst-ts-transient.el |  2 +-
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 9c3554abf5..88cc1333d6 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -461,19 +461,11 @@ This function is meant to be used when user hits a return 
key."
   0)))
 
 
-;;;###autoload
-(defun typst-ts-mode-preview (file)
-  "Open the result compile file.
-FILE: file path for the result compile file."
-  (interactive (list (typst-ts-compile-get-result-pdf-filename)))
-  ;; don't use `browse-url-of-file', which cannot open non-english documents
-  (browse-url file))
-
 ;;;###autoload
 (defvar-keymap typst-ts-mode-map
   "C-c C-c" #'typst-ts-compile  ; use prefix argument to do preview
   "C-c C-w" #'typst-ts-watch-mode
-  "C-c C-p" #'typst-ts-mode-preview
+  "C-c C-p" #'typst-ts-preview
 
   "M-" #'typst-ts-mode-meta-left
   "M-" #'typst-ts-mode-meta-right
diff --git a/typst-ts-transient.el b/typst-ts-transient.el
index fbf21287fb..53f03cf7dd 100644
--- a/typst-ts-transient.el
+++ b/typst-ts-transient.el
@@ -31,7 +31,7 @@
 ("c" "compile & preview" typst-ts-compile-and-preview)
 ("C" "compile" typst-ts-compile)
 ("w" "watch" typst-ts-watch-mode)
-("p" "preview" typst-ts-mode-preview)]
+("p" "preview" typst-ts-preview)]
 
["Export"
 ("em" "markdown" typst-ts-mc-export-to-markdown)]



[nongnu] elpa/typst-ts-mode e9b9881c76 186/246: fix: #8 headings can be demoted and promoted again

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit e9b9881c767acfefc35f10e7a2008e8d5a0a9bf2
Author: Huan Nguyen 
Commit: meowking 

fix: #8 headings can be demoted and promoted again
---
 typst-ts-mode.el | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index b292cf6732..3b85e2e219 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -587,9 +587,13 @@ NODE, PARENT and BOL see `treesit-simple-indent-rules'."
   (treesit-node-text node))
 
 ;; outline-minor-mode
-(defconst typst-ts-mode-outline-regexp "^[[:space:]]*\\(=+\\) "
+(defconst typst-ts-mode-outline-regexp "^[[:space:]]*\\(=+\\)"
   "Regexp identifying Typst header.")
 
+(defconst typst-ts-mode-outline-heading-alist
+  '(("=" . 1) ("==" . 2) ("===" . 3) ("" . 4) ("=" . 5) ("==" . 6))
+  "See `outline-heading-alist'.")
+
 (defun typst-ts-mode-outline-level ()
   "Return the level of the heading at point."
   (save-excursion
@@ -755,6 +759,7 @@ typst tree sitter grammar (at least %s)!" 
(current-time-string min-time))
   (setq treesit-outline-predicate (regexp-opt '("section" "source_file")))
 (setq-local outline-regexp typst-ts-mode-outline-regexp)
 (setq-local outline-level #'typst-ts-mode-outline-level))
+  (setq-local outline-heading-alist typst-ts-mode-outline-heading-alist)
   ;; Although without enabling `outline-minor-mode' also works, enabling it
   ;; provides outline ellipsis
   ;; TODO add it to after-hook



[nongnu] elpa/typst-ts-mode fa009cdf77 201/246: fix: #12

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit fa009cdf77aa2be27cef0707d6fe35b38615c62f
Author: Huan Nguyen 
Commit: Huan Nguyen 

fix: #12

- #[
  ]

- hi #[
hello
  ]
---
 typst-ts-mode.el | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 0f9f1a8edd..75f1a3c8fc 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -438,6 +438,14 @@ NODE, PARENT and BOL see `treesit-simple-indent-rules'."
  ((and no-node (parent-is "source_file")) prev-line 0)
  ((parent-is "source_file") column-0 0)
 
+ ((n-p-gp ,(regexp-opt '(")" "]" "}" "$"))
+  ,typst-ts-mode--container-node-types-regexp
+  "item")
+  (lambda (_node parent _bol)
+(treesit-node-start
+ (treesit-node-child (treesit-node-parent parent) 1)))
+  0)
+
  ((n-p-gp ,(regexp-opt '(")" "]" "}" "$"))
   ,typst-ts-mode--container-node-types-regexp
   nil)
@@ -459,7 +467,7 @@ NODE, PARENT and BOL see `treesit-simple-indent-rules'."
  ;; item - child item
  ((and (node-is "item") (parent-is "item")) parent-bol
   typst-ts-mode-indent-offset)
- 
+
  ;; multi-line item
  ;; -  #[hi] foo
  ;;bar
@@ -467,7 +475,7 @@ NODE, PARENT and BOL see `treesit-simple-indent-rules'."
  ;; `adaptive-fill-regexp'
  ((match nil "item" nil 2 nil)
   typst-ts-mode--indentation-multiline-item-get-anchor 0)
- 
+
  ;; item - new item content should follow its previous line's indentation
  ;; level
  ((and no-node



[nongnu] elpa/typst-ts-mode 56b6cba699 238/246: fix: warning about imperative

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 56b6cba6997582954a9b552fce6870fedf21054c
Author: Huan Thieu Nguyen 
Commit: Huan Thieu Nguyen 

fix: warning about imperative
---
 typst-ts-editing.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index c626bd8ac5..6247d175b5 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -129,7 +129,7 @@ When point is not on an item node return nil."
 (set-marker marker2-end nil)))
 
 (defun typst-ts-mode-item--move (direction)
-  "Moves item node up or down (swap).
+  "Move item node up or down (swap).
 DIRECTION should be `up' or `down'."
   (let* ( previous current next swap-with numbered-p
   (bind (lambda ()



[nongnu] elpa/typst-ts-mode 4a9a79db64 193/246: chore

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 4a9a79db64f4790118d82a5a8eeac91c2c4b42fd
Author: meowking 
Commit: meowking 

chore
---
 typst-ts-core.el| 3 +--
 typst-ts-editing.el | 7 ---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/typst-ts-core.el b/typst-ts-core.el
index b89c16b8e1..02122fa4b0 100644
--- a/typst-ts-core.el
+++ b/typst-ts-core.el
@@ -45,7 +45,7 @@
 (back-to-indentation)
 (point)))
 
-(defun typst-ts-core-line-bol-pos (&optional pos)
+(defun typst-ts-core-line-bol-nonwhite-pos (&optional pos)
   "POS."
   (save-excursion
 (when pos
@@ -102,7 +102,6 @@ TYPES is an regexp expression."
  (prev-node-type (treesit-node-type prev-node)))
 (while (and prev-node-type
 (string-match-p types prev-node-type))
-  (message "%s" prev-node)
   (setq
prev-node (treesit-node-prev-sibling prev-node)
prev-node-type (treesit-node-type prev-node)))
diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index 8c6cdda2dc..c1fad3c3be 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -217,7 +217,7 @@ When there is no section it will insert a heading below 
point."
 (defun typst-ts-editing--indent-item-node-lines (node offset)
   (let ((item-node-min-column
  (typst-ts-core-column-at-pos
-  (typst-ts-core-line-bol-pos
+  (typst-ts-core-line-bol-nonwhite-pos
(treesit-node-start node)
 (if (< (+ item-node-min-column offset) 0)
 (setq offset (- item-node-min-column)))
@@ -226,7 +226,7 @@ When there is no section it will insert a heading below 
point."
  (lambda ()
(indent-line-to
 (+ (typst-ts-core-column-at-pos
-(typst-ts-core-line-bol-pos))
+(typst-ts-core-line-bol-nonwhite-pos))
offset))
 
 (defun typst-ts-mode-cycle (&optional _arg)
@@ -294,7 +294,8 @@ When there is no section it will insert a heading below 
point."
  (typst-ts-editing--indent-item-node-lines
   cur-item-node
   (- typst-ts-mode-indent-offset (abs offset)
- ))
+
+ (throw 'execute-result 'success)))
   
   (t nil)
 ;; execute default action if not successful



[nongnu] elpa/typst-ts-mode 743f05267b 242/246: merge develop breanch into main

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 743f05267bd970c410b23a9eec620c4ac99427ab
Merge: 07c6de2c46 51e05c7075
Author: meowking 
Commit: meowking 

merge develop breanch into main
---
 typst-ts-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 5f5a1bace8..5843129b78 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -464,7 +464,7 @@ This function is meant to be used when user hits a return 
key."
 ;;;###autoload
 (defvar-keymap typst-ts-mode-map
   "C-c C-c" #'typst-ts-compile  ; use prefix argument to do preview
-  "C-c C-C" #'typst-ts-compile-and-preview
+  "C-c C-S-C" #'typst-ts-compile-and-preview
   "C-c C-w" #'typst-ts-watch-mode
   "C-c C-p" #'typst-ts-preview
 



[nongnu] elpa/typst-ts-mode 449f2b0728 204/246: fix: #12

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 449f2b0728cf55192dbde7987304d3d772c83e36
Author: Huan Nguyen 
Commit: Huan Nguyen 

fix: #12

Indent rule for:
- hello #[
  hi]
---
 typst-ts-mode.el | 13 +
 1 file changed, 13 insertions(+)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 746b1b878f..59864218a0 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -495,6 +495,19 @@ NODE, PARENT and BOL see `treesit-simple-indent-rules'."
  ((n-p-gp nil ,typst-ts-mode--container-node-types-regexp "section")
   grand-parent 0)
 
+ ;; special case, item child is container
+ ((lambda (_node parent _bol)
+(and
+ (string= "item" (treesit-node-type (treesit-node-parent parent)))
+ (string-match-p typst-ts-mode--container-node-types-regexp
+ (treesit-node-type parent))
+ (= (line-number-at-pos (treesit-node-start (treesit-node-child parent 
2)))
+(line-number-at-pos (treesit-node-start (treesit-node-child parent 
3))
+  (lambda (node parent bol)
+(typst-ts-mode--indentation-multiline-item-get-anchor node 
(treesit-node-parent parent) bol))
+  0)
+
+
  ;; inside container
  ((and no-node (n-p-gp nil "parbreak" 
,typst-ts-mode--container-node-types-regexp))
   typst-ts-mode-indent--grand-parent-bol typst-ts-mode-indent-offset)



[nongnu] elpa/typst-ts-mode ecfc70c965 221/246: chore: remove debug message echo

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit ecfc70c96599154cedf96ebaf176adce467aefde
Author: meowking 
Commit: meowking 

chore: remove debug message echo
---
 typst-ts-editing.el | 1 -
 1 file changed, 1 deletion(-)

diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index 7b920fa10d..6cbca0b0d4 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -189,7 +189,6 @@ DIRECTION should be `up' or `down'."
 (defun typst-ts-mode-meta-down ()
   "See `typst-ts-mode-meta--dwim'."
   (interactive)
-  (message "%s" (typst-ts-mode-meta--dwim 'down))
   (call-interactively (typst-ts-mode-meta--dwim 'down)))
 
 (defun typst-ts-mode-meta-left ()



[nongnu] elpa/typst-ts-mode 0d40d36cae 046/246: Merge branch 'main' into feat/heading-operations

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 0d40d36caebdf02e369e99b9f06f1ac643617a5d
Merge: 14affa17e3 89ee073562
Author: Meow King 
Commit: Meow King 

Merge branch 'main' into feat/heading-operations
---
 README.md| 17 -
 typst-ts-mode.el |  4 ++--
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/README.md b/README.md
index 6013797d53..ce058bcde4 100644
--- a/README.md
+++ b/README.md
@@ -16,10 +16,10 @@ Tree Sitter support for Typst. Minimum Emacs version 
requirement: 29.
 1. Emacs >= 29
 
 2. Latest [Typst](https://github.com/typst/typst).  
-`typst 0.9.0 (7bb4f6df)`
+`typst 0.10.0 (70ca0d25)`
 
 3. Tree Sitter parser for Typst: https://github.com/uben0/tree-sitter-typst  
-commit: `a96fa35`
+commit: `c0765e3`
 
 Note this tree sitter parser is included in [tree sitter 
modules](https://github.com/casouri/tree-sitter-module), so you can use the 
build script 
 in it to get this parser.  
@@ -94,15 +94,14 @@ For some options you may find useful:
 3. `typst-ts-mode-watch-options`. Set this to `--open` so typst will open the 
compiled
 file for you.
 4. `typst-ts-mode-compile-options`. Note that setting `--open` has no use for 
this
-customization variable. What `--open` do in Typst process is to spawn a new 
thread 
-to open the compiled file with default application corresponding to each 
platform. With its
-main process finished,  all Typst's sub-process will be killed by Emacs (This 
is my assumption,
-for more information, you may have to dive into [crate - 
open](https://crates.io/crates/open)).
-You can try shell command `typst compile  --open && sleep 1` in Emacs to 
see what happened. 
+customization variable. You can execute the shell command 
+`typst compile  --open && sleep 1` to view what is happening. 
 5. `typst-ts-mode-display-watch-process-bufer-automatically`. This is set to 
`t` by
 default, so the `typst watch` process buffer appear when an error occurs, and 
disappear
-when there is no error. You may find there is only one error at a time, and it 
is
-because Typst itself do this style. You may find `auto-save-mode`, 
`auto-save-visited-mode`, 
[auto-save](https://github.com/manateelazycat/auto-save) or 
[super-save](https://github.com/bbatsov/super-save) useful (or annoying).
+when there is no error. You may find sometimes there is only one error at a 
time, and it is
+because Typst itself do this style. You may find `auto-save-visited-mode`,
+[auto-save](https://github.com/manateelazycat/auto-save) or 
+[super-save](https://github.com/bbatsov/super-save) useful (or annoying).
 6. `typst-ts-markup-header-same-height` and `typst-ts-markup-header-scale` to 
control header height. 
 7. `typst-ts-mode-before-compile-hook` and `typst-ts-mode-after-compile-hook`
 
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 3c094c8079..21ddb10ab1 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2023 Ziqi Yang 
 
-;; Version: 0.8.0
+;; Version: 0.10.0
 ;; Author: Ziqi Yang 
 ;; Keywords: typst languages tree-sitter
 ;; URL: https://git.sr.ht/~meow_king/typst-ts-mode
@@ -45,7 +45,7 @@
   :group 'typst-ts)
 
 (defcustom typst-ts-mode-indent-offset 4
-  "Number of spaces for each indentation step in `json-ts-mode'."
+  "Number of spaces for each indentation step in `typst-ts-mode'."
   :type 'integer
   :group 'typst-ts)
 



[nongnu] elpa/typst-ts-mode 86492f0765 026/246: doc: update README

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 86492f07654694c336b2922961c1e9f3a68101d4
Author: Ziqi Yang 
Commit: Ziqi Yang 

doc: update README
---
 README.md | 42 +-
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/README.md b/README.md
index 2835d6fa56..b7857f6edb 100644
--- a/README.md
+++ b/README.md
@@ -16,19 +16,22 @@ Tree Sitter support for Typst. Minimum Emacs version 
requirement: 29.
 1. Emacs >= 29
 
 2. Latest [Typst](https://github.com/typst/typst).  
-Why use the latest? Since Typst is still in its frequent development and the 
-tree sitter parser for Typst will also be updated frequently, this package 
should 
-follow their steps. As a result, one user (among many users) should use the 
-latest Typst executable to match the tree sitter parser change and the change 
of this package.  
-The version of this package is intentionally set to match the version of Typst 
release,
-so keep an eye out when updating your packages.
+`typst 0.8.0 (360cc9b9)`
 
 3. Tree Sitter parser for Typst: https://github.com/uben0/tree-sitter-typst  
-
-The following script to compile the parser is stolen from 
-https://github.com/casouri/tree-sitter-module  
-
-``` shell
+commit: `e35aa22`
+
+Note this tree sitter parser is included in [tree sitter 
modules](https://github.com/casouri/tree-sitter-module), so you can use the 
build script 
+in it to get this parser.  
+You can also use the following script to build the parser too, which is 
extracted 
+from `tree sitter modules`.  
+
+  Click me
+  
+*Note*, you should change the extension of `libtree-sitter-typst.so` from `so` 
to `dylib`(Darwin) or 
+`dll`(Windows) to match your system specification.
+
+```shell
 git clone --depth=1 --single-branch -b master 
g...@github.com:uben0/tree-sitter-typst.git
 
 cd tree-sitter-typst/src
@@ -54,15 +57,18 @@ else
 cc -fPIC -shared *.o -o "libtree-sitter-typst.so"
 fi
 ```
-Then move the resulting file `libtree-sitter-typst.so` to the directory you put
-for tree sitter parsers. For more information, you should take a look at 
`(info "(elisp) Language Grammar")` (eval this expression in Emacs).
+
+
+
+
+After building, you can see that there is a file called 
`typst-sitter-typst.so`(`.so` may also be `.dylib` or `.dll` too). Then move 
this file to the tree sitter parser directory ( Evaluate expression `(info 
"(elisp) Language Grammar")` in Emacs to read the info manual of tree sitter 
language grammar. The infomation of where the tree sitter parsers should be put 
locates in the first few paragraph of this manual). After that, you can install 
this package. 
 
 ## Installation
 
 For reference, this is my configuration.
 ``` emacs-lisp
 (use-package typst-ts-mode
-  :straight (:type git :host sourcehut :repo "meow_king/typst-ts-mode")
+  :elpaca (:type git :host sourcehut :repo "meow_king/typst-ts-mode")
   :custom
   (typst-ts-mode-watch-options "--open"))
 ```
@@ -97,8 +103,8 @@ and [super-save](https://github.com/bbatsov/super-save) 
useful (or annoying).
 6. `typst-ts-markup-header-same-height` and `typst-ts-markup-header-scale` to 
control header height. 
 
 ### Consult Imenu Integration
-If you use [consult](https://github.com/minad/consult) and use `consult-iemnu`
-command, you way want this setting.
+If you use `consult-iemnu`
+command [consult](https://github.com/minad/consult), you way want this setting.
 ``` emacs-lisp
 (setq
  consult-imenu-config
@@ -112,5 +118,7 @@ command, you way want this setting.
 
 Here are some resources:
 - [Let’s Write a Tree-Sitter Major Mode - Matering 
Emacs](https://www.masteringemacs.org/article/lets-write-a-treesitter-major-mode)
-- [ts-query-highlight](https://sr.ht/~meow_king/ts-query-highlight/)
+- [ts-query-highlight](https://sr.ht/~meow_king/ts-query-highlight/)  
+  I wrote this package to highlight tree sitter queries. I use this package to 
help
+developing `typst-ts-mode`.
 - [combobulate](https://github.com/mickeynp/combobulate)



[nongnu] elpa/typst-ts-mode 06a6c6f5df 075/246: style: .dir-locals.el to turn off indent-tabs-mode

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 06a6c6f5dfabb9f0ca9bfd397ff54a1b3f326b5d
Author: Huan Nguyen 
Commit: Huan Nguyen 

style: .dir-locals.el to turn off indent-tabs-mode
---
 .dir-locals.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 00..df2c4f61a2
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1 @@
+((nil . ((indent-tabs-mode . nil



[nongnu] elpa/typst-ts-mode 4c26bf9185 027/246: doc: update README

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 4c26bf9185de819fed6fae88d754ad63ec66e8ac
Author: Ziqi Yang 
Commit: Ziqi Yang 

doc: update README
---
 README.md | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/README.md b/README.md
index b7857f6edb..db4619661c 100644
--- a/README.md
+++ b/README.md
@@ -98,8 +98,7 @@ You can try shell command `typst compile  --open && 
sleep 1` in Emacs to s
 5. `typst-ts-mode-display-watch-process-bufer-automatically`. This is set to 
`t` by
 default, so the `typst watch` process buffer appear when an error occurs, and 
disappear
 when there is no error. You may find there is only one error at a time, and it 
is
-because Typst itself do this style. You may find 
[auto-save](https://github.com/manateelazycat/auto-save)
-and [super-save](https://github.com/bbatsov/super-save) useful (or annoying).
+because Typst itself do this style. You may find `auto-save-mode`, 
`auto-save-visited-mode`, 
[auto-save](https://github.com/manateelazycat/auto-save) or 
[super-save](https://github.com/bbatsov/super-save) useful (or annoying).
 6. `typst-ts-markup-header-same-height` and `typst-ts-markup-header-scale` to 
control header height. 
 
 ### Consult Imenu Integration



[nongnu] elpa/typst-ts-mode b279d1a40a 103/246: fix: indentation problem caused by _math_group, which is an alias and treesit doesn't hanlde properly

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit b279d1a40a86b0917e8979f5485b16f5552a31af
Author: Meow King 
Commit: Meow King 

fix: indentation problem caused by _math_group, which is an alias and 
treesit doesn't hanlde properly
---
 typst-ts-mode.el | 53 ++---
 1 file changed, 22 insertions(+), 31 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index d29dffb817..0a3dd1afce 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -737,7 +737,9 @@ If you want to customize the rules, please customize the 
same name variable
 (markup-extended code-extended math-extended)))
 
 (defconst typst-ts-mode--container-node-types
-  '("block" "content" "group" "math")
+  ;; '_math_group' here is because `treesit-parent-until' doesn't hanlde node 
type alias well
+  ;; TODO file a bug
+  '("block" "content" "group" "math" "_math_group")
   "Bracket node types.")
 
 (defun typst-ts-mode--node-inside-brackets (parent)
@@ -762,17 +764,18 @@ The returned function suits `treesit-simple-indent-rules' 
Match.
 If RETURN-BOL is non-nil, then return returns the beginning of line position of
 the corresponding ancestor node that its type is in TYPES, else return the
 corresponding ancestor node.  Return nil if ancestor not matching."
-  (lambda (_node parent _bol)
-(let* ((query-node parent)
-   (ancestor (treesit-parent-until
-  query-node
-  (lambda (parent)
-(member (treesit-node-type parent) types))
-  t)))
-  (if return-bol
-  (when ancestor
-(typst-ts-mode--get-node-bol ancestor))
-ancestor
+  (let ((re (regexp-opt types)))
+(lambda (_node parent _bol)
+  (let* ((query-node parent)
+ (ancestor (treesit-parent-until
+query-node
+(lambda (parent)
+  (string-match-p re (treesit-node-type parent)))
+t)))
+(if return-bol
+(when ancestor
+  (typst-ts-mode--get-node-bol ancestor))
+  ancestor)
 
 (defun typst-ts-mode--ancestor-bol (types)
   "See `typst-ts-mode--ancestor-in'.
@@ -840,11 +843,13 @@ work well.  Example:
   ;; Note electric-pair-mode will auto insert newline character when condition 
meets
   ;; see `typst-ts-mode-electric-pair-open-newline-between-pairs-psif'
   `((typst
- ((lambda (node parent bol)  ; NOTE
-(message "%s %s %s %s %s" node parent
- (treesit-node-parent parent)
- (treesit-node-parent (treesit-node-parent parent)) bol)
-nil) parent-bol 0)
+ ;; ((lambda (node parent bol)  ; NOTE
+ ;;(message "%s %s %s %s %s" node parent
+ ;; (treesit-node-parent parent)
+ ;; (treesit-node-parent (treesit-node-parent parent)) bol)
+ ;;nil) parent-bol 0)
+ 
+ ((parent-is "source_file") column-0 0)
 
  ((node-is "section") column-0 0)  ; when indent headline, the current 
node is "section"
 
@@ -904,20 +909,6 @@ work well.  Example:
   ,(typst-ts-mode--ancestor-bol typst-ts-mode--container-node-types)
   typst-ts-mode-indent-offset)
  
- ;; ((or (n-p-gp nil ,(regexp-opt typst-ts-mode--container-node-types) 
"section")
- ;;  (and
- ;;   (n-p-gp nil "parbreak" ,(regexp-opt 
typst-ts-mode--container-node-types))
- ;;   (lambda (node parent _bol)
- ;; (equal (treesit-node-type (treesit-node-parent 
(treesit-node-parent parent))) "section"
- ;;  parent-bol 0)
- ;; ;; inside container
- ;; ((or (parent-is ,(regexp-opt typst-ts-mode--container-node-types))
- ;;  (n-p-gp nil "parbreak" ,(regexp-opt 
typst-ts-mode--container-node-types)))
- ;;  parent-bol typst-ts-mode-indent-offset)
-
- ((and no-node (parent-is "source_file"))
-  prev-line 0)
-
  ;; TODO to be examined
  (,(typst-ts-mode--ancestor-in '("ERROR")) no-indent 0)
 



[nongnu] elpa/typst-ts-mode 004ec9373b 024/246: fix: `typst-ts-markup-header-scale` custom setting function error

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 004ec9373b286f272f958b9252a1ceb638134d1f
Author: Ziqi Yang 
Commit: Ziqi Yang 

fix: `typst-ts-markup-header-scale` custom setting function error

also make headers share the same height as default
---
 typst-ts-mode.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 7a6dccc7b8..674543ea9c 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -107,7 +107,7 @@ is eliminated."
 (defvar typst-ts-mode-after-watch-hook nil
   "Hook runs after compile.")
 
-(defcustom typst-ts-markup-header-same-height nil
+(defcustom typst-ts-markup-header-same-height t
   "Whether to make header face in markup context share the same height."
   :type 'boolean
   :group 'typst-ts-faces)
@@ -120,7 +120,7 @@ is eliminated."
  (set-default symbol value)
  (when typst-ts-markup-header-same-height
(set-default symbol (make-list (length value) 1.0
-  :set-after typst-ts-markup-header-same-height
+  :set-after '(typst-ts-markup-header-same-height)
   :group 'typst-ts-faces)
 
 ;; Markup Faces 
=



[nongnu] elpa/typst-ts-mode 28b8da2f49 063/246: feat: add more predefined language settings

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 28b8da2f49088f410b3633d3a6d9ad9195faf521
Author: Meow King 
Commit: Meow King 

feat: add more predefined language settings
---
 src/main.rs |   6 +-
 typst-ts-embedding-lang-settings.el | 151 
 2 files changed, 125 insertions(+), 32 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index 894cfe6088..60163b335d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -159,6 +159,10 @@ fn get_tag_remap() -> HashMap {
 }
 
 fn get_identifier_remap() -> HashMap {
-let map = &[("sh", "bash"), ("cs", "csharp")];
+let map = &[
+("sh", "bash"),
+("cs", "c-sharp"),
+("c++", "cpp")
+];
 slice_to_hashmap(map)
 }
diff --git a/typst-ts-embedding-lang-settings.el 
b/typst-ts-embedding-lang-settings.el
index 85f35c8a52..fdbf41a6a9 100644
--- a/typst-ts-embedding-lang-settings.el
+++ b/typst-ts-embedding-lang-settings.el
@@ -66,7 +66,7 @@ languages in settings."
   bibtex ("bib" "bibtex" )
   build ("build" )
   c ("c" "h" )
-  c++ ("cpp" "cc" "cp" "cxx" "c++" "c" "h" "hh" "hpp" "hxx" "h++" "inl" 
"ipp" )
+  c-sharp ("cs" "csx" "c#" )
   cabal ("cabal" )
   camlp4 ("camlp4" )
   clojure ("clj" "cljc" "cljs" "edn" "clojure" )
@@ -77,10 +77,10 @@ languages in settings."
   commands-builtin-shell-bash ("commands-builtin-shell-bash" )
   commit_editmsg ("commit_editmsg" "merge_msg" "tag_editmsg" )
   commonlisp ("clisp" )
+  cpp ("cpp" "cc" "cp" "cxx" "c++" "c" "h" "hh" "hpp" "hxx" "h++" "inl" 
"ipp" )
   cpuinfo ("cpuinfo" )
   crontab ("tab" "crontab" "cron.d" )
   crystal ("cr" "crystal" )
-  csharp ("cs" "csx" "c#" )
   css ("css" "css.erb" "css.liquid" )
   csv ("csv" "tsv" )
   d ("d" "di" )
@@ -221,7 +221,9 @@ languages in settings."
   yaml ("yaml" "yml" "sublime-syntax" )
   yasm ("yasm" "nasm" "asm" "inc" "mac" )
   yaws ("yaws" )
-  zig ("zig" )))
+  zig ("zig" )
+
+  ))
   "Tree sitter language -> Raw block tags map.")
 
 (defvar typst-ts-els-tag-lang-map
@@ -248,21 +250,21 @@ languages in settings."
   "ebuild" bash "eclass" bash "bat" bat
   "cmd" bat "bib" bibtex "bibtex" bibtex
   "build" build "c" c "h" c
-  "cpp" c++ "cc" c++ "cp" c++
-  "cxx" c++ "c++" c++ "c" c++
-  "h" c++ "hh" c++ "hpp" c++
-  "hxx" c++ "h++" c++ "inl" c++
-  "ipp" c++ "cabal" cabal "camlp4" camlp4
-  "clj" clojure "cljc" clojure "cljs" clojure
-  "edn" clojure "clojure" clojure "cmakelists.txt" cmake
-  "cmake" cmake "cmakecache.txt" cmakecache "cmakecache" cmakecache
-  "cmakecommands" cmakecommands "coffee" coffeescript "cakefile" 
coffeescript
-  "coffee.erb" coffeescript "cson" coffeescript "coffeescript" coffeescript
-  "commands-builtin-shell-bash" commands-builtin-shell-bash 
"commit_editmsg" commit_editmsg "merge_msg" commit_editmsg
-  "tag_editmsg" commit_editmsg "clisp" commonlisp "cpuinfo" cpuinfo
+  "cs" c-sharp "csx" c-sharp "c#" c-sharp
+  "cabal" cabal "camlp4" camlp4 "clj" clojure
+  "cljc" clojure "cljs" clojure "edn" clojure
+  "clojure" clojure "cmakelists.txt" cmake "cmake" cmake
+  "cmakecache.txt" cmakecache "cmakecache" cmakecache "cmakecommands" 
cmakecommands
+  "coffee" coffeescript "cakefile" coffeescript "coffee.erb" coffeescript
+  "cson" coffeescript "coffeescript" coffeescript 
"commands-builtin-shell-bash" commands-builtin-shell-bash
+  "commit_editmsg" commit_editmsg "merge_msg" commit_editmsg "tag_editmsg" 
commit_editmsg
+  "clisp" commonlisp "cpp" cpp "cc" cpp
+  "cp" cpp "cxx" cpp "c++" cpp
+  "c" cpp "h" cpp "hh" cpp
+  "hpp" cpp "hxx" cpp "h++" cpp
+  "inl" cpp "ipp" cpp "cpuinfo" cpuinfo
   "tab" crontab "crontab" crontab "cron.d" crontab
-  "cr" crystal "crystal" crystal "cs" csharp
-  "csx" csharp "c#" csharp "css" css
+  "cr" crystal "crystal" crystal "css" css
   "css.erb" css "css.liquid" css "csv" csv
   "tsv" csv "d" d "di" d
   "dart" dart "diff" diff "patch" diff
@@ -457,25 +459,25 @@ languages in settings."
   :font-lock (c-ts-mode--font-lock-settings 'c)
   :indentation (c-ts-mode--get-indent-style 'c)
   :ts-feature-list c-ts-mode--feature-list))
-(csharp . (:feature
-   csharp-mode
-   :font-lock csharp-ts-mode--font-lock-settings
-   :indentation csharp-ts-mode--indent-rules
-   :ts-feature-list
-   '(( comment definition)
- ( keyword string type directives)
- ( constant escape-sequence expression literal property)
- ( function bracket delimiter error
+(c-sharp . (:feature
+csharp-mode
+:font-lock csharp-ts-mode--font-lock-settings
+:indentation csharp-ts-mode--indent-rules
+:ts-feature-list
+'(( com

[nongnu] elpa/typst-ts-mode 879665683e 003/246: feat: add more fontification rules for markup

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 879665683e11ab318419a53e416d1624655a6c76
Author: Ziqi Yang 
Commit: Ziqi Yang 

feat: add more fontification rules for markup
---
 .gitignore   |  2 ++
 typst-ts-mode.el | 44 +++-
 2 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00..e1f2ee5410
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.elc
+highlight.compare.scm
\ No newline at end of file
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index cc9d0eb149..daa679ce25 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -95,16 +95,42 @@
:height ,(nth 5 typst-ts-markup-header-scale)))
   "See `typst-ts-markup-header-face'.")
 
+(defface typst-ts-markup-url-face
+  '((t :inherit font-lock-string-face))
+  "Face for url."
+  :group 'typst-ts-markup)
+
+(defface typst-ts-markup-emphasis-face
+  '((t :slant italic))
+  "Face for emphasis."
+  :group 'typst-ts-markup)
+
+(defface typst-ts-markup-strong-face
+  '((t :weight bold))
+  "Face for strong."
+  :group 'typst-ts-markup)
 
 (defvar typst-ts-mode-font-lock-rules
   '(;; Typst font locking
 :language typst
 :feature comment
-'((comment) @font-lock-comment-face)
+((comment) @font-lock-comment-face)
 
 :language typst
 :feature markup
-'((heading) @)))
+((heading) @typst-ts-markup-header-face
+ (url) @typst-ts-markup-url-face
+ (emph) @typst-ts-markup-emphasis-face
+ (strong) @typst-ts-markup-strong-face
+ ;; (item) @typst-ts-markup-item-face ;; TODO
+ ;; (term) @typst-ts-markup-term-face ;; TODO
+ ;; (symbol) @typst-ts-markup-symbol-face ;; TODO
+ ;; (shorthand) @typst-ts-markup-shorthand-face ;; TODO
+ ;; (quote) @typst-ts-markup-quote-face ;; TODO
+ ;; (align) @typst-ts-markup-align-face ;; TODO
+ ;; (letter) @typst-ts-markup-letter-face ;; TODO
+ ;; (linebreak) @typst-ts-markup-linebreak-face ;; TODO
+ )))
 
 (defun typst-ts-mode-comment-setup()
   "Setup comment related stuffs for typst-ts-mode."
@@ -143,16 +169,16 @@
   (apply #'treesit-font-lock-rules typst-ts-mode-font-lock-rules))
   (setq-local treesit-font-lock-feature-list
   ;; TODO
-  '((comment markup)
-(markup code)
-(builtin)
-(operator ponctuation)
+  '((markup comment)
+;; (markup code)
+;; (builtin)
+;; (operator ponctuation)
 ;; (bracket delimiter error function operator property 
variable)
 ))
 
-
-  (add-to-list 'auto-mode-alist '("\\.typ\\'" . typst-ts-mode))
-
   (treesit-major-mode-setup))
 
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.typ\\'" . typst-ts-mode))
+
 (provide 'typst-ts-mode)



[nongnu] elpa/typst-ts-mode 7646790a96 057/246: feat: load embedding language settings dynamically

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 7646790a9626739f1fa6e1f7405c9d5922d5e46b
Author: Meow King 
Commit: Meow King 

feat: load embedding language settings dynamically
---
 typst-ts-embedding-lang-settings.el | 230 
 typst-ts-mode.el|  76 ++--
 2 files changed, 297 insertions(+), 9 deletions(-)

diff --git a/typst-ts-embedding-lang-settings.el 
b/typst-ts-embedding-lang-settings.el
new file mode 100644
index 00..cde20a4e81
--- /dev/null
+++ b/typst-ts-embedding-lang-settings.el
@@ -0,0 +1,230 @@
+;;; typst-ts-embedding-lang-settings.el --- Embedding Languages Settings  -*- 
lexical-binding: t; -*-
+;; Copyright (C) 2023 Meow King 
+
+;; This file is NOT part of Emacs.
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Commentary:
+
+;; This file contains settings for tree sitter languages.
+;; to test settings:
+;; emacs --batch -l ./typst-ts-embedding-lang-settings.el --eval 
"(typst-ts-embedding-lang-settings-test)"
+
+;;; Code:
+(require 'treesit)
+
+(defvar typst-ts-embedding-lang-settings
+  '((python . (:feature
+   python
+   :font-lock python--treesit-settings
+   :indentation nil
+   :ts-feature-list
+   '(( comment definition)
+ ( keyword string type)
+ ( assignment builtin constant decorator
+   escape-sequence number string-interpolation )
+ ( bracket delimiter function operator variable property 
+(rust . (:feature
+ rust-ts-mode
+ :font-lock rust-ts-mode--font-lock-settings
+ :indentation rust-ts-mode--indent-rules
+ :ts-feature-list
+ '(( comment definition)
+   ( keyword string)
+   ( assignment attribute builtin constant escape-sequence
+ number type)
+   ( bracket delimiter error function operator property 
variable)
+  "Settings for raw block languages.")
+
+
+;; from vimscript-ts-mode (https://github.com/nverno/vimscript-ts-mode)
+(defun typst-ts-els--merge-features (a b)
+  "Merge `treesit-font-lock-feature-list's A with B."
+  (cl-loop for x in a
+   for y in b
+   collect (seq-uniq (append x y
+
+;; hugely insprired by vimscript-ts-mode 
(https://github.com/nverno/vimscript-ts-mode)
+(defun typst-ts-els-merge-settings (settings)
+  "Merge SETTINGS."
+  (let ((feature (plist-get settings :feature))
+(font-lock-settings (plist-get settings :font-lock))
+(indentation-rules (plist-get settings :indentation))
+(ts-feature-list (plist-get settings :ts-feature-list)))
+(require feature)
+(setq font-lock-settings (eval font-lock-settings))
+(setq indentation-rules (eval indentation-rules))
+(setq ts-feature-list (eval ts-feature-list))
+(setq-local
+ treesit-font-lock-settings (append treesit-font-lock-settings
+font-lock-settings)
+ treesit-simple-indent-rules (append treesit-simple-indent-rules
+ indentation-rules)
+ treesit-font-lock-feature-list (typst-ts-els--merge-features
+ treesit-font-lock-feature-list
+ ts-feature-list
+
+(defun typst-ts-els-merge-lang (lang)
+  "Merge embedding language LANG settings."
+  (let ((settings (alist-get lang typst-ts-embedding-lang-settings)))
+(if settings
+(typst-ts-els-merge-settings settings)
+  (signal 'lang-no-in-settings '(lang)
+
+(defun typst-ts-els--try-get-variable--try-name (prefixes postfixes)
+  (let (variable)
+(catch 'exit
+  (cl-loop for prefix in prefixes
+   for postfix in postfixes
+   do
+   (ignore-errors
+ (setq variable (intern (concat prefix postfix)))
+ (throw 'exit (eval variable)))
+
+(defun typst-ts-els--try-get-fls--try-name (_lang prefixes)
+  (typst-ts-els--try-get-variable--try-name
+   prefixes
+   '("--font-lock-settings" "-font-lock-settings")))
+
+(defun typst-ts-els--try-get-ir--try-name (_lang prefixes)
+  (typst-ts-els--try-get-variable--try-name
+   prefixes
+   '("--indent-rules" "-indent-rules")))
+
+(defvar typst-ts-els--try-get-feature-name-list
+  '("-ts-mode" "-mode" 

[nongnu] elpa/typst-ts-mode 4abd0cd7fe 124/246: fix: check-declare issur for `treesit-parser-list` in Emacs 30

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 4abd0cd7fee3d13ead049edfe4f2f8ecf38f6e17
Author: Meow King 
Commit: Meow King 

fix: check-declare issur for `treesit-parser-list` in Emacs 30
---
 justfile  | 6 ++
 typst-ts-utils.el | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/justfile b/justfile
index 637dff6d97..ed05277fd6 100644
--- a/justfile
+++ b/justfile
@@ -3,3 +3,9 @@ els-settings-test:
 -l ~/.emacs.d/.local/elpaca/repos/emacs-kotlin-ts-mode/kotlin-ts-mode.el \
 -l ~/.emacs.d/.local/elpaca/repos/mermaid-ts-mode/mermaid-ts-mode.el \
 --eval "(typst-ts-embedding-lang-settings-test)"
+
+lint:
+./makem.sh lint
+
+lint-29:
+./makem.sh lint -E ~/myBin/emacs29.2
diff --git a/typst-ts-utils.el b/typst-ts-utils.el
index f94ce2c750..7ee59a208a 100644
--- a/typst-ts-utils.el
+++ b/typst-ts-utils.el
@@ -23,7 +23,9 @@
 
 (require 'treesit)
 
-(declare-function treesit-parser-list "treesit.c")
+;; don't use 'treesit.c' since package Emacs distribution may separate the 
source
+;; code from Emacs binary
+(declare-function treesit-parser-list "treesit" t t)
 
 (defun typst-ts-utils-parser-list (&optional buffer language)
   "An comptibility function for Emacs 29's `treesit-parser-list' function.



[nongnu] elpa/cider 7e9e70ce66: [overlays] Fix overlay slowness when huge result is displayed

2025-02-14 Thread ELPA Syncer
branch: elpa/cider
commit 7e9e70ce6647894d7833aa8598f4c48440d6444b
Author: Oleksandr Yakushev 
Commit: Bozhidar Batsov 

[overlays] Fix overlay slowness when huge result is displayed
---
 CHANGELOG.md  |  1 +
 cider-overlays.el | 19 +--
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1e83c9bbad..54819aefeb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@
 ### Bugs fixed
 
 - [#3763](https://github.com/clojure-emacs/cider/issues/3763): Fix 
`cider-docview-render` completion popup error when symbol being completed does 
not have a docstring.
+- [#3774](https://github.com/clojure-emacs/cider/issues/3774): Fix overlay 
hangup when evaluating huge values.
 
 ## 1.16.1 (2024-12-03)
 
diff --git a/cider-overlays.el b/cider-overlays.el
index f1808fafcd..8d0546606a 100644
--- a/cider-overlays.el
+++ b/cider-overlays.el
@@ -232,6 +232,8 @@ overlay."
;; Specify `default' face, otherwise unformatted text will
;; inherit the face of the following text.
(display-string (format (propertize format 'face 'default) 
value))
+   ;; Maximum value width at which we truncate it.
+   (truncation-threshold (* 3 (window-width)))
(o nil))
   ;; Remove any overlay at the position we're creating a new one, if it
   ;; exists.
@@ -245,17 +247,22 @@ overlay."
   ;; If the display spans multiple lines or is very long, display it at
   ;; the beginning of the next line.
   (when (or (string-match "\n." display-string)
+;; string-width can be very slow on large results, so check
+;; with a cheaper predicate first. Conservatively limit to
+;; truncation threshold.
+(> (length display-string) truncation-threshold)
 (> (string-width display-string)
(- (window-width) (current-column
 (setq display-string (concat " \n" display-string)))
-  ;; Put the cursor property only once we're done manipulating the
-  ;; string, since we want it to be at the first char.
-  (put-text-property 0 1 'cursor 0 display-string)
-  (when (> (string-width display-string) (* 3 (window-width)))
+  (when (or (> (length display-string) truncation-threshold)
+(> (string-width display-string) truncation-threshold))
 (setq display-string
-  (concat (substring display-string 0 (* 3 (window-width)))
+  (concat (substring display-string 0 truncation-threshold)
   (substitute-command-keys
"...\nResult truncated. Type 
`\\[cider-inspect-last-result]' to inspect it."
+  ;; Put the cursor property only once we're done manipulating the
+  ;; string, since we want it to be at the first char.
+  (put-text-property 0 1 'cursor 0 display-string)
   ;; Create the result overlay.
   (setq o (apply #'cider--make-overlay
  beg end type
@@ -285,7 +292,7 @@ overlay."
 (when (and (<= (window-start win) (point) (window-end win))
;; Right edge is visible. This is a little conservative
;; if the overlay contains line breaks.
-   (or (< (+ (current-column) (string-width value))
+   (or (< (+ (current-column) (string-width 
display-string))
   (window-width win))
(not truncate-lines)))
   o)))



[nongnu] elpa/projectile 4db736db1b 2/3: [Docs] Fix broken link

2025-02-14 Thread ELPA Syncer
branch: elpa/projectile
commit 4db736db1b8d451bc06e7b10736936df6f9fcd14
Author: Bozhidar Batsov 
Commit: Bozhidar Batsov 

[Docs] Fix broken link
---
 doc/modules/ROOT/pages/projectile_vs_project.adoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/modules/ROOT/pages/projectile_vs_project.adoc 
b/doc/modules/ROOT/pages/projectile_vs_project.adoc
index cafad41376..a1daab1d71 100644
--- a/doc/modules/ROOT/pages/projectile_vs_project.adoc
+++ b/doc/modules/ROOT/pages/projectile_vs_project.adoc
@@ -116,7 +116,7 @@ rely on the third-party applications and it's significance 
today is not that big
   ** It accepts pull requests
   ** You don't need to sign a contributor agreement
 * Projectile has more extensive documentation
-  ** You can compare it with [project.el's 
documentation](https://www.gnu.org/software/emacs/manual/html_node/emacs/Projects.html)
 and decide for themselves
+  ** You can compare it with 
https://www.gnu.org/software/emacs/manual/html_node/emacs/Projects.html[project.el's
 documentation] and decide for yourself
 
 == Projectile's Cons
 



[nongnu] elpa/projectile e798185d84 3/3: Update Antora docs version

2025-02-14 Thread ELPA Syncer
branch: elpa/projectile
commit e798185d84fd9829467fe751e7fcc9178519712d
Author: Bozhidar Batsov 
Commit: Bozhidar Batsov 

Update Antora docs version
---
 doc/antora.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/antora.yml b/doc/antora.yml
index c17811ed4e..6e48609184 100644
--- a/doc/antora.yml
+++ b/doc/antora.yml
@@ -2,6 +2,6 @@ name: projectile
 title: Projectile
 # We always provide version without patch here (e.g. 1.1),
 # as patch versions should not appear in the docs.
-version: ~
+version: 2.9
 nav:
 - modules/ROOT/nav.adoc



[elpa] externals/org-gnosis 143909c32d 3/3: Change README to org-mode format.

2025-02-14 Thread ELPA Syncer
branch: externals/org-gnosis
commit 143909c32dc4299cc0b2d22bfd461d2595b2f415
Author: Thanos Apollo 
Commit: Thanos Apollo 

Change README to org-mode format.
---
 README | 8 
 README.org | 9 +
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/README b/README
deleted file mode 100644
index c4b321ccdb..00
--- a/README
+++ /dev/null
@@ -1,8 +0,0 @@
-org-gnosis
-==
-
-Roam-inspired note-taking system for GNU Emacs.  It is designed to
-serve as a minimalistic, drop-in alternative to org-roam.
-
-
-- Project's Page: 
\ No newline at end of file
diff --git a/README.org b/README.org
new file mode 100644
index 00..ad8a946151
--- /dev/null
+++ b/README.org
@@ -0,0 +1,9 @@
+#+TITLE: Org Gnosis
+
+** About
+
+Org Gnosis (GNU-sis) is a Roam-inspired note-taking system for GNU
+Emacs.
+
++ [[https://thanosapollo.org/projects/org-gnosis/][Homepage]]
++ [[https://thanosapollo.org/user-manual/org-gnosis/][Manual]]



[elpa] externals/ellama 280b97119a 5/6: Bump version

2025-02-14 Thread ELPA Syncer
branch: externals/ellama
commit 280b97119a31969d29c723a9452b0a5e48cf66bf
Author: Sergey Kostyaev 
Commit: Sergey Kostyaev 

Bump version
---
 NEWS.org  | 12 ++--
 ellama.el |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index 3a2a696fa7..459acd14a3 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -1,6 +1,14 @@
+* Version 1.1.3
+- Ensure unique elements in session and global contexts.
+- Change default transient host and port to fix ollama provider setup.
+- Deactivate ellama session on setting ellama-provider.
+- Added functionality to convert Org mode content to Markdown when
+  extracting buffer or file content for the context. This ensures that
+  any Org mode files are properly formatted as Markdown before being
+  processed further.
 * Version 1.1.2
-- Clear session context on calling reset context commant to prevent
-  suprising behaviour.
+- Clear session context when resetting context to prevent unexpected
+  behavior.
 * Version 1.1.1
 - Improve ~ellama-add-selection~.
 - Add buffer quote context element.
diff --git a/ellama.el b/ellama.el
index 67301e5187..f8d56e8e26 100644
--- a/ellama.el
+++ b/ellama.el
@@ -6,7 +6,7 @@
 ;; URL: http://github.com/s-kostyaev/ellama
 ;; Keywords: help local tools
 ;; Package-Requires: ((emacs "28.1") (llm "0.22.0") (spinner "1.7.4") 
(transient "0.7") (compat "29.1") (posframe "1.4.0"))
-;; Version: 1.1.2
+;; Version: 1.1.3
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;; Created: 8th Oct 2023
 



[nongnu] elpa/helm 4193cde3fb 2/2: Remove unuseful cond clause

2025-02-14 Thread ELPA Syncer
branch: elpa/helm
commit 4193cde3fb48532b55795fe87cb8167888f73f46
Author: Thierry Volpiatto 
Commit: Thierry Volpiatto 

Remove unuseful cond clause
---
 helm-core.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/helm-core.el b/helm-core.el
index b793b73a7c..dba4b0cd8c 100644
--- a/helm-core.el
+++ b/helm-core.el
@@ -3573,8 +3573,7 @@ version < emacs-28."
  ;; lateral constraint to keep the frame inside of the screen
  (left . ,(cond ((> (+ px helm-frame-width) screen-width)
  (- screen-width helm-frame-width))
-((< (- px prmt-width) 0) 0)
-(t (- px prmt-width
+(t (max (- px prmt-width) 0
  ;; Try to put frame at the best possible place.
  ;; Frame should be below point if enough
  ;; place, otherwise above point and



[elpa] externals/ellama abb82f308e 1/6: Ensure unique elements in session and global contexts

2025-02-14 Thread ELPA Syncer
branch: externals/ellama
commit abb82f308e8784232f8eeba4e887bd50a5333f05
Author: Sergey Kostyaev 
Commit: Sergey Kostyaev 

Ensure unique elements in session and global contexts

Improve context management by ensuring that elements added to the
session and global contexts are unique. This is achieved by using
`cl-pushnew` with a test function `equal-including-properties`
to compare elements.
---
 ellama.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ellama.el b/ellama.el
index ae7c8ff0c8..bdbb7302e2 100644
--- a/ellama.el
+++ b/ellama.el
@@ -1084,8 +1084,8 @@ If EPHEMERAL non nil new session will not be associated 
with any file."
   (if-let* ((id ellama--current-session-id)
(session (with-current-buffer (ellama-get-session-buffer id)
   ellama--current-session)))
-  (push element (ellama-session-context session)))
-  (push element ellama--global-context)
+  (cl-pushnew element (ellama-session-context session) :test 
#'equal-including-properties))
+  (cl-pushnew element ellama--global-context :test 
#'equal-including-properties)
   (get-buffer-create ellama--context-buffer t)
   (with-current-buffer ellama--context-buffer
 (erase-buffer)



[elpa] externals/ellama updated (2b75043cd6 -> 6615a857d6)

2025-02-14 Thread ELPA Syncer
elpasync pushed a change to branch externals/ellama.

  from  2b75043cd6 Merge pull request #216 from Sventimir/readme-update
   new  abb82f308e Ensure unique elements in session and global contexts
   new  21acc75622 Change default transient host and port to fix ollama 
provider setup
   new  9dc6b47588 Fix setting provider and reset session ID
   new  40a4680982 Convert Org mode content to Markdown before adding to 
context
   new  280b97119a Bump version
   new  6615a857d6 Merge pull request #217 from s-kostyaev/improve-ctx


Summary of changes:
 NEWS.org  | 12 ++--
 ellama.el | 39 +++
 2 files changed, 37 insertions(+), 14 deletions(-)



[elpa] externals/ellama 21acc75622 2/6: Change default transient host and port to fix ollama provider setup

2025-02-14 Thread ELPA Syncer
branch: externals/ellama
commit 21acc7562246ba1654bddadc18300571c69cea83
Author: Sergey Kostyaev 
Commit: Sergey Kostyaev 

Change default transient host and port to fix ollama provider setup
---
 ellama.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ellama.el b/ellama.el
index bdbb7302e2..a93a9ba42f 100644
--- a/ellama.el
+++ b/ellama.el
@@ -2617,8 +2617,8 @@ Call CALLBACK on result list of strings.  ARGS contains 
keys for fine control.
 (defvar ellama-transient-ollama-model-name "")
 (defvar ellama-transient-temperature 0.7)
 (defvar ellama-transient-context-length 4096)
-(defvar ellama-transient-host nil)
-(defvar ellama-transient-port nil)
+(defvar ellama-transient-host "localhost")
+(defvar ellama-transient-port 11434)
 
 (transient-define-suffix ellama-transient-set-ollama-model ()
   "Set ollama model name."



[elpa] externals/ellama 9dc6b47588 3/6: Fix setting provider and reset session ID

2025-02-14 Thread ELPA Syncer
branch: externals/ellama
commit 9dc6b47588773d07629e316f0f8df0e4359173df
Author: Sergey Kostyaev 
Commit: Sergey Kostyaev 

Fix setting provider and reset session ID

Updated the `ellama-transient-set-provider` function to correctly set
the provider and added logic to reset the current session ID when
changing the provider.
---
 ellama.el | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/ellama.el b/ellama.el
index a93a9ba42f..116af5a7d9 100644
--- a/ellama.el
+++ b/ellama.el
@@ -2664,10 +2664,14 @@ Call CALLBACK on result list of strings.  ARGS contains 
keys for fine control.
 (transient-define-suffix ellama-transient-set-provider ()
   "Set transient model to provider."
   (interactive)
-  (set (read
-   (completing-read "Select provider: "
-(mapcar #'prin1-to-string ellama-provider-list)))
-   (ellama-construct-ollama-provider-from-transient)))
+  (let ((provider (read
+  (completing-read "Select provider: "
+   (mapcar #'prin1-to-string 
ellama-provider-list)
+(set provider
+(ellama-construct-ollama-provider-from-transient))
+;; if you change `ellama-provider' you probably want to start new chat 
session
+(when (equal provider 'ellama-provider)
+  (setq ellama--current-session-id nil
 
 (transient-define-prefix ellama-select-ollama-model ()
   "Select ollama model."



[elpa] externals/org-gnosis updated (22a5e0fd82 -> 143909c32d)

2025-02-14 Thread ELPA Syncer
elpasync pushed a change to branch externals/org-gnosis.

  from  22a5e0fd82 docs: Add people to notify in the FSF assignment form.
   new  da2bec84ac [fix] insert-tags: Insert tags for nodes with id only.
   new  a42e10a5bf Version bump: 0.0.6
   new  143909c32d Change README to org-mode format.


Summary of changes:
 NEWS.org  | 7 +++
 README| 8 
 README.org| 9 +
 org-gnosis.el | 6 +++---
 4 files changed, 19 insertions(+), 11 deletions(-)
 delete mode 100644 README
 create mode 100644 README.org



[elpa] externals/org-gnosis da2bec84ac 1/3: [fix] insert-tags: Insert tags for nodes with id only.

2025-02-14 Thread ELPA Syncer
branch: externals/org-gnosis
commit da2bec84ac1d325d3e3cb0bf8cf908e9cf0bc3b1
Author: Thanos Apollo 
Commit: Thanos Apollo 

[fix] insert-tags: Insert tags for nodes with id only.
---
 org-gnosis.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/org-gnosis.el b/org-gnosis.el
index c814f9e2c9..6157206c95 100644
--- a/org-gnosis.el
+++ b/org-gnosis.el
@@ -489,8 +489,8 @@ If JOURNAL-P is non-nil, retrieve/create node as a journal 
entry."
(list (completing-read-multiple
  "Select tags (separated by ,): "
  (org-gnosis-select 'tag 'tags '1=1 t
-  (if (and (org-before-first-heading-p))
-  (mapc #'org-gnosis-insert-filetag tags)
+  (let ((id (org-gnosis-get-id)))
+(org-id-goto id)
 (org-set-tags tags)))
 
 ;;;###autoload



[elpa] externals/ellama 40a4680982 4/6: Convert Org mode content to Markdown before adding to context

2025-02-14 Thread ELPA Syncer
branch: externals/ellama
commit 40a4680982254a1a1fdea54fae52dae63f89275b
Author: Sergey Kostyaev 
Commit: Sergey Kostyaev 

Convert Org mode content to Markdown before adding to context

Added functionality to convert Org mode content to Markdown when
extracting buffer or file content for the context. This ensures that
any Org mode files are properly formatted as Markdown before being
processed further.
---
 ellama.el | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/ellama.el b/ellama.el
index 116af5a7d9..67301e5187 100644
--- a/ellama.el
+++ b/ellama.el
@@ -1115,7 +1115,11 @@ If EPHEMERAL non nil new session will not be associated 
with any file."
   "Extract the content of the context ELEMENT."
   (with-slots (name) element
 (with-current-buffer name
-  (buffer-substring-no-properties (point-min) (point-max)
+  (let* ((data (buffer-substring-no-properties (point-min) (point-max)))
+(content (if (derived-mode-p 'org-mode)
+ (ellama-convert-org-to-md data)
+   data)))
+   content
 
 (cl-defmethod ellama-context-element-display
   ((element ellama-context-element-buffer))
@@ -1189,7 +1193,11 @@ If EPHEMERAL non nil new session will not be associated 
with any file."
   (with-slots (name) element
 (with-temp-buffer
   (insert-file-contents name)
-  (buffer-substring-no-properties (point-min) (point-max)
+  (let* ((data (buffer-substring-no-properties (point-min) (point-max)))
+(ext (file-name-extension name)))
+   (if (string= ext "org")
+   (ellama-convert-org-to-md data)
+ data)
 
 (cl-defmethod ellama-context-element-display
   ((element ellama-context-element-file))
@@ -1503,7 +1511,10 @@ If EPHEMERAL non nil new session will not be associated 
with any file."
   "Add active region to context."
   (interactive)
   (if (region-active-p)
-  (let* ((content (buffer-substring-no-properties (region-beginning) 
(region-end)))
+  (let* ((data (buffer-substring-no-properties (region-beginning) 
(region-end)))
+(content (if (derived-mode-p 'org-mode)
+ (ellama-convert-org-to-md data)
+   data))
 (file-name (buffer-file-name))
 (buffer-name (buffer-name (current-buffer)))
  (element (if file-name



[elpa] externals/org-gnosis a42e10a5bf 2/3: Version bump: 0.0.6

2025-02-14 Thread ELPA Syncer
branch: externals/org-gnosis
commit a42e10a5bf10e11605e3b8f7b3453dff7d5087fd
Author: Thanos Apollo 
Commit: Thanos Apollo 

Version bump: 0.0.6

Minor update with bug fixes & documentation improvements:
  + Fixes insertion of tags issues
+ Tags are now inserted at the nearest heading with an ID, or as
  filetags if none found.
  + Update FSF assignment form in docs
---
 NEWS.org  | 7 +++
 org-gnosis.el | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/NEWS.org b/NEWS.org
index 6c4dcbe685..8a40e1a20c 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -8,6 +8,13 @@ This document contains the release notes that are included in 
each
 tagged commit on the project's main git repository:
 .
 
+* 0.0.6
+Minor update with bug fixes & documentation improvements:
+  + Fixes insertion of tags issues
++ Tags are now inserted at the nearest heading with an ID, or as
+  filetags if none found.
+  + Update FSF assignment form in docs
+
 * 0.0.5
 Minor update with documentation changes
   + Fix typos
diff --git a/org-gnosis.el b/org-gnosis.el
index 6157206c95..fbec7fdf4d 100644
--- a/org-gnosis.el
+++ b/org-gnosis.el
@@ -5,7 +5,7 @@
 ;; Author: Thanos Apollo 
 ;; Keywords: extensions
 ;; URL: https://thanosapollo.org/projects/org-gnosis/
-;; Version: 0.0.5
+;; Version: 0.0.6
 
 ;; Package-Requires: ((emacs "27.2") (emacsql "4.0.0") (compat "29.1.4.2"))
 



[nongnu] elpa/dirvish 8771edc00c: doc: update CHANGELOG

2025-02-14 Thread ELPA Syncer
branch: elpa/dirvish
commit 8771edc00cc7befefd9d65e218fa7a6a84f923cc
Author: Alex Lu 
Commit: Alex Lu 

doc: update CHANGELOG
---
 dirvish.el |  2 +-
 docs/CHANGELOG.org | 43 +++
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/dirvish.el b/dirvish.el
index b87247ba4c..9e5783bb6c 100644
--- a/dirvish.el
+++ b/dirvish.el
@@ -2,7 +2,7 @@
 ;; Copyright (C) 2021-2025 Alex Lu
 
 ;; Author : Alex Lu 
-;; Version: 2.0.53
+;; Version: 2.1.0
 ;; Keywords: files, convenience
 ;; Homepage: https://github.com/alexluigit/dirvish
 ;; SPDX-License-Identifier: GPL-3.0-or-later
diff --git a/docs/CHANGELOG.org b/docs/CHANGELOG.org
index a72eaa6b04..d24dd97bf7 100644
--- a/docs/CHANGELOG.org
+++ b/docs/CHANGELOG.org
@@ -1,3 +1,46 @@
+* 2.1.0
+
+** What's changed
+
++ Fixed incorrect vc states https://github.com/alexluigit/dirvish/issues/224
++ ~dirvish-hide-cursors~ and ~dirvish-hide-details~ now support list of symbols
++ A lot of window dedication issues fixed (#194 #258 #262 #264 #293)
++ Mode line errors (#233)
++ Modular directory data fetching (#162 #238)
++ Fixed image preview with ~dirvish-peek~.
++ Performance imporvements with ~dirvish-side~.
++ Respect ~dired-kill-when-opening-new-dired-buffer~.
++ Fixed compatibility issue with =find-dired=.
+
+** Fixes from community
+
++ Fix #158 : Delete emerge overlays when turning off the mode by @aikrahguzar 
in https://github.com/alexluigit/dirvish/pull/159
++ docs: fix some typos by @feltcat in 
https://github.com/alexluigit/dirvish/pull/176
++ fix(core): don't quote conditions in condition-case by @tarsius in 
https://github.com/alexluigit/dirvish/pull/206
++ add nerd-icons support by @rainstormstudio in 
https://github.com/alexluigit/dirvish/pull/201
++ fix(core): resolve emacs binary path in a more reliable way by @isamert in 
https://github.com/alexluigit/dirvish/pull/192
++ Report error from fd to user by @dvzubarev in 
https://github.com/alexluigit/dirvish/pull/178
++ Use rsync for local file copying in dirvish-rsync by @dvzubarev in 
https://github.com/alexluigit/dirvish/pull/180
++ Add rsync transient map by @dvzubarev in 
https://github.com/alexluigit/dirvish/pull/181
++ fd: add function that reads pattern from user by @dvzubarev in 
https://github.com/alexluigit/dirvish/pull/187
++ Update CUSTOMIZING.org by @liguangsheng in 
https://github.com/alexluigit/dirvish/pull/198
++ Fix an error: void-variable dv in Emacs-30.0.50 by @dvzubarev in 
https://github.com/alexluigit/dirvish/pull/251
++ Remove the restriction on printing for `dirvish-data-for-dir` by @isamert in 
https://github.com/alexluigit/dirvish/pull/266
++ Define new faces for all VC states by @protesilaos in 
https://github.com/alexluigit/dirvish/pull/222
++ fix(dired-noselect): Support both lists and strings by @jcf in 
https://github.com/alexluigit/dirvish/pull/257
++ subtree respect dired-omit-mode now by @eki3z in 
https://github.com/alexluigit/dirvish/pull/268
++ refactor(yank): rework copying r2r case for rsync by @dvzubarev in 
https://github.com/alexluigit/dirvish/pull/215
++ fix(subtree): "toggle or open" should open file, not view it by @brownts in 
https://github.com/alexluigit/dirvish/pull/281
++ fix(yank): silence byte-compiler by @tarsius in 
https://github.com/alexluigit/dirvish/pull/220
++ Fix typos by @tarsius in https://github.com/alexluigit/dirvish/pull/227
++ Fix custom type specifications by @tarsius in 
https://github.com/alexluigit/dirvish/pull/239
++ yank: fixes for recent r2r refactor commit by @dvzubarev in 
https://github.com/alexluigit/dirvish/pull/287
++ Fix broken link to purcell's emacs in EMACS-NEWCOMERS.org by @LV in 
https://github.com/alexluigit/dirvish/pull/278
++ docs: document the nil case for dirvish-default-layout. by @nicolas-graves 
in https://github.com/alexluigit/dirvish/pull/231
++ Split dirvish-yank--execute into two functions by @dvzubarev in 
https://github.com/alexluigit/dirvish/pull/290
++ fix: prevent killing emacsclient started on a directory by @prati0100 in 
https://github.com/alexluigit/dirvish/pull/293
++ perf(dirvish-peek): prevent redundant updates by tracking previous candidate 
by @zsxh in https://github.com/alexluigit/dirvish/pull/297
+
 * 2.0.53
 
 ** Breaking changes



[nongnu] elpa/helm d4c8296ddd 1/2: Minor fixes for previous commit

2025-02-14 Thread ELPA Syncer
branch: elpa/helm
commit d4c8296ddd3cbc32c1f60da95db4369397065669
Author: Thierry Volpiatto 
Commit: Thierry Volpiatto 

Minor fixes for previous commit
---
 helm-core.el | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/helm-core.el b/helm-core.el
index 0cf53ca02f..b793b73a7c 100644
--- a/helm-core.el
+++ b/helm-core.el
@@ -3552,8 +3552,9 @@ version < emacs-28."
   ;; Fallback to default when frames are not usable.
   (helm-default-display-buffer buffer)
 (setq helm--buffer-in-new-frame-p t)
-(let* ((px (car (window-absolute-pixel-position)))
-   (py (cdr (window-absolute-pixel-position)))
+(let* ((pos (window-absolute-pixel-position))
+   (px (car pos))
+   (py (cdr pos))
(half-screen-size (/ (display-pixel-height x-display-name) 2))
(frame-info (frame-geometry))
(screen-width (display-pixel-width x-display-name))
@@ -3572,10 +3573,8 @@ version < emacs-28."
  ;; lateral constraint to keep the frame inside of the screen
  (left . ,(cond ((> (+ px helm-frame-width) screen-width)
  (- screen-width helm-frame-width))
-((< (- px prmt-width) 0)
- 0)
-(t
- (- px prmt-width
+((< (- px prmt-width) 0) 0)
+(t (- px prmt-width
  ;; Try to put frame at the best possible place.
  ;; Frame should be below point if enough
  ;; place, otherwise above point and



[nongnu] elpa/typst-ts-mode 74eeca77b4 085/246: doc: update README

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 74eeca77b4aa6728a6af4293ced9f756a83a0bd3
Author: Meow King 
Commit: Meow King 

doc: update README
---
 README.md | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 819815990c..a9436b83a7 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,8 @@ Tree Sitter support for Typst. Minimum Emacs version 
requirement: 29.
 ![Static Badge](https://img.shields.io/badge/Made_with-Emacs-purple)
 
 [Discussion on Zulip](https://meow-place.zulipchat.com/)  
-[Tickets](https://todo.sr.ht/~meow_king/typst-ts-mode): issues, feature 
requests, etc.  
+[Tickets](https://todo.sr.ht/~meow_king/typst-ts-mode): Issues, feature 
requests, etc.  
+[Announce](https://lists.sr.ht/~meow_king/typst-ts-mode-announce) 
Announcements. Subscribe to it to receive the latest news for `typst-ts-mode`.
 [Send a Patch](https://lists.sr.ht/~meow_king/typst-ts-mode-dev)  
 
 ## Requirement
@@ -67,7 +68,10 @@ For reference, this is my configuration.
 (use-package typst-ts-mode
   :elpaca (:type git :host sourcehut :repo "meow_king/typst-ts-mode")
   :custom
+  ;; don't add "--open" if you'd like `watch` to be an error detector
   (typst-ts-mode-watch-options "--open")
+  
+  ;; experimental settings (I'm the main dev, so I enable these)
   (typst-ts-mode-enable-raw-blocks-highlight t)
   (typst-ts-mode-highlight-raw-blocks-at-startup t))
 ```
@@ -93,6 +97,7 @@ For customizable options: `customize` -> `typst-ts`.
 
 Here are some options you may find useful:  
 1. `typst-ts-mode-indent-offset` (default 4) and 
`typst-ts-mode-indent-offset-section` (default 2)  
+   Set `typst-ts-mode-indent-offset-section` to 0 to make the structure flat.
 2. `typst-ts-mode-executable-location`  
 3. `typst-ts-mode-watch-options`.  
Set this to `--open` so typst will open the compiled file for you.
@@ -124,6 +129,7 @@ Here are some options you may find useful:
rules.
 
 ### Raw block highlighting
+_This is an experimental feature_  
 Only support tree-sitter languages.  
 For more detailed documentation about raw block highlighting see 
 [this documentation](./doc/raw-block-highlighing.md)  



[nongnu] elpa/typst-ts-mode c92cdbe91b 015/246: feate: more precise font lock feature levels

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit c92cdbe91b7cb729b3f20178e858a0fea912babb
Author: Ziqi Yang 
Commit: Ziqi Yang 

feate: more precise font lock feature levels
---
 basic-syntax.typ | 22 +++---
 typst-ts-mode.el | 87 ++--
 2 files changed, 64 insertions(+), 45 deletions(-)

diff --git a/basic-syntax.typ b/basic-syntax.typ
index 0e2752cad4..11870e0bc8 100644
--- a/basic-syntax.typ
+++ b/basic-syntax.typ
@@ -4,7 +4,7 @@
 
 -? $ -> $ // shorthand
 
-// header face (current cannot cope with tailing comment)
+// header face
 = headline
 https://www.google.com // url
 _emph_ // emphasis
@@ -46,7 +46,7 @@ Hello\nWorld // escape
 #let a = b  // let
 #if b {} else {} // branch
 #while n < 10 { // while
-  (n,)
+(n,)
 }
 #for i in a {} // for
 #import "a": a, b // import
@@ -55,26 +55,26 @@ Hello\nWorld // escape
 #show: columns.with(2) // show
 #set text(a: 0) // set
 #let a() = { // return
-  return 2
+return 2
 }
 #for letter in "abc nope" { // flow
-  if letter == " " {
-break
-  } else if letter == "a" {
-continue
-  }
-  letter
+if letter == " " {
+break
+} else if letter == "a" {
+continue
+}
+letter
 }
 
 #a()() // function
 #range().map // builtin function
 #l.zip(r).map( // method
-  ((a,b)) => a + b // TODO lambda
+((a,b)) => a + b // TODO lambda
 )
 #(a, c: b) // tagged
 #a.b // field
 
-$a$ // math
+$ a $ // math
 $ 1 + 1 = 2 $
 $ E = m * c^2 $
 $ eq.not(0) $
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 897e26c8fe..d2b3ea163d 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -265,10 +265,8 @@
 ((shorthand) @typst-ts-shorthand-face)
 
 :language typst
-:feature markup
-((linebreak) @typst-ts-markup-linebreak-face
- (heading (text) @typst-ts-markup-header-face)
- (url) @typst-ts-markup-url-face
+:feature markup-basic
+((heading (text) @typst-ts-markup-header-face)
  (emph) @typst-ts-markup-emphasis-face
  (strong) @typst-ts-markup-strong-face
  (item "item" @typst-ts-markup-item-face)
@@ -277,7 +275,6 @@
   term: (text) @typst-ts-markup-term-term-face
   ":" @typst-ts-markup-term-indicator-face
   (text) @typst-ts-markup-term-description-face)
- (quote) @typst-ts-markup-quote-face
  (escape) @typst-ts-markup-escape-face
  (raw_span
   "`" @typst-ts-markup-rawspan-indicator-face
@@ -291,39 +288,30 @@
  (label) @typst-ts-markup-label-face ;; TODO more precise highlight 
(upstream)
  (ref) @typst-ts-markup-reference-face)
 
+:language typst
+:feature markup-standard
+((linebreak) @typst-ts-markup-linebreak-face
+ (quote) @typst-ts-markup-quote-face)
+
+:language typst
+:feature markup-extended
+((url) @typst-ts-markup-url-face)
+
+
 ;; please note that some feature there also in the math mode
 :language typst
-:feature code
+:feature code-basic
 ("#" @typst-ts-code-indicator-face
  ;; "end" @typst-ts-code-indicator-face ;; "end" is nothing but only a 
indicator
- (number) @font-lock-number-face
  (string) @font-lock-string-face
- (content ["[" "]"] @font-lock-punctuation-face)
- (builtin) @font-lock-builtin-face
  (bool) @font-lock-constant-face
  (none) @font-lock-constant-face
  (auto) @font-lock-constant-face
- (ident) @font-lock-variable-use-face
 
- ["(" ")" "{" "}"] @font-lock-punctuation-face
- ["," ";" ".." ":" "sep"] @font-lock-punctuation-face
- "assign" @font-lock-punctuation-face
- (field "." @font-lock-punctuation-face)
-
- ;; operator
  (in ["in" "not"] @font-lock-keyword-face)
  (and "and" @font-lock-keyword-face)
  (or "or" @font-lock-keyword-face)
  (not "not" @font-lock-keyword-face)
- (sign ["+" "-"] @font-lock-operator-face)
- (add "+" @font-lock-operator-face)
- (sub "-" @font-lock-operator-face)
- (mul "*" @font-lock-operator-face)
- (div "/" @font-lock-operator-face)
- (cmp ["==" "<=" ">=" "!=" "<" ">"] @font-lock-operator-face)
- (wildcard) @font-lock-operator-face
-
- ;; control
  (let "let" @font-lock-keyword-face)
  (branch ["if" "else"] @font-lock-keyword-face)
  (while "while" @font-lock-keyword-face)
@@ -336,7 +324,6 @@
  (return "return" @font-lock-keyword-face)
  (flow ["break" "continue"] @font-lock-keyword-face)
 
- ;; TODO lambda
  (call ;; function
   item: (ident) @font-lock-function-call-face)
  (call ;; method
@@ -345,16 +332,45 @@
  (field field: (ident) @font-lock-constant-face))
 
 :language typst
-:feature math
-((math "$" @typst-ts-math-indicator-face)
+:feature code-standard
+((ident) @font-lock-variable-use-face
+ (builtin) @font-lock-builtin-face)
 
- (fraction "/" @font-lock-operator-face)
+:language typst
+:feature code-extended ;; TODO lambda symbol
+((number) @font-lock-number-face
+
+ (content ["[" "]"] @font-lock-punc

[nongnu] branch elpa/typst-ts-mode created (now d4e4a21f13)

2025-02-14 Thread ELPA Syncer
elpasync pushed a change to branch elpa/typst-ts-mode.

at  d4e4a21f13 doc: update version header

This branch includes the following new commits:

   new  3a3c98107e init
   new  52d8241eca feat: add header faces
   new  879665683e feat: add more fontification rules for markup
   new  5ac2801aa1 feat: add tests and more faces for markup mode
   new  204202bfb1 feat: rawspan and rawblock in markup
   new  5e644c216d feat: label and reference fontify in markup
   new  adeb7bc795 feat: add operator for code
   new  6e5c7f112f feat: fontify control flow in code section
   new  2a27ed3bdc feat: add more fontification rules to code section
   new  5ee0e33683 feat: math fontification support
   new  ce4142e1ef feat: add electric auto pair pairs
   new  c4a3c02c07 feat: indentation rules
   new  d23140e91f feat: add imenu support
   new  1285fc3be5 feat: add a syntax table
   new  c92cdbe91b feate: more precise font lock feature levels
   new  bb9c2d7d61 feat: add convenient commands
   new  c059a85f9a feat: add preview command and fix after-compile hook 
issue
   new  01ef0d45b9 feat: better functionality for typst watch process
   new  bfff448d2a fix: deleting watch process window error when stop 
watching
   new  b16762cea1 doc: README
   new  ea69e2f7f6 fix: don't indent content inside raw block
   new  439deb4b07 fix(preview): open non-english character file name
   new  9d1adbcb09 feat: adopt update stream parser syntax change and add 
dynamic height for headers
   new  004ec9373b fix: `typst-ts-markup-header-scale` custom setting 
function error
   new  5ff1b21a51 fix(compilation + watch) error regexp error
   new  86492f0765 doc: update README
   new  4c26bf9185 doc: update README
   new  bbac54c3c0 doc: update README
   new  39a9e63c01 feat: Typst v0.9.0
   new  35b3e2fa34 feat: add error face
   new  7b3b3da743 doc: update README
   new  78cc859488 feat: add typst watch mode-line indicator
   new  361dfe6001 fix: allow dynamic indentation offset
   new  73f6273b13 feat: Incrase/Decrase heading level.
   new  ebdce771f3 doc: update README
   new  5700854a1e doc: update README
   new  53bc7cf2f1 doc(README): update co-maintainer information
   new  6a6ab91ff6 refactor: Refactored heading increase/decrease functions.
   new  21f263b341 doc: Fix flymake warnings.
   new  181caafe04 feat: Exchange current heading with above heading.
   new  b4b6444909 feat: Move heading and it contents down or up.
   new  3ba9c73723 doc: Added new feature and its keybinding to readme.
   new  14affa17e3 refactor: Renamed function that finds next higher/same 
level heading.
   new  946b056f32 feat: update to v0.10.0
   new  89ee073562 chore
   new  0d40d36cae Merge branch 'main' into feat/heading-operations
   new  33940994e1 refactor: typst-ts-mode-heading--at-point-p
   new  7485611871 style: change all tab into white space & add 
editorconfig file
   new  aad1cde153 refactor: Use outline library for headings.
   new  eb4bcb0a85 doc: update README
   new  6c0c55f4f2 feat: add indentation rule for item with linebreak at 
ending
   new  1c2b4bd6d9 feat: toggle indentation for list(item)
   new  dc4678aa5b fix(indentation): edge conditions
   new  645c08e917 fix: wrong list(item) indentation
   new  13d32bef2a fix: toggle indentation bug for list (item)
   new  70bcc7814b fix: toggle list(item) indentation on first line error
   new  7646790a96 feat: load embedding language settings dynamically
   new  208aa360d8 feat: almost done, have some bugs
   new  f43cba2548 feat: capable to correctly highlight regions
   new  7bdda683bb doc: README.md
   new  61ca4cfd1b feat: support raw block language name <-> tree sitter 
setting entry mapping
   new  cd6e40ff7a feat: enable highlighting at startup
   new  28b8da2f49 feat: add more predefined language settings
   new  5f3e28bee0 feat: add utility function to modify language tags 
relationship
   new  755615407a feat: add more predefined embedding language settings
   new  271cedb1de feat: add customization option to enable raw block 
highlighting
   new  f56803a36f feat(face): more flexible face settings for raw block
   new  7e3f11e675 feat: add detailed documentation
   new  fded764913 fix(els): remove language tag map duplication
   new  2dbf17da1a feat(face): more precise face for some markup elements
   new  8ab7a3e60d disable raw block highlighting by default
   new  f5797e219b refactor: introduce different level of fontification to 
address performance issue
   new  f997d273d1 fix: Item indentation fixed?
   new  4662986a55 feat: Autoincrement list or insert new heading.
   new  06a6c6f5df style: .dir-locals.el to turn off indent-tabs-mode
   new  d6cd6d7283 feat: Also a

[nongnu] elpa/typst-ts-mode 181caafe04 040/246: feat: Exchange current heading with above heading.

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 181caafe047813712505e3ff4590c0c686639987
Author: Huan Nguyen 
Commit: Huan Nguyen 

feat: Exchange current heading with above heading.
---
 typst-ts-mode.el | 110 +++
 1 file changed, 95 insertions(+), 15 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 42bbe652a1..3989302dd8 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -608,28 +608,108 @@ This does not handle #heading function."
(pcase direction
 ('right (concat heading-string "="))
 ('left (substring-no-properties heading-string 1 heading-level))
-(_ (error "%s is not one of: `LEFT' `RIGHT'" direction)))
+(_ (error "%s is not one of: `left' `right'" direction)))
+
+(defun typst-ts-mode-heading--same-or-higher (node traverse-fn)
+  "Return the first heading that is the same level or higher than NODE.
+`car' will be the found heading node.
+`cdr' will say if it is the same level or not.
+TRAVERSE-FN dictates in which direction to search.
+`treesit-node-next-sibling' for down.
+`treesit-node-prev-sibling' for up."
+  (let ((iterate (funcall traverse-fn node))
+   (level (typst-ts-mode-heading--level node))
+   (iterate-level nil))
+(while (and iterate
+   (not (and (string= (treesit-node-type iterate) "heading")
+ (or (= (setq
+ iterate-level ;; hack to make it not eval 
twice
+ (typst-ts-mode-heading--level iterate))
+level)
+ ;; parent heading or NODE was a leaf
+ (< iterate-level level)
+  (setq iterate (funcall traverse-fn iterate)))
+;; there are no level 0 heading
+(cons iterate (= (if iterate-level iterate-level 0) level
+
+(defun typst-ts-mode-heading--level (node)
+  "Get the level of the heading NODE.
+This functions does not check if NODE is actually a heading."
+  (length (treesit-node-text (treesit-node-child node 0
+
+(defun typst-ts-mode-heading--find-same-level (node traverse-fn)
+  "Return the first node with the same level as NODE.
+It will report a user-error when it could not find a node
+or it was blocked by its parent heading.
+See `typst-ts-mode-heading--same-or-higher' for TRAVERSE-FN."
+  (let* ((other-heading/level
+ (typst-ts-mode-heading--same-or-higher node traverse-fn)))
+(if (cdr other-heading/level)
+   (car other-heading/level)
+  (user-error "Could not find another heading"
+
+(defun typst-ts-mode-heading-up ()
+  (interactive)
+  (typst-ts-mode-meta--dwim 'up))
+
+(defun typst-ts-mode-heading--up (current-heading)
+  "Switch two heading of same level.
+CURRENT-HEADING and its content with above heading and its content."
+  (let* ((current-heading-start (treesit-node-start current-heading))
+(other-heading
+ (typst-ts-mode-heading--find-same-level
+  current-heading
+  #'treesit-node-prev-sibling))
+(other-heading-start (treesit-node-start other-heading))
+(other-heading-end (1- current-heading-start))
+(current-heading-end (car (typst-ts-mode-heading--same-or-higher
+   current-heading
+   #'treesit-node-next-sibling)))
+(current-heading-content nil)
+(other-heading-content
+ (buffer-substring other-heading-start
+   other-heading-end)))
+(setq current-heading-end (if current-heading-end
+ (1- (treesit-node-start current-heading-end))
+   (point-max)))
+(setq current-heading-content
+ (buffer-substring current-heading-start
+   current-heading-end))
+(delete-region other-heading-start current-heading-end)
+(goto-char other-heading-start)
+(if (= ?\n (aref current-heading-content
+(1- (length current-heading-content
+   (insert current-heading-content)
+  (insert (concat current-heading-content "\n")))
+(insert other-heading-content)))
 
 (defun typst-ts-mode-meta--dwim (direction)
   "Do something depending on the context with meta key + DIRECTION.
-`left': `typst-ts-mode-heading-decrease'
-`right': `typst-ts-mode-heading-increase'
+`left': `typst-ts-mode-heading-decrease'.
+`right': `typst-ts-mode-heading-increase'.
 When there is no relevant action to do it will execute the relevant function in
 the `GLOBAL-MAP' (example: `right-word')."
   (let ((heading (typst-ts-mode-heading--at-point-p))
-   (key nil))
+   ;; car function, cdr string of function for `substitute-command-keys'
+   (call-me/string
+(pcase direction
+  ('left
+   (cons (lambda (node) (typst-ts-mode-heading--increase/decrease
+ direction (treesit-node-child node 0)))
+ 

[nongnu] elpa/typst-ts-mode 7bdda683bb 060/246: doc: README.md

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 7bdda683bbd7d1d06681c6f0e3bb96793b16cc29
Author: Meow King 
Commit: Meow King 

doc: README.md
---
 README.md | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index c472bd24ed..de3ac6f60a 100644
--- a/README.md
+++ b/README.md
@@ -4,12 +4,9 @@ Tree Sitter support for Typst. Minimum Emacs version 
requirement: 29.
 
 ![Static Badge](https://img.shields.io/badge/Made_with-Emacs-purple)
 
-[Project Page](https://sr.ht/~meow_king/typst-mode)  
-[Home Page for this Package](https://git.sr.ht/~meow_king/typst-ts-mode)  
-[Send a Patch](https://lists.sr.ht/~meow_king/typst-ts-mode-dev)  
-[Discussion](https://lists.sr.ht/~meow_king/typst-ts-mode-discussion): 
Questions and Feedback  
+[Discussion on Zulip](https://meow-place.zulipchat.com/)  
 [Tickets](https://todo.sr.ht/~meow_king/typst-ts-mode): issues, feature 
requests, etc.  
-[Public Inbox](https://lists.sr.ht/~meow_king/public-inbox): General Consults
+[Send a Patch](https://lists.sr.ht/~meow_king/typst-ts-mode-dev)  
 
 ## Requirement
 



[nongnu] elpa/typst-ts-mode ea69e2f7f6 021/246: fix: don't indent content inside raw block

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit ea69e2f7f61708a8aebcddf2958fd65681f6439d
Author: Ziqi Yang 
Commit: Ziqi Yang 

fix: don't indent content inside raw block
---
 typst-ts-mode.el | 4 
 1 file changed, 4 insertions(+)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index cd69a03f6b..63d231cbf9 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -488,6 +488,10 @@ TYPES."
((parent-is "content") parent-bol ,offset)
((parent-is "group") parent-bol ,offset)
 
+   ;; don't indent raw block
+   ((and no-node ,(typst-ts-mode--ancestor-in (list "raw_blck")))
+no-indent 0)
+
((and no-node
  ,(typst-ts-mode--ancestor-in typst-ts-mode--bracket-node-types))
 ,(typst-ts-mode--ancestor-bol typst-ts-mode--bracket-node-types)



[nongnu] elpa/typst-ts-mode 0e4894ffcd 200/246: merge: fix: maarkup-extended font feature

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 0e4894ffcde658037529ac038882bd76e8603b78
Merge: 2a3fb8e577 075b450e44
Author: meowking 
Commit: meowking 

merge: fix: maarkup-extended font feature
---
 typst-ts-core.el|  73 
 typst-ts-editing.el | 195 ++--
 typst-ts-mode.el| 155 -
 3 files changed, 275 insertions(+), 148 deletions(-)

diff --git a/typst-ts-core.el b/typst-ts-core.el
index fab4ba780f..b5ab461e23 100644
--- a/typst-ts-core.el
+++ b/typst-ts-core.el
@@ -32,6 +32,15 @@
   :type 'natnum
   :group 'typst-ts)
 
+(defconst typst-ts-core--container-node-types
+  ;; '_math_group' here is because `treesit-parent-until' doesn't hanlde node 
type alias well
+  ;; TODO file a bug
+  '("block" "content" "group" "math" "_math_group"))
+
+(defconst typst-ts-mode--container-node-types-regexp
+  (regexp-opt typst-ts-core--container-node-types)
+  "Container node types regexp.")
+
 (defun typst-ts-core-column-at-pos (point)
   "Get the column at position POINT."
   (save-excursion
@@ -45,6 +54,14 @@
 (back-to-indentation)
 (point)))
 
+(defun typst-ts-core-line-bol-nonwhite-pos (&optional pos)
+  "POS."
+  (save-excursion
+(when pos
+  (goto-char pos))
+(back-to-indentation)
+(point)))
+
 (defun typst-ts-core-get-node-at-bol-nonwhite (&optional pos)
   "Get node at the first non-whitespace character at line beginning.
 If POS is given, operate on the line that POS locates at."
@@ -60,6 +77,62 @@ POS.  May return nil."
   (treesit-node-parent
(typst-ts-core-get-node-at-bol-nonwhite pos)))
 
+(defun typst-ts-core-for-lines-covered-by-node (node fn)
+  "Execute FN on all lines covered by NODE.
+Currently the effect of FN shouldn't change line number."
+  (let ((ns (treesit-node-start node))
+;; use line number not position since when editing, position of node 
end
+;; changes, but the information is not updated
+(ne-line-num (line-number-at-pos (treesit-node-end node
+(save-excursion
+  (goto-char ns)
+  (while (< (line-number-at-pos) ne-line-num)
+(funcall fn)
+(forward-line 1))
+  ;; in case the last line is the last line of buffer, we separate this
+  ;; operation from while loop
+  (funcall fn
+
+
+;; Emacs 29 doesn't support string type PRED, so this function is created for
+;; convenience
+(defun typst-ts-core-parent-util-type (node type &optional include-node 
same-context)
+  "See `treesit-parent-until'.
+TYPE is an regexp expression for matching types.
+SAME-CONTEXT: whether the parent should be in the current context with NODE.
+The following example means parent item node is in a different context with
+`hi' text node
+- #[
+hi
+]
+NODE TYPE INCLUDE-NODE see `treesit-parent-until'."
+  (let ((matched-node
+ (treesit-parent-until
+  node
+  (lambda (node)
+(let ((node-type (treesit-node-type node)))
+  (or (and same-context
+   (string-match-p
+typst-ts-mode--container-node-types-regexp node-type))
+  (string-match-p type node-type
+  include-node)))
+(when (and matched-node
+   (string-match-p type (treesit-node-type matched-node)))
+  matched-node)))
+
+(defun typst-ts-core-prev-sibling-ignore-types (node types)
+  "Find previous sibling node ignoring nodes whose type matches TYPES.
+NODE: current node.
+TYPES is an regexp expression."
+  (let* ((prev-node (treesit-node-prev-sibling node))
+ (prev-node-type (treesit-node-type prev-node)))
+(while (and prev-node-type
+(string-match-p types prev-node-type))
+  (setq
+   prev-node (treesit-node-prev-sibling prev-node)
+   prev-node-type (treesit-node-type prev-node)))
+prev-node))
+
 (defun typst-ts-core-node-get (node instructions)
   "Get things from NODE by INSTRUCTIONS.
 It's a copy of Emacs 30's `treesit-node-get' function."
diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index d757421513..e1c7edd6be 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -104,36 +104,80 @@ Using ARG argument will ignore the context and it will 
insert a heading instead.
   "Handle RET depends on condition.
 When prefix ARG is non-nil, call global return function."
   (interactive "P")
-  (let (execute-result node)
+  (let (execute-result)
 (unless current-prefix-arg
   (setq
execute-result
(catch 'execute-result
- (when-let* ((cur-pos (point))
- (cur-node (treesit-node-at cur-pos))
- (cur-node-type (treesit-node-type cur-node))
- (parent-node (treesit-node-parent cur-node))  ; could be 
nil
- (parent-node-type (treesit-node-type parent-node)))
+ (let* ((cur-pos (point))
+(cur-node (treesit-node-at cur-pos))
+(cur-node-t

[nongnu] elpa/typst-ts-mode 098abf17c8 233/246: Merge pull request 'Changed compile/preview behaviour and cleaned code' (#30) from vslavkin/typst-ts-mode:main into develop

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 098abf17c864c05c89fc84ca5093c1a03c33f8b8
Merge: d3e44b5361 131c404ee0
Author: Meow King 
Commit: Meow King 

Merge pull request 'Changed compile/preview behaviour and cleaned code' 
(#30) from vslavkin/typst-ts-mode:main into develop

Reviewed-on: https://codeberg.org/meow_king/typst-ts-mode/pulls/30
---
 typst-ts-compile.el   | 26 +++---
 typst-ts-mode.el  | 11 ++-
 typst-ts-transient.el |  2 +-
 3 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/typst-ts-compile.el b/typst-ts-compile.el
index 4c417fb3f1..59e6ad0b97 100644
--- a/typst-ts-compile.el
+++ b/typst-ts-compile.el
@@ -63,12 +63,12 @@ compilation buffer before compilation."
   (remove-hook 'compilation-finish-functions
(typst-ts-compile--compilation-finish-function 
cur-buffer)
 
-(defun typst-ts-compile (&optional arg)
+(defun typst-ts-compile (&optional preview)
   "Compile current typst file.
-When use a prefix argument, don't preview the document after compilation.
-ARG: prefix argument."
+When using a prefix argument or the optional argument PREVIEW,
+ preview the document after compilation."
   (interactive "P")
-  (unless arg
+  (when preview
 (add-hook 'compilation-finish-functions
   (typst-ts-mode-compile-and-preview--compilation-finish-function
(current-buffer
@@ -107,7 +107,7 @@ CUR-BUFFER: original typst buffer, in case user set
 buffer before compilation."
   (lambda (_b _msg)
 (unwind-protect
-(browse-url (typst-ts-compile-get-result-pdf-filename cur-buffer))
+(typst-ts-preview cur-buffer)
   (remove-hook 'compilation-finish-functions

(typst-ts-mode-compile-and-preview--compilation-finish-function cur-buffer)
 
@@ -116,12 +116,16 @@ buffer before compilation."
   "Compile & Preview.
 Assuming the compile output file name is in default style."
   (interactive)
-  ;; use a local variable version of `compilation-finish-functions' to shadow
-  ;; global version doesn't work
-  (add-hook 'compilation-finish-functions
-(typst-ts-mode-compile-and-preview--compilation-finish-function
- (current-buffer)))
-  (typst-ts-compile))
+  (typst-ts-compile t))
+
+;;;###autoload
+(defun typst-ts-preview (&optional buffer)
+  "Preview the typst document output.
+If BUFFER is passed, preview its output, otherwise use current buffer."
+  (interactive)
+  (unless buffer (setq buffer #'current-buffer))
+  (browse-url (typst-ts-compile-get-result-pdf-filename #'current-buffer))
+  )
 
 (defvar typst-ts-compilation-mode-error
   (cons (rx bol "error:" (+ not-newline) "\n" (+ blank) "┌─ "
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 9c3554abf5..5f5a1bace8 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -461,19 +461,12 @@ This function is meant to be used when user hits a return 
key."
   0)))
 
 
-;;;###autoload
-(defun typst-ts-mode-preview (file)
-  "Open the result compile file.
-FILE: file path for the result compile file."
-  (interactive (list (typst-ts-compile-get-result-pdf-filename)))
-  ;; don't use `browse-url-of-file', which cannot open non-english documents
-  (browse-url file))
-
 ;;;###autoload
 (defvar-keymap typst-ts-mode-map
   "C-c C-c" #'typst-ts-compile  ; use prefix argument to do preview
+  "C-c C-C" #'typst-ts-compile-and-preview
   "C-c C-w" #'typst-ts-watch-mode
-  "C-c C-p" #'typst-ts-mode-preview
+  "C-c C-p" #'typst-ts-preview
 
   "M-" #'typst-ts-mode-meta-left
   "M-" #'typst-ts-mode-meta-right
diff --git a/typst-ts-transient.el b/typst-ts-transient.el
index fbf21287fb..53f03cf7dd 100644
--- a/typst-ts-transient.el
+++ b/typst-ts-transient.el
@@ -31,7 +31,7 @@
 ("c" "compile & preview" typst-ts-compile-and-preview)
 ("C" "compile" typst-ts-compile)
 ("w" "watch" typst-ts-watch-mode)
-("p" "preview" typst-ts-mode-preview)]
+("p" "preview" typst-ts-preview)]
 
["Export"
 ("em" "markdown" typst-ts-mc-export-to-markdown)]



[nongnu] elpa/typst-ts-mode 3f5dba69fd 154/246: doc: README

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 3f5dba69fd30a555d2a3f5508d54af7cf58f39d3
Author: Meow King 
Commit: Meow King 

doc: README
---
 README.md | 146 ++
 highlight.compare.scm |  79 ---
 2 files changed, 5 insertions(+), 220 deletions(-)

diff --git a/README.md b/README.md
index 8ad2601200..95934f52ff 100644
--- a/README.md
+++ b/README.md
@@ -1,154 +1,18 @@
 # Typst Tree-Sitter Mode
 
-**NOTE** This package is migrated to 
[codeberg](https://codeberg.org/meow_king/typst-ts-mode)  
+> This package is migrated to 
[codeberg](https://codeberg.org/meow_king/typst-ts-mode)  
+>
+> The mirror of this package on other git forges like SourceHut or GitHub may 
not be updated or updated less frequently.  
 
-The mirror of this package on other git forges like SourceHut or GitHub may 
not be updated or updated less frequently.  
+Tree Sitter support for [Typst](https://github.com/typst/typst). Minimum Emacs 
version requirement: 29.  
 
-Tree Sitter support for Typst. Minimum Emacs version requirement: 29.  
-
-## Installation
-
-See [wiki](https://codeberg.org/meow_king/typst-ts-mode/wiki/Installation)
-
-
-(Document is currently under construction)
-
-## Keys
-
-**C-c C-c c**   : **typst-ts-compile-and-preview**  
-**C-c C-c C**   : **typst-ts-compile**  
-**C-c C-c w**   : **typst-ts-watch-mode**  
-**C-c C-c p**   : **typst-ts-mode-preview**  
-**M-\**  : **typst-ts-mode-heading-decrease**  
-**M-\** : **typst-ts-mode-heading-increase**  
-**M-\**: **typst-ts-mode-heading-up**  
-**M-\**  : **typst-ts-mode-heading-down**  
-**M-\**: **typst-ts-mode-meta-return**  
-**\**  : **typst-ts-mode-return**  
-**TAB** : **typst-ts-mode-cycle**  
-**C-c '**   : **typst-ts-edit-indirect** (requires 
)
-
-*NOTE*: `outline-minor-mode` is enabled by `typst-ts-mode`, so you can use 
command 
-defined by `outline-minor-mode` such as `outline-cycle`.
-
-## Customization Options
-
-You can view all the custom options in Emacs using `customize` command. Go to 
`typst-ts` group.  
-
-Here are some options you may find useful:  
-1. **typst-ts-mode-indent-offset** (default 4)  
-   If you want to have `org-indent-mode` like behavior, you can use 
[outline-indent-mode](https://sr.ht/~meow_king/outline-indent-mode/) plugin.
-2. **typst-ts-compile-executable-location**  
-   You can set a custom typst executable location.
-3. **typst-ts-watch-options**.  
-   Set this to `--open` so typst will automatically open the compiled file for 
you when you enter `typst-ts-watch-mode`.
-4. **typst-ts-compile-options**.  
-   Note that setting `--open` has no use for this customization variable. You 
can execute command `async-shell-command` and input `typst compile  
--open && sleep 1` to view what is happening. Use command 
`typst-ts-compile-and-preview` if you want to view the output document after 
compiling.
-5. **typst-ts-watch-auto-display-compilation-error**. (default `t`)  
-   This variable controls whether `typst watch` process buffer will appear 
when an error occurs, and disappear when there is no error.
-   You may find `auto-save-visited-mode`, 
[auto-save](https://github.com/manateelazycat/auto-save) or 
[super-save](https://github.com/bbatsov/super-save) useful (or annoying).
-6. **typst-ts-compile-before-compilation-hook** and 
**typst-ts-compile-after-compilation-hook**  
-7. **typst-ts-mode-grammar-location**: used for grammar version check at major 
mode start. Note it only check and compare the grammar file modification date.
-
-### Fontification
-1. **typst-ts-mode-fontification-precise-level** (default `'middle`)  
-   Available values: `min`, `middle` and `max`. Different level affects the 
precision
-   of the fontification. For example, to fontify `- item`, we may fontify the 
whole expression
-   using one face, or two faces (one for `-`, and one for `item`). Note it is 
related to the performance of fontification process, especially the first 
fontification process (when you open the file).  
-2. **typst-ts-markup-header-same-height** and **typst-ts-markup-header-scale** 
 
-   Control header height. Note that it only works when 
**typst-ts-mode-fontification-precise-level**
-   is set to `max`.
-3. Override default font lock rules  
-   Please see the documentation of **typst-ts-mode-font-lock-rules**, you can 
find 
-   how to override the whole font lock rules or only small part of the font 
lock
-   rules.
-
-### Raw block highlighting
-_This is an experimental feature_  
-Only support tree-sitter languages.  
-**Note**: Currently only support Emacs 30 (master branch). But non-treesit 
font lock for raw block feature will be added soon (both 29 and 30).  
-For more detailed documentation about raw block highlighting see 
-[this documentation](./doc/raw-block-highlighing.md)  
-1. **typst-ts-mode-enable-raw-blocks-highlight** (default `nil`)  
-2. **typst-ts-mode-highlight-r

[nongnu] elpa/typst-ts-mode 361dfe6001 033/246: fix: allow dynamic indentation offset

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 361dfe6001d5299547219a63381d70433877b926
Author: Ziqi Yang 
Commit: Ziqi Yang 

fix: allow dynamic indentation offset
---
 typst-ts-mode.el | 57 
 1 file changed, 28 insertions(+), 29 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 621f1ed9a8..71b8c88d2a 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -498,37 +498,36 @@ corresponding ancestor node.  Return nil if ancestor not 
matching."
 TYPES."
   (typst-ts-mode--ancestor-in types t))
 
-(defconst typst-ts-mode--indent-rules
+(defvar typst-ts-mode--indent-rules
   ;; you can set `treesit--indent-verbose' variable to t to see which 
indentation
   ;; rule matches.
-  (let ((offset typst-ts-mode-indent-offset))
-`((typst
-   ;; ((lambda (node parent bol)
-   ;;(message "%s %s %s" (treesit-node-type node) (treesit-node-type 
parent) bol)
-   ;;nil) parent-bol 0)
-
-   ((and (node-is ")") (parent-is "group")) parent-bol 0)
-   ((and (node-is "}") (parent-is "block")) parent-bol 0)
-   ((and (node-is "]") (parent-is "content")) parent-bol 0)
-
-   ((and (node-is "item") (parent-is "item")) parent-bol ,offset)
-
-   ((parent-is "block") parent-bol ,offset)
-   ((parent-is "content") parent-bol ,offset)
-   ((parent-is "group") parent-bol ,offset)
-
-   ;; don't indent raw block
-   ((and no-node ,(typst-ts-mode--ancestor-in (list "raw_blck")))
-no-indent 0)
-
-   ((and no-node
- ,(typst-ts-mode--ancestor-in typst-ts-mode--bracket-node-types))
-,(typst-ts-mode--ancestor-bol typst-ts-mode--bracket-node-types)
-,offset)
-
-   ((and no-node
- (not ,(typst-ts-mode--ancestor-in 
typst-ts-mode--bracket-node-types)))
-parent-bol 0
+  `((typst
+ ;; ((lambda (node parent bol)
+ ;;(message "%s %s %s" (treesit-node-type node) (treesit-node-type 
parent) bol)
+ ;;nil) parent-bol 0)
+
+ ((and (node-is ")") (parent-is "group")) parent-bol 0)
+ ((and (node-is "}") (parent-is "block")) parent-bol 0)
+ ((and (node-is "]") (parent-is "content")) parent-bol 0)
+
+ ((and (node-is "item") (parent-is "item")) parent-bol 
typst-ts-mode-indent-offset)
+
+ ((parent-is "block") parent-bol typst-ts-mode-indent-offset)
+ ((parent-is "content") parent-bol typst-ts-mode-indent-offset)
+ ((parent-is "group") parent-bol typst-ts-mode-indent-offset)
+
+ ;; don't indent raw block
+ ((and no-node ,(typst-ts-mode--ancestor-in (list "raw_blck")))
+  no-indent 0)
+
+ ((and no-node
+   ,(typst-ts-mode--ancestor-in typst-ts-mode--bracket-node-types))
+  ,(typst-ts-mode--ancestor-bol typst-ts-mode--bracket-node-types)
+  typst-ts-mode-indent-offset)
+
+ ((and no-node
+   (not ,(typst-ts-mode--ancestor-in 
typst-ts-mode--bracket-node-types)))
+  parent-bol 0)))
   "Tree-sitter indent rules for `rust-ts-mode'.")
 
 (defun typst-ts-mode-comment-setup()



[nongnu] elpa/typst-ts-mode f1ca0765e9 077/246: feat: Add customizable option for indenting section (header)

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit f1ca0765e9a92470d599fa4bf368cc620f980468
Author: Meow King 
Commit: Meow King 

feat: Add customizable option for indenting section (header)
---
 basic-syntax.typ| 130 ++--
 typst-ts-embedding-lang-settings.el |   4 -
 typst-ts-mode.el| 228 
 3 files changed, 215 insertions(+), 147 deletions(-)

diff --git a/basic-syntax.typ b/basic-syntax.typ
index ad85254c64..bf34ccd7a3 100644
--- a/basic-syntax.typ
+++ b/basic-syntax.typ
@@ -6,77 +6,77 @@
 
 // header face
 = headline
-https://www.google.com // url
-_emph_ // emphasis
-*strong* // strong
-- item // item
-/ term1: value
-"El Psy Kongraoo" // quote
-hello \ // line break
-`El Psy Kongraoo` // raw span
-// raw block
-```bash
+  https://www.google.com // url
+  _emph_ // emphasis
+  *strong* // strong
+  - item // item
+  / term1: value
+  "El Psy Kongraoo" // quote
+  hello \ // line break
+  `El Psy Kongraoo` // raw span
+  // raw block
+  ```bash
 sudo rm -rf *
 ```
- // label
-@reference // reference
+   // label
+  @reference // reference
 
-Hello\nWorld // escape
+  Hello\nWorld // escape
 
 
-#(4.2) // number
-#"El Psy Kongaroo" // string
-#[El Psy Kongraoo] // content
-#true #false  // boolean
-#sym.bar.h  // builtin
-#set text(a: 0) // call & builtin
-#none // none
-#auto // auto
-#(a + b) // ident
+  #(4.2) // number
+  #"El Psy Kongaroo" // string
+  #[El Psy Kongraoo] // content
+  #true #false  // boolean
+  #sym.bar.h  // builtin
+  #set text(a: 0) // call & builtin
+  #none // none
+  #auto // auto
+  #(a + b) // ident
 
-#(0 in "0" not in a) // in
-#(a and b or not c) // and, or, not
-#(2 + - 1) #(2 - -1) // sign
-#(1 + 1) // add
-#(1 - 1) // sub
-#(1 * 1) // mul
-#(1 / 1) // div
-#if 2 > 1 [] // cmp
-#import "a": * // wildcard
+  #(0 in "0" not in a) // in
+  #(a and b or not c) // and, or, not
+  #(2 + - 1) #(2 - -1) // sign
+  #(1 + 1) // add
+  #(1 - 1) // sub
+  #(1 * 1) // mul
+  #(1 / 1) // div
+  #if 2 > 1 [] // cmp
+  #import "a": * // wildcard
 
-#let a = b  // let
-#if b {} else {} // branch
-#while n < 10 { // while
-(n,)
-}
-#for i in a {} // for
-#import "a": a, b // import
-#import "a.lib" as b // as
-#include "a" // include
-#show: columns.with(2) // show
-#set text(a: 0) // set
-#let a() = { // return
-return 2
-}
-#for letter in "abc nope" { // flow
-if letter == " " {
-break
-} else if letter == "a" {
-continue
-}
-letter
-}
+  #let a = b  // let
+  #if b {} else {} // branch
+  #while n < 10 { // while
+  (n,)
+  }
+  #for i in a {} // for
+  #import "a": a, b // import
+  #import "a.lib" as b // as
+  #include "a" // include
+  #show: columns.with(2) // show
+  #set text(a: 0) // set
+  #let a() = { // return
+  return 2
+  }
+  #for letter in "abc nope" { // flow
+  if letter == " " {
+  break
+  } else if letter == "a" {
+  continue
+  }
+  letter
+  }
 
-#a()() // function
-#range().map // builtin function
-#l.zip(r).map( // method
-((a,b)) => a + b // TODO lambda
-)
-#(a, c: b) // tagged
-#a.b // field
+  #a()() // function
+  #range().map // builtin function
+  #l.zip(r).map( // method
+  ((a,b)) => a + b // TODO lambda
+  )
+  #(a, c: b) // tagged
+  #a.b // field
 
-$ a $ // math
-$ 1 + 1 = 2 $
-$ E = m * c^2 $
-$ eq.not(0) $
-$ cal(A) := { x in RR | x "is natural" } $
+  $ a $ // math
+  $ 1 + 1 = 2 $
+  $ E = m * c^2 $
+  $ eq.not(0) $
+  $ cal(A) := { x in RR | x "is natural" } $
diff --git a/typst-ts-embedding-lang-settings.el 
b/typst-ts-embedding-lang-settings.el
index 4627e83653..84783e8329 100644
--- a/typst-ts-embedding-lang-settings.el
+++ b/typst-ts-embedding-lang-settings.el
@@ -19,10 +19,6 @@
 
 ;; Functionality to embed other languages in typst documentation.
 
-;; NOTE:
-;; Raw block 'typc' tag cannot work as expected in typst code mode, it works in
-;; typst markup mode
-
 ;;; Code:
 (require 'treesit)
 
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 1e99976922..6741d66400 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -51,6 +51,13 @@
   :type 'integer
   :group 'typst-ts)
 
+
+(defcustom typst-ts-mode-indent-offset-section 2
+  "The indent offset for section.
+i.e. The a indentation offset after each header."
+  :type 'boolean
+  :group 'typst-ts)
+
 (defcustom typst-ts-mode-fontification-precision-level 'middle
   "Whether to use precise face fontification.
 Note that precise face fontification will case performance degrading.
@@ -91,14 +98,23 @@ The compile options will be passed to the end of
   :type 'boolean
   :group 'typst-ts)
 
-(defvar typst-ts-mode-before-compile-hook nil
-  "Hook runs after compile.")
+(defcustom typst-ts-mode-before-compile-hook nil
+  "Hook runs after compile."
+  :type 'hook
+  :group 'typst-ts)
 
-(defvar typst-ts-mode-after-compile-hook nil
+(defcustom typst-ts-mode-after-compile-hook nil
   "Hook runs after compile.
 Note the require

[nongnu] elpa/typst-ts-mode 7e3f11e675 068/246: feat: add detailed documentation

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 7e3f11e675a5c13323f0a64aa7cd3057277a854a
Author: Meow King 
Commit: Meow King 

feat: add detailed documentation
---
 README.md  |   8 ++
 ...block-highlighting-mechanism-explain-0.plantuml |  52 +
 .../raw-block-highlighting-mechanism-explain-0.png | Bin 0 -> 76229 bytes
 ...block-highlighting-mechanism-explain-1.plantuml |  64 +++
 .../raw-block-highlighting-mechanism-explain-1.png | Bin 0 -> 113446 bytes
 doc/raw-block-highlighing.md   |  66 +++
 typst-ts-embedding-lang-settings.el| 126 +++--
 typst-ts-mode.el   |  21 +---
 8 files changed, 256 insertions(+), 81 deletions(-)

diff --git a/README.md b/README.md
index de3ac6f60a..5f6ae564eb 100644
--- a/README.md
+++ b/README.md
@@ -106,6 +106,14 @@ because Typst itself do this style. You may find 
`auto-save-visited-mode`,
 6. `typst-ts-markup-header-same-height` and `typst-ts-markup-header-scale` to 
control header height. 
 7. `typst-ts-mode-before-compile-hook` and `typst-ts-mode-after-compile-hook`
 
+### Raw block highlighting
+
+For more detailed documentation about raw block highlighting see 
+[this documentation](./doc/raw-block-highlighing.md)  
+1. `typst-ts-mode-enable-raw-blocks-highlight` (default `t`)  
+2. `typst-ts-mode-highlight-raw-blocks-at-startup` (default `t`)  
+3. `typst-ts-highlight-raw-block-langs-not-in-predefined-settings` (default 
`t`)  
+
 ### Consult Imenu Integration
 If you use `consult-iemnu`
 command [consult](https://github.com/minad/consult), you way want this setting.
diff --git a/assets/raw-block-highlighting-mechanism-explain-0.plantuml 
b/assets/raw-block-highlighting-mechanism-explain-0.plantuml
new file mode 100644
index 00..4ab4c34b6a
--- /dev/null
+++ b/assets/raw-block-highlighting-mechanism-explain-0.plantuml
@@ -0,0 +1,52 @@
+@startuml
+start
+floating note
+purple: built-in functions / variables
+blue: typst-ts-mode functions / variable
+red: typst-ts-mode raw block configuration variables
+end note
+
+partition customization {
+  :typst-ts-els-lang-tags-map: used in 
treesit-language-at-point-function
+  typst-ts-els-tag-lang-map: used in 
treesit-range-settings
+  typst-ts-embedding-lang-settings;
+  
+  note right
+  use function typst-ts-els--add-lang-tags-relationship and
+  function typst-ts-els--lang-name-remap to change 
variables
+  typst-ts-els-lang-tags-map and 
typst-ts-els-tag-lang-map
+  
+  use shortdoc to search for alist 
related
+  functions to modifiy typst-ts-embedding-lang-settings
+  end note
+}
+
+partition mode initialization {
+  :create typst tree sitter parser;
+  
+  if ( typst-ts-mode-enable-raw-blocks-highlight) is (t) 
then
+  :add typst-ts-els-include-dynamically function to
+  parser notification functions list;
+
+  note right
+  so typst-ts-els-include-dynamically will receive buffer
+  change notification
+  end note
+
+  :set treesit-language-at-point-function and 
treesit-range-settings;
+  
+  note right
+  They are used to create tree sitter parsers. Moreover,
+  treesit-range-settings defined which area these parser
+  will act on.
+  end note
+  
+  :run hooks (functions added in typst-ts-mode-hook);
+
+  if ( typst-ts-mode-highlight-raw-blocks-at-startup) is (t) then
+  :load and merge predefined settings from variable
+  typst-ts-embedding-lang-settings;
+  endif
+  endif
+}
+@enduml
diff --git a/assets/raw-block-highlighting-mechanism-explain-0.png 
b/assets/raw-block-highlighting-mechanism-explain-0.png
new file mode 100644
index 00..e87d0533ad
Binary files /dev/null and 
b/assets/raw-block-highlighting-mechanism-explain-0.png differ
diff --git a/assets/raw-block-highlighting-mechanism-explain-1.plantuml 
b/assets/raw-block-highlighting-mechanism-explain-1.plantuml
new file mode 100644
index 00..67fee33a8b
--- /dev/null
+++ b/assets/raw-block-highlighting-mechanism-explain-1.plantuml
@@ -0,0 +1,64 @@
+@startuml
+
+floating note
+purple: built-in functions / variables
+blue: typst-ts-mode functions / variable
+red: typst-ts-mode raw block configuration variables
+end note
+
+partition editing {
+  if ( typst-ts-mode-enable-raw-blocks-highlight) is (t) 
then
+fork
+  partition function: 
treesit-language-at-point-function {
+floating note: i.e. 
typst-ts-mode--language-at-point
+:raw block tag (**ignore case**) will be converted to tree sitter
+language symbol via typst-ts-els-tag-lang-map;
+if (langauge symbol in map) is (nil) then
+  :use language symbol **typst**;
+endif
+  }
+
+  if (language symbol **not** in treesit-range-settings
+  and dynamic library file for language is loaded) then
+:treesit will create a toplevel parser of that language;
+note left
+  which is what we don't want, since it will mess the foncication
+  (i.e. highlight area outs

[nongnu] elpa/typst-ts-mode 364d32c37d 119/246: refactor: Typst watch is now a minor mode.

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 364d32c37de591191a98a3e521e64df6aebe88e2
Author: Huan Nguyen 
Commit: Huan Nguyen 

refactor: Typst watch is now a minor mode.
---
 typst-ts-mode.el   | 140 +
 typst-ts-watch-mode.el | 139 
 2 files changed, 141 insertions(+), 138 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 3a4c95f474..113458ed36 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -36,6 +36,7 @@
 (require 'typst-ts-embedding-lang-settings)
 (require 'typst-ts-utils)
 (require 'typst-ts-faces)
+(require 'typst-ts-watch-mode)
 
 (defgroup typst-ts nil
   "Tree Sitter enabled Typst Writing."
@@ -109,53 +110,6 @@ the current buffer."
   :type 'hook
   :group 'typst-ts)
 
-(defcustom typst-ts-mode-watch-options ""
-  "User defined compile options for `typst-ts-mode-watch'.
-The compile options will be passed to the
-` watch ' sub-command."
-  :type 'string
-  :group 'typst-ts)
-
-(defcustom typst-ts-mode-watch-modeline-indicator-enable t
-  "Whether to enable mode line indicator for typst watch."
-  :type 'boolean
-  :group 'typst-ts)
-
-(defcustom typst-ts-mode-watch-modeline-indicator "[Watch]"
-  "Modeline indicator for typst watch."
-  :type 'string
-  :group 'typst-ts)
-
-(defcustom typst-ts-mode-watch-process-name "*Typst-Watch*"
-  "Process name for `typst watch' sub-command."
-  :type 'string
-  :group 'typst-ts)
-
-(defcustom typst-ts-mode-watch-process-buffer-name "*Typst-Watch*"
-  "Process buffer name for `typst watch' sub-command."
-  :type 'string
-  :group 'typst-ts)
-
-(defcustom typst-ts-mode-display-watch-process-bufer-automatically t
-  "Whether the typst watch process buffer should be displayed automatically.
-This means the buffer will be displayed when error occurs, hide when error
-is eliminated."
-  :type 'boolean
-  :group 'typst-ts)
-
-(defcustom typst-ts-mode-display-watch-process-buffer-parameters
-  `(display-buffer-at-bottom
-(window-height . fit-window-to-buffer))
-  "Display buffer parameters."
-  :type 'symbol
-  :group 'typst-ts)
-
-(defvar typst-ts-mode-before-watch-hook nil
-  "Hook runs after compile.")
-
-(defvar typst-ts-mode-after-watch-hook nil
-  "Hook runs after compile.")
-
 ;; 
==
 ;; TODO typst has three modes (namely 'markup', 'code' and 'math')
 ;; Currently only add common settings to syntax table
@@ -973,96 +927,6 @@ Assuming the compile output file name is in default style."
  (current-buffer)))
   (typst-ts-mode-compile))
 
-(defun typst-ts-mode--watch-process-filter (proc output)
-  "Filter the `typst watch' process output.
-Only error will be transported to the process buffer.
-See `(info \"(elisp) Filter Functions\")'.
-PROC: process; OUTPUT: new output from PROC."
-  (when (buffer-live-p (process-buffer proc))
-(with-current-buffer (process-buffer proc)
-  (erase-buffer)
-  (let ((window (get-buffer-window))
-(re (rx bol "error:" (+ not-newline) "\n" (+ blank) "┌─ "
-(+ not-newline) ":"  ; file
-(+ num) ":"  ; start-line
-(+ num) "\n"  ; start-col
-(+ (+ (or blank num)) "│" (* not-newline) "\n")))
-(next-match-start-pos 0)
-res-output)
-(while (string-match re output next-match-start-pos)
-  (setq res-output (concat
-res-output
-(when res-output "\n")
-(substring output (match-beginning 0) (match-end 
0)))
-next-match-start-pos (match-end 0)))
-;; Insert the Error text
-(if (not res-output)
-(when (and typst-ts-mode-display-watch-process-bufer-automatically 
window)
-  (delete-window window))
-  (insert res-output)
-  (goto-char (point-min))
-  (when typst-ts-mode-display-watch-process-bufer-automatically
-(typst-ts-mode-display-watch-buffer)))
-
-;;;###autoload
-(defun typst-ts-mode-display-watch-buffer ()
-  "Display typst watch process buffer."
-  (interactive)
-  (if (not (buffer-live-p (get-buffer 
typst-ts-mode-watch-process-buffer-name)))
-  (user-error "The typst watch process buffer %s is not alive!" 
typst-ts-mode-watch-process-buffer-name)
-(display-buffer
- typst-ts-mode-watch-process-buffer-name
- typst-ts-mode-display-watch-process-buffer-parameters)))
-
-;;;###autoload
-(defun typst-ts-mode-watch ()
-  "Watch(hot compile) current typst file."
-  (interactive)
-  (run-hooks typst-ts-mode-before-watch-hook)
-  (with-current-buffer (get-buffer-create 
typst-ts-mode-watch-process-buffer-name)
-(erase-buffer)
-(unless (eq major-mode 'typst-ts-compilation-mode)
-  (typst-ts-compilation-mode)
-  (read-only-mode -1)))
-  (set-process-filter
-   (start-process-shell-command
-t

[nongnu] elpa/typst-ts-mode 3d373bba6f 095/246: fix: fix outline recognization error when section indent offset is not nil

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 3d373bba6f2ecfc2e53ad23d5e43e7f87a8061df
Author: Meow King 
Commit: Meow King 

fix: fix outline recognization error when section indent offset is not nil

JJ:
---
 typst-ts-mode.el | 23 +--
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index c6063c6319..a7f7a08cc4 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -989,29 +989,22 @@ buffer before compilation."
 
 ;; outline-minor-mode 

 
-(defconst typst-ts-mode-outline-regexp "=+ "
+(defconst typst-ts-mode-outline-regexp "^[[:space:]]*\\(=+\\) "
   "Regexp identifying Typst header.")
 
 (defun typst-ts-mode-outline-level ()
   "Return the level of the heading at point."
   (save-excursion
 (end-of-line)
-(if (re-search-backward "^=+ " nil t)
-   (1- (- (match-end 0) (match-beginning 0)))
+(if (re-search-backward typst-ts-mode-outline-regexp nil t)
+ (- (match-end 1) (match-beginning 1))
   0)))
 
-(defconst typst-ts-mode-outline-heading-alist
-  '(("= " . 1)
-("== " . 2)
-("=== " . 3)
-(" " . 4)
-("= " . 5)))
-
 (defun typst-ts-mode-heading--at-point-p ()
   "Whether the current line is a heading.
 Return the heading node when yes otherwise nil."
   (let ((node (treesit-node-parent
-  (treesit-node-at
+(treesit-node-at
 (save-excursion
   (beginning-of-line-text)
   (point))
@@ -1569,9 +1562,11 @@ nil and parbreak."
   '(typst)
 
   ;; Outline
-  (setq-local outline-regexp typst-ts-mode-outline-regexp)
-  (setq-local outline-level #'typst-ts-mode-outline-level)
-  (setq-local outline-heading-alist typst-ts-mode-outline-heading-alist)
+  (if nil  ; (>= emacs-major-version 30)
+  ;; FIXME maybe it's a upstream bug. Circle top-level section will cycle 
all the content below
+  (setq treesit-outline-predicate (regexp-opt '("section" "source_file")))
+(setq-local outline-regexp typst-ts-mode-outline-regexp)
+(setq-local outline-level #'typst-ts-mode-outline-level))
   ;; Although without enabling `outline-minor-mode' also works, enabling it
   ;; provides outline ellipsis
   ;; TODO test remove it or add it to after-hook



[nongnu] elpa/typst-ts-mode 147b4d6885 192/246: fix(editing): typst-ts-mode-return end of buffer situation

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 147b4d6885de924b737631e8660d5e560b1ddc47
Author: meowking 
Commit: meowking 

fix(editing): typst-ts-mode-return end of buffer situation

or next line is the end line (no newline character)
---
 typst-ts-editing.el | 26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index e7d9056dcb..8c6cdda2dc 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -121,17 +121,22 @@ When prefix ARG is non-nil, call global return function."
 ((and (eolp)
   (setq node 
(typst-ts-core-get-parent-of-node-at-bol-nonwhite))
   (equal (treesit-node-type node) "item"))
- (let* ((child-node (treesit-node-child node 1))
+ (let* ((item-node node)
+(child-node (treesit-node-child item-node 1))
+(next-line-node
+ (typst-ts-core-get-parent-of-node-at-bol-nonwhite
+  (save-excursion
+(forward-line 1)
+(point
 (next-line-node-type
- (treesit-node-type
-  (typst-ts-core-get-parent-of-node-at-bol-nonwhite
-   (save-excursion
- (forward-line 1)
- (point))
+ (treesit-node-type next-line-node)))
(if child-node
-   (if (not (equal next-line-node-type "item"))
-   (typst-ts-mode-insert--item node)
- (call-interactively #'newline))
+   (if (and (equal next-line-node-type "item")
+;; end of buffer situation (or next line is the end
+;; line (no newline character))
+(not (equal next-line-node item-node)))
+   (call-interactively #'newline)
+ (typst-ts-mode-insert--item item-node))
  ;; no text means delete the item on current line: (item -)
  (beginning-of-line)
  (kill-line)
@@ -154,8 +159,7 @@ When prefix ARG is non-nil, call global return function."
 ;; execute default action if not successful
 (unless (eq execute-result 'success)
   ;; we only need to look for global keybinding, see `(elisp) Active 
Keymaps'
-  (let ((global-ret-function
- (global-key-binding (kbd "RET"
+  (let ((global-ret-function (global-key-binding (kbd "RET"
 (if (not current-prefix-arg)
 (call-interactively global-ret-function)
   (if (yes-or-no-p



[nongnu] elpa/typst-ts-mode 014a88d447 210/246: fix: typst-ts-mode-font-lock-rules -> math-extended feature

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 014a88d4477aa9b8531fb792b44165d69edaf167
Author: meowking 
Commit: meowking 

fix: typst-ts-mode-font-lock-rules -> math-extended feature
---
 typst-ts-mode.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index ea4777f927..a748931093 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -295,7 +295,8 @@ If you want to customize the rules, please customize the 
same name variable
 
   :language typst
   :feature markup-extended
-  ,@typst-ts-mode-font-lock-rules-markup-extended
+  ,@(when typst-ts-mode-font-lock-rules-markup-extended
+  (list typst-ts-mode-font-lock-rules-markup-extended))
 
   ;; please note that some feature there also in the math mode
   :language typst



[nongnu] elpa/typst-ts-mode d8c64a99f4 150/246: docs: fix typo

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit d8c64a99f4729ab06a624c30656257fafe446893
Author: Meow King 
Commit: Meow King 

docs: fix typo
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index c7beaefeb9..36d8b8bc45 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Tree Sitter support for Typst. Minimum Emacs version 
requirement: 29.
 
 [Discussion on Zulip](https://meow-place.zulipchat.com/)  
 [Tickets](https://todo.sr.ht/~meow_king/typst-ts-mode): Issues, feature 
requests, etc.  
-[Announce](https://lists.sr.ht/~meow_king/typst-ts-mode-announce) 
Announcements. Subscribe to it to receive the latest news for `typst-ts-mode`.  
+[Announce](https://lists.sr.ht/~meow_king/typst-ts-mode-announce) 
Announcements. Subscribe to it to receive the latest news from `typst-ts-mode`. 
 
 [Send a Patch](https://lists.sr.ht/~meow_king/typst-ts-mode-dev)  
 
 ## Requirement



[nongnu] elpa/typst-ts-mode d2691f1e9c 112/246: refactor: revert 3f8c4abc15543cb1e6870045f158f92f04cf396f change

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit d2691f1e9c9a1d2a69dcdd1c1ce64ed9c5e51bd1
Author: Meow King 
Commit: Meow King 

refactor: revert 3f8c4abc15543cb1e6870045f158f92f04cf396f change
---
 typst-ts-mode.el | 21 -
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 361a5a2055..2a9117e19d 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -1114,17 +1114,6 @@ return the node that is one character left from the end 
of line."
  (goto-char (1- (pos-eol)
   (point)
 
-(defun typst-ts-mode--item-escape-p ()
-  "Does the end have an escape?"
-  (string= (treesit-node-type
-(treesit-node-at
- (save-excursion
-   ;; like back-to-indentation but for trailing lines at the end
-   (move-end-of-line nil)
-   (re-search-backward "^\\|[^[:space:]]")
-   (point
-   "escape"))
-
 (defun typst-ts-mode-meta-return (&optional arg)
   "Depending on context, insert a heading or insert an item.
 The new heading is created after the ending of current heading.
@@ -1133,8 +1122,7 @@ Using ARG argument will ignore the context and it will 
insert a heading instead.
   (let ((node (typst-ts-mode--item-on-line-p)))
 (cond
  (arg (typst-ts-mode-insert--heading nil))
- ((and (string= (treesit-node-type node) "item")
-   (not (typst-ts-mode--item-escape-p)))
+ ((string= (treesit-node-type node) "item")
   (typst-ts-mode-insert--item node))
  (t
   (typst-ts-mode-insert--heading node)
@@ -1157,8 +1145,7 @@ When prefix ARG is non-nil, call global return function."
   ;; on item node end
   ((and (eolp)
 (setq node (typst-ts-mode--item-on-line-p))
-(and (string= (treesit-node-type node) "item")
- (not (typst-ts-mode--item-escape-p)))
+(string= (treesit-node-type node) "item")
 (not (string= (treesit-node-get node '((child -1 nil) (type))) 
"linebreak")))
(if (> (treesit-node-child-count node) 1)
(typst-ts-mode-insert--item node)
@@ -1186,8 +1173,8 @@ When prefix ARG is non-nil, call global return function."
 NODE must be an item node!
 This function respects indentation."
   (let* (;; +, -, or .
-(item-type (treesit-node-text
-(treesit-node-child node 0)))
+  (item-type (treesit-node-text
+  (treesit-node-child node 0)))
  (item-number (string-to-number item-type))
  (item-end (treesit-node-end node))
  (node-bol-column (typst-ts-mode-column-at-pos



[nongnu] elpa/typst-ts-mode 3394ec08dc 179/246: chore

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 3394ec08dc4fca78db37199af29ec3528e18edd1
Author: Meow King 
Commit: Meow King 

chore
---
 typst-ts-mode.el | 5 +
 1 file changed, 5 insertions(+)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 2dc59b9b21..f386fbc509 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -613,6 +613,11 @@ FILE: file path for the result compile file."
   "M-" #'typst-ts-mode-heading-up
   "M-" #'typst-ts-mode-meta-return
   
+  ;; don't bind 
+  ;; Binding a command to "" is generally a bug.
+  ;; Emacs will first look for a binding for `return` and if it finds one
+  ;; it'll use it in preference to a binding for `RET`, regardless of the
+  ;; relative precedence of the keymaps involved.
   "TAB" #'typst-ts-mode-cycle
   "RET" #'typst-ts-mode-return
   "C-c '" #'typst-ts-edit-indirect)



[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

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 7c01c6821cbffd01b8d88e95b21a808cad053686
Merge: 743f05267b 154640e61c
Author: Meow King 
Commit: Meow King 

Merge pull request 'Add an option to customize the preview function.' (#36) 
from tkpapp/typst-ts-mode:tp/customize-preview-function into develop

Reviewed-on: https://codeberg.org/meow_king/typst-ts-mode/pulls/36
---
 typst-ts-compile.el | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/typst-ts-compile.el b/typst-ts-compile.el
index 72173db15e..6c73c68d24 100644
--- a/typst-ts-compile.el
+++ b/typst-ts-compile.el
@@ -118,12 +118,17 @@ Assuming the compile output file name is in default 
style."
   (interactive)
   (typst-ts-compile t))
 
+(defcustom typst-ts-mode-preview-function 'browse-url
+  "Function that opens PDF documents for preview."
+  :type 'function
+  :group 'typst-ts)
+
 ;;;###autoload
 (defun typst-ts-preview (&optional buffer)
   "Preview the typst document output.
 If BUFFER is passed, preview its output, otherwise use current buffer."
   (interactive)
-  (browse-url (typst-ts-compile-get-result-pdf-filename buffer)))
+  (funcall typst-ts-mode-preview-function 
(typst-ts-compile-get-result-pdf-filename buffer)))
 
 (defvar typst-ts-compilation-mode-error
   (cons (rx bol "error:" (+ not-newline) "\n" (+ blank) "┌─ "



[nongnu] elpa/typst-ts-mode 96f587be97 086/246: doc: update README

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 96f587be978d22401502c8cf8159e74b14edd77c
Author: Meow King 
Commit: Meow King 

doc: update README
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index a9436b83a7..c067eba15d 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ Tree Sitter support for Typst. Minimum Emacs version 
requirement: 29.
 
 [Discussion on Zulip](https://meow-place.zulipchat.com/)  
 [Tickets](https://todo.sr.ht/~meow_king/typst-ts-mode): Issues, feature 
requests, etc.  
-[Announce](https://lists.sr.ht/~meow_king/typst-ts-mode-announce) 
Announcements. Subscribe to it to receive the latest news for `typst-ts-mode`.
+[Announce](https://lists.sr.ht/~meow_king/typst-ts-mode-announce) 
Announcements. Subscribe to it to receive the latest news for `typst-ts-mode`.  
 [Send a Patch](https://lists.sr.ht/~meow_king/typst-ts-mode-dev)  
 
 ## Requirement



[nongnu] elpa/typst-ts-mode 0728efcbd9 176/246: refactor

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 0728efcbd94420753a813d538855b4f7168fdfcd
Author: Meow King 
Commit: Meow King 

refactor
---
 typst-ts-core.el| 18 +-
 typst-ts-editing.el |  8 +++-
 typst-ts-mode.el|  4 
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/typst-ts-core.el b/typst-ts-core.el
index 8b7b5fd9e3..fab4ba780f 100644
--- a/typst-ts-core.el
+++ b/typst-ts-core.el
@@ -27,6 +27,11 @@
 ;; code from Emacs binary
 (declare-function treesit-parser-list "treesit" t t)
 
+(defcustom typst-ts-mode-indent-offset 4
+  "Number of spaces for each indentation step in `typst-ts-mode'."
+  :type 'natnum
+  :group 'typst-ts)
+
 (defun typst-ts-core-column-at-pos (point)
   "Get the column at position POINT."
   (save-excursion
@@ -40,17 +45,20 @@
 (back-to-indentation)
 (point)))
 
-(defun typst-ts-core-get-node-at-bol-nonwhite ()
-  "Get node at the first non-whitespace character at line beginning."
+(defun typst-ts-core-get-node-at-bol-nonwhite (&optional pos)
+  "Get node at the first non-whitespace character at line beginning.
+If POS is given, operate on the line that POS locates at."
   (save-excursion
+(when pos
+  (goto-char pos))
 (back-to-indentation)
 (treesit-node-at (point
 
-(defun typst-ts-core-get-parent-of-node-at-bol-nonwhite ()
+(defun typst-ts-core-get-parent-of-node-at-bol-nonwhite (&optional pos)
   "See `typst-ts-core-get-node-at-bol-nonwhite'.
-May return nil."
+POS.  May return nil."
   (treesit-node-parent
-   (typst-ts-core-get-node-at-bol-nonwhite)))
+   (typst-ts-core-get-node-at-bol-nonwhite pos)))
 
 (defun typst-ts-core-node-get (node instructions)
   "Get things from NODE by INSTRUCTIONS.
diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index 33febea742..d9fc4365a7 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -239,10 +239,9 @@ When there is no section it will insert a heading below 
point."
   (goto-char prev-nonwhite-pos)
   (back-to-indentation)
   (point)))
-   (prev-nonwhite-line-heading-node
-(treesit-node-at prev-nonwhite-line-bol))
-   (prev-nonwhite-line-top-node (treesit-node-parent
- 
prev-nonwhite-line-heading-node))
+   (prev-nonwhite-line-top-node
+(treesit-node-parent
+ (treesit-node-at prev-nonwhite-line-bol)))
(cur-line-bol-column (typst-ts-core-column-at-pos 
cur-line-bol))
(prev-nonwhite-line-bol-column
 (typst-ts-core-column-at-pos prev-nonwhite-line-bol)))
@@ -251,7 +250,6 @@ When there is no section it will insert a heading below 
point."
   ;; 2. psy| <- can toggle indent
   ((and
 (equal (treesit-node-type prev-nonwhite-line-top-node) "item")
-(equal (treesit-node-type prev-nonwhite-line-heading-node) "-")
 ;; previous nonwhite-line ending is not '\' character
 (not (equal (treesit-node-type prev-nonwhite-line-node) 
"linebreak")))
;; TODO cycle all its children
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 63b3c3c298..2dc59b9b21 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -50,10 +50,6 @@
   :group 'text
   :group 'languages)
 
-(defcustom typst-ts-mode-indent-offset 4
-  "Number of spaces for each indentation step in `typst-ts-mode'."
-  :type 'natnum
-  :group 'typst-ts)
 
 (defcustom typst-ts-mode-grammar-location nil
   "Specify typst tree sitter grammar file location.



[nongnu] elpa/typst-ts-mode 6b54ff7084 175/246: refactor: remove `typst-ts-mode--item-on-line-p` function

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 6b54ff70849cc67996bd82316b666c7bc34a44d4
Author: Meow King 
Commit: Meow King 

refactor: remove `typst-ts-mode--item-on-line-p` function
---
 typst-ts-core.el| 13 -
 typst-ts-editing.el | 33 ++---
 2 files changed, 18 insertions(+), 28 deletions(-)

diff --git a/typst-ts-core.el b/typst-ts-core.el
index 40156d8141..8b7b5fd9e3 100644
--- a/typst-ts-core.el
+++ b/typst-ts-core.el
@@ -27,7 +27,7 @@
 ;; code from Emacs binary
 (declare-function treesit-parser-list "treesit" t t)
 
-(defun typst-ts-mode-column-at-pos (point)
+(defun typst-ts-core-column-at-pos (point)
   "Get the column at position POINT."
   (save-excursion
 (goto-char point)
@@ -40,6 +40,17 @@
 (back-to-indentation)
 (point)))
 
+(defun typst-ts-core-get-node-at-bol-nonwhite ()
+  "Get node at the first non-whitespace character at line beginning."
+  (save-excursion
+(back-to-indentation)
+(treesit-node-at (point
+
+(defun typst-ts-core-get-parent-of-node-at-bol-nonwhite ()
+  "See `typst-ts-core-get-node-at-bol-nonwhite'.
+May return nil."
+  (treesit-node-parent
+   (typst-ts-core-get-node-at-bol-nonwhite)))
 
 (defun typst-ts-core-node-get (node instructions)
   "Get things from NODE by INSTRUCTIONS.
diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index 89bf61c265..33febea742 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -88,33 +88,12 @@ the `GLOBAL-MAP' (example: `right-word')."
   (call-interactively
(keymap-lookup global-map (substitute-command-keys (cdr 
call-me/string)))
 
-(defun typst-ts-mode--item-on-line-p ()
-  "Does the current line have an item node?
-Return the node when yes otherwise
-return the node that is one character left from the end of line."
-  (treesit-node-parent
-   (treesit-node-at
-(save-excursion
-  ;; starting from the beginning because line could be 1. wow.
-  (beginning-of-line)
-  (condition-case nil
-  (progn
-(search-forward-regexp (rx (or "+" "-" "."))
-   (pos-eol)
-   nil
-   nil)
-(left-char))
-(search-failed
- ;; need to go to the end of line and then one left because end of 
line is the next node
- (goto-char (1- (pos-eol)
-  (point)
-
 (defun typst-ts-mode-meta-return (&optional arg)
   "Depending on context, insert a heading or insert an item.
 The new heading is created after the ending of current heading.
 Using ARG argument will ignore the context and it will insert a heading 
instead."
   (interactive "P")
-  (let ((node (typst-ts-mode--item-on-line-p)))
+  (let ((node (typst-ts-core-get-parent-of-node-at-bol-nonwhite)))
 (cond
  (arg (typst-ts-mode-insert--heading nil))
  ((string= (treesit-node-type node) "item")
@@ -141,8 +120,8 @@ When prefix ARG is non-nil, call global return function."
 (arg (throw 'execute-result 'default))
 ;; on item node end
 ((and (eolp)
-  (setq node (typst-ts-mode--item-on-line-p))
-  (string= (treesit-node-type node) "item")
+  (setq node 
(typst-ts-core-get-parent-of-node-at-bol-nonwhite))
+  (equal (treesit-node-type node) "item")
   (not (string= (typst-ts-core-node-get node '((child -1 nil) 
(type))) "linebreak")))
  (if (> (treesit-node-child-count node) 1)
  (typst-ts-mode-insert--item node)
@@ -180,7 +159,7 @@ This function respects indentation."
   (treesit-node-child node 0)))
  (item-number (string-to-number item-type))
  (item-end (treesit-node-end node))
- (node-bol-column (typst-ts-mode-column-at-pos
+ (node-bol-column (typst-ts-core-column-at-pos
(typst-ts-core-get-node-bol node
 (goto-char item-end)
 (newline)
@@ -264,9 +243,9 @@ When there is no section it will insert a heading below 
point."
 (treesit-node-at prev-nonwhite-line-bol))
(prev-nonwhite-line-top-node (treesit-node-parent
  
prev-nonwhite-line-heading-node))
-   (cur-line-bol-column (typst-ts-mode-column-at-pos 
cur-line-bol))
+   (cur-line-bol-column (typst-ts-core-column-at-pos 
cur-line-bol))
(prev-nonwhite-line-bol-column
-(typst-ts-mode-column-at-pos prev-nonwhite-line-bol)))
+(typst-ts-core-column-at-pos prev-nonwhite-line-bol)))
  (cond
   ;; 1. el
   ;; 2. psy| <- can toggle indent



[nongnu] elpa/typst-ts-mode 49a3981040 083/246: fix: Only search for the current line.

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 49a3981040431bad5ce3419fc644dff871c745e6
Author: Huan Nguyen 
Commit: Huan Nguyen 

fix: Only search for the current line.
---
 typst-ts-mode.el | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 2b5d84828e..b99d163545 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -1001,7 +1001,10 @@ Using ARG argument will ignore the context and it will 
insert a heading instead.
   (treesit-node-at
(save-excursion
   (beginning-of-line)
-  (search-forward-regexp (rx (or "+" "-" ".")))
+  (search-forward-regexp (rx (or "+" "-" "."))
+ (pos-eol)
+ t
+ nil)
   (left-char)
   (point))
 (cond



[nongnu] elpa/typst-ts-mode 741769a3ac 205/246: fix: `delete-region` so that the line is not removed

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 741769a3ac9c411d39cefe49fd6f4d995bd7d89f
Author: Huan Nguyen 
Commit: Huan Nguyen 

fix: `delete-region` so that the line is not removed
---
 typst-ts-editing.el | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index 9bef1f2044..8f15490ffd 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -149,8 +149,7 @@ When prefix ARG is non-nil, call global return function."
(call-interactively #'newline)
  (typst-ts-mode-insert--item item-node))
  ;; no text means delete the item on current line: (item -)
- (beginning-of-line)
- (delete-line)
+ (delete-region (line-beginning-position) (line-end-position))
  ;; whether the previous line is in an item
  (let* ((prev-line-item-node
  (typst-ts-core-parent-util-type
@@ -163,7 +162,7 @@ When prefix ARG is non-nil, call global return function."
(progn
  ;; sometimes there is no newlines characters at the 
EOL
  (ignore-errors
-   (delete-line))
+   (delete-region (line-beginning-position) 
(line-end-position)))
  (forward-line -1)
  (end-of-line)
  (call-interactively #'newline))
@@ -277,7 +276,7 @@ When there is no section it will insert a heading below 
point."
   (prev-significant-node-type
(treesit-node-type prev-significant-node))
   prev-item-node)
- 
+
  (if (equal prev-significant-node-type "item")
  (setq prev-item-node prev-significant-node)
(if (equal
@@ -286,9 +285,9 @@ When there is no section it will insert a heading below 
point."
  (treesit-node-parent prev-significant-node)))
(setq prev-item-node (treesit-node-parent
  prev-significant-node
- 
+
  ;; (message "%s, %s" cur-item-node prev-item-node)
- 
+
  (unless prev-item-node
(throw 'execute-result 'default))
 
@@ -310,7 +309,7 @@ When there is no section it will insert a heading below 
point."
   (- typst-ts-mode-indent-offset (abs offset)
 
  (throw 'execute-result 'success)))
-  
+
   (t nil)
 ;; execute default action if not successful
 (unless (eq execute-result 'success)



[nongnu] elpa/typst-ts-mode 0454e44977 087/246: feat: Autoincrement on enter and fix heading insertion.

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 0454e449774bf2a6c3cae6759dc5f880b1576585
Author: Huan Nguyen 
Commit: Huan Nguyen 

feat: Autoincrement on enter and fix heading insertion.
---
 typst-ts-mode.el | 70 ++--
 1 file changed, 53 insertions(+), 17 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index b99d163545..e0f1695e64 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -992,28 +992,61 @@ the `GLOBAL-MAP' (example: `right-word')."
 
 ;; RETURN 

 
+(defun typst-ts-mode--item-on-line-p ()
+  "Does the current line have an item node?
+Return the node when yes otherwise
+return the node that is one character left from the end of line."
+  (treesit-node-parent
+   (treesit-node-at
+(save-excursion
+  ;; starting from the beginning because line could be 1. wow.
+  (beginning-of-line)
+  (condition-case nil
+  (progn
+(search-forward-regexp (rx (or "+" "-" "."))
+   (pos-eol)
+   nil
+   nil)
+(left-char))
+(search-failed
+ ;; need to go to the end of line and then one left because end of 
line is the next node
+ (goto-char (1- (pos-eol)
+  (point)
+
 (defun typst-ts-mode-meta-return (&optional arg)
   "Depending on context, insert a heading or insert an item.
 The new heading is created after the ending of current heading.
 Using ARG argument will ignore the context and it will insert a heading 
instead."
   (interactive "P")
-  (let ((node (treesit-node-parent
-  (treesit-node-at
-   (save-excursion
-  (beginning-of-line)
-  (search-forward-regexp (rx (or "+" "-" "."))
- (pos-eol)
- t
- nil)
-  (left-char)
-  (point))
+  (let ((node (typst-ts-mode--item-on-line-p)))
 (cond
- (arg (typst-ts-mode-insert--heading node))
+ (arg (typst-ts-mode-insert--heading nil))
  ((string= (treesit-node-type node) "item")
   (typst-ts-mode-insert--item node))
  (t
   (typst-ts-mode-insert--heading node)
 
+(defun typst-ts-mode-return (&optional arg interactive)
+  "Do something smart when `typst-ts-mode-return-smart' is non nil.
+Pressing enter will do something depending on context.
+ARG and INTERACTIVE will be passed to `newline'.
+INTERACTIVE will be non nil when called interactively.
+`typst-ts-mode-return-smart' for more documentation."
+  (interactive "*P\np")
+  (if (or arg (not typst-ts-mode-return-smart))
+  (newline (if arg arg 1) interactive)
+(let ((node (typst-ts-mode--item-on-line-p)))
+  (cond
+   ((string= (treesit-node-type node) "item")
+;; does the item have text?
+(if (> (treesit-node-child-count node) 1)
+(typst-ts-mode-insert--item node)
+  ;; no text means delete the item on current line
+  (beginning-of-line)
+  (kill-line)
+  (indent-according-to-mode)))
+   (t (newline (if arg arg 1) interactive))
+
 (defun typst-ts-mode-insert--item (node)
   "Insert an item after NODE.
 NODE must be an item node!
@@ -1032,7 +1065,7 @@ This function respects indentation."
 
 (defun typst-ts-mode-insert--heading (node)
   "Insert a heading after the section that NODE is part of.
-When there is no section it will insert a heading after current point."
+When there is no section it will insert a heading below point."
   (let* ((section
  (treesit-parent-until
   node
@@ -1044,14 +1077,16 @@ When there is no section it will insert a heading after 
current point."
 (heading-level (treesit-node-type (treesit-node-child heading 0
 (if section
 (goto-char (treesit-node-end section))
+  ;; no headings so far
   (setq heading-level "=")
-  (end-of-line)
   (forward-line 1))
+;; something can be in the next line/section, the heading needs be on its 
own line
+;; this has to be done after `goto-char' because it will invalidate the 
node
+(newline)
+(forward-line -1)
+;; insert the heading and indent
 (insert heading-level " ")
-(indent-according-to-mode)
-;; something can be below the end of section
-(save-excursion
-  (newline
+(indent-according-to-mode)))
 
 ;;;###autoload
 (defun typst-ts-mode-preview (file)
@@ -1271,6 +1306,7 @@ TODO lack of documentation."
 (define-key map (kbd "M-") #'typst-ts-mode-heading-down)
 (define-key map (kbd "M-") #'typst-ts-mode-heading-up)
 (define-key map (kbd "M-") #'typst-ts-mode-meta-return)
+(define-key map (kbd "") #'typst-ts-mode-return)
 (define-key map (kbd "TAB") #'typst-ts-mode-cycle)
 map))
 



[nongnu] elpa/typst-ts-mode 4198faf667 228/246: `typst-ts-compile-and-preview` using `typst-ts-compile`

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 4198faf6674cb2656327dd8528790072b7f337ec
Author: Valentino Slavkin 
Commit: Valentino Slavkin 

`typst-ts-compile-and-preview` using `typst-ts-compile`

Avoids repeating code
---
 typst-ts-compile.el | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/typst-ts-compile.el b/typst-ts-compile.el
index 4e20e51f2d..c9f0538bed 100644
--- a/typst-ts-compile.el
+++ b/typst-ts-compile.el
@@ -116,12 +116,7 @@ buffer before compilation."
   "Compile & Preview.
 Assuming the compile output file name is in default style."
   (interactive)
-  ;; use a local variable version of `compilation-finish-functions' to shadow
-  ;; global version doesn't work
-  (add-hook 'compilation-finish-functions
-(typst-ts-mode-compile-and-preview--compilation-finish-function
- (current-buffer)))
-  (typst-ts-compile))
+  (typst-ts-compile t))
 
 (defvar typst-ts-compilation-mode-error
   (cons (rx bol "error:" (+ not-newline) "\n" (+ blank) "┌─ "



[nongnu] elpa/typst-ts-mode 22ff816058 218/246: feat: #16 do something depending on point

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 22ff816058c7ca6104e700a186298e761427f2e6
Author: Huan Nguyen 
Commit: Huan Nguyen 

feat: #16 do something depending on point
---
 typst-ts-editing.el | 132 +---
 1 file changed, 84 insertions(+), 48 deletions(-)

diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index ebfdf990f8..7b920fa10d 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -28,22 +28,22 @@
 (defun typst-ts-mode-heading-up ()
   "Switch the current heading with the heading above."
   (interactive)
-  (typst-ts-mode-meta--dwim 'up))
+  (call-interactively #'outline-move-subtree-up))
 
 (defun typst-ts-mode-heading-down ()
   "Switch the current heading with the heading below."
   (interactive)
-  (typst-ts-mode-meta--dwim 'down))
+  (call-interactively #'outline-move-subtree-down))
 
-(defun typst-ts-mode-heading-increase ()
+(defun typst-ts-mode-heading-left ()
   "Increase the heading level."
   (interactive)
-  (typst-ts-mode-meta--dwim 'right))
+  (call-interactively #'outline-promote))
 
-(defun typst-ts-mode-heading-decrease ()
+(defun typst-ts-mode-heading-right ()
   "Decrease heading level."
   (interactive)
-  (typst-ts-mode-meta--dwim 'left))
+  (call-interactively #'outline-demote))
 
 (defun typst-ts-mode-heading--at-point-p ()
   "Whether the current line is a heading.
@@ -58,6 +58,13 @@ Return the heading node when yes otherwise nil."
   nil)))
 
 (defun typst-ts-mode-item--at-point-p ()
+  "Return item node when point is on item.
+Otherwise nil."
+  (treesit-parent-until (treesit-node-at (point))
+(lambda (x) (string= (treesit-node-type x)
+ "item"
+
+(defun typst-ts-mode-item--with-siblings ()
   "Return (prev current next numbered-p) items.
 
 The last item in the last tells you if the list is numbered (t) or not (nil).
@@ -70,23 +77,23 @@ Being a different item type does not count as sibling, ex:
 - bar
 
 When point is not on an item node return nil."
-  (let* ((item-p (lambda (x) (string= (treesit-node-type x)
-  "item")))
- (node (treesit-parent-until (treesit-node-at (point))
- item-p))
- (get-item-type (lambda (x)
-  (treesit-node-text (treesit-node-child x 0
- (item-type (funcall get-item-type node))
- (node-numbered-p (not (= (string-to-number item-type) 0)))
- (same-item-type (lambda (x)
-   (let ((type (funcall get-item-type x)))
- (or (string= type item-type)
- ;; are they numbers?
- (and node-numbered-p
-  (not (= (string-to-number type) 0)))
- (only-if (lambda (x) (and (funcall item-p x)
-   (funcall same-item-type x)
-   x
+  (when-let* ((node (typst-ts-mode-item--at-point-p))
+  (get-item-type (lambda (x)
+   (treesit-node-text (treesit-node-child x 0
+  (item-type (funcall get-item-type node))
+  (node-numbered-p t)
+  (same-item-type (lambda (x)
+(let ((type (funcall get-item-type x)))
+  (or (string= type item-type)
+  ;; are they numbers?
+  (and node-numbered-p
+   (not (= (string-to-number type)
+   0)))
+  (only-if (lambda (x) (and (string= (treesit-node-type x)
+ "item")
+(funcall same-item-type x)
+x
+(setq node-numbered-p (not (= (string-to-number item-type) 0)))
 (cond
  ((not node) node)
  (node (list (funcall only-if (treesit-node-prev-sibling node))
@@ -133,7 +140,7 @@ DIRECTION should be `up' or `down'."
  (setq swap-with next))
 (_ (error "%s is not one of: `up' `down'" direction))
 (seq-setq (previous current next numbered-p)
-  (typst-ts-mode-item--at-point-p))
+  (typst-ts-mode-item--with-siblings))
 (unless current
   (error "Point is not on an item"))
 (funcall bind)
@@ -153,7 +160,7 @@ DIRECTION should be `up' or `down'."
other-begin other-end
 ;; the nodes must be reinitialized
 (seq-setq (previous current next numbered-p)
-  (typst-ts-mode-item--at-point-p))
+  (typst-ts-mode-item--with-siblings))
 (funcall bind)
 (let ((current-begin (treesit-node-start current))
   (current-end (treesit-node-end current))
@@ -1

[nongnu] elpa/typst-ts-mode dc4678aa5b 053/246: fix(indentation): edge conditions

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit dc4678aa5b5f7d9839f724867e6c3d2abebed741
Author: Meow King 
Commit: Meow King 

fix(indentation): edge conditions
---
 typst-ts-mode.el | 31 +++
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 444e97087b..cbd7299874 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -504,10 +504,6 @@ TYPES."
   ;; you can set `treesit--indent-verbose' variable to t to see which 
indentation
   ;; rule matches.
   `((typst
- ;; ((lambda (node parent bol)
- ;;(message "%s %s %s" node parent bol)
- ;;nil) parent-bol 0)
-
  ((and (node-is ")") (parent-is "group")) parent-bol 0)
  ((and (node-is "}") (parent-is "block")) parent-bol 0)
  ((and (node-is "]") (parent-is "content")) parent-bol 0)
@@ -534,18 +530,18 @@ TYPES."
 (line-number-at-pos (point)
  (prev-nonwhite-line-node
   (treesit-node-at prev-nonwhite-pos))
+ ((equal (treesit-node-type prev-nonwhite-line-node) 
"linebreak"))
+ 
  (prev-nonwhite-line-heading-node
   (save-excursion
 (goto-char prev-nonwhite-pos)
 (back-to-indentation)
 (treesit-node-at (point
+ ((equal (treesit-node-type 
prev-nonwhite-line-heading-node) "-"))
  
  (prev-nonwhite-line-top-node (treesit-node-parent

prev-nonwhite-line-heading-node)))
-   (and
-(equal (treesit-node-type prev-nonwhite-line-top-node) "item")
-(equal (treesit-node-type prev-nonwhite-line-heading-node) "-")
-(equal (treesit-node-type prev-nonwhite-line-node) 
"linebreak")
+   (equal (treesit-node-type prev-nonwhite-line-top-node) 
"item"
   parent-bol typst-ts-mode-indent-offset)
 
  ((and no-node
@@ -553,6 +549,14 @@ TYPES."
   ,(typst-ts-mode--ancestor-bol typst-ts-mode--bracket-node-types)
   typst-ts-mode-indent-offset)
 
+ ;; ((lambda (node parent bol)
+ ;;(message "%s %s %s" node parent bol)
+ ;;nil) parent-bol 0)
+
+ ((and no-node
+   (parent-is "source_file"))
+  prev-line 0)
+ 
  (no-node parent-bol 0)))
   "Tree-sitter indent rules for `rust-ts-mode'.")
 
@@ -846,11 +850,14 @@ PROC: process; OUTPUT: new output from PROC."
 ARG.
 TODO lack of documentation."
   (interactive "P")
-  (let* ((cur-pos (point))
- (cur-node (treesit-node-at cur-pos))
- (cur-node-type (treesit-node-type cur-node)))
+  (when-let* ((cur-pos (point))
+  (cur-node (treesit-node-at cur-pos))
+  (cur-node-type (treesit-node-type cur-node))
+  (parent-node (treesit-node-parent cur-node))  ; could be nil
+  (parent-node-type (treesit-node-type parent-node)))
 (cond
- ((equal cur-node-type "parbreak")
+ ((or (equal cur-node-type "parbreak")
+  (eq (point) (point-max)))
   (when-let* ((cur-line-bol
(save-excursion
  (back-to-indentation)



[nongnu] elpa/typst-ts-mode 9d1adbcb09 023/246: feat: adopt update stream parser syntax change and add dynamic height for headers

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 9d1adbcb0931bb68ad648800c51fdd457398f9ec
Author: Ziqi Yang 
Commit: Ziqi Yang 

feat: adopt update stream parser syntax change and add dynamic height for 
headers
---
 README.md|  1 +
 typst-ts-mode.el | 14 ++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 6dae3ba584..2835d6fa56 100644
--- a/README.md
+++ b/README.md
@@ -94,6 +94,7 @@ default, so the `typst watch` process buffer appear when an 
error occurs, and di
 when there is no error. You may find there is only one error at a time, and it 
is
 because Typst itself do this style. You may find 
[auto-save](https://github.com/manateelazycat/auto-save)
 and [super-save](https://github.com/bbatsov/super-save) useful (or annoying).
+6. `typst-ts-markup-header-same-height` and `typst-ts-markup-header-scale` to 
control header height. 
 
 ### Consult Imenu Integration
 If you use [consult](https://github.com/minad/consult) and use `consult-iemnu`
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 6ec45c9d2f..7a6dccc7b8 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -312,7 +312,7 @@ is eliminated."
 st))
 
 (defvar typst-ts-mode-font-lock-rules
-  '(;; Typst font locking
+  `(;; Typst font locking
 :language typst
 :feature comment
 ((comment) @font-lock-comment-face)
@@ -323,12 +323,18 @@ is eliminated."
 
 :language typst
 :feature markup-basic
-((heading (text) @typst-ts-markup-header-face)
+(,@(if typst-ts-markup-header-same-height
+   '((heading (text)) @typst-ts-markup-header-face)
+ '((heading "=" (text)) @typst-ts-markup-header-face-1
+   (heading "==" (text)) @typst-ts-markup-header-face-2
+   (heading "===" (text)) @typst-ts-markup-header-face-3
+   (heading "" (text)) @typst-ts-markup-header-face-4
+   (heading "=" (text)) @typst-ts-markup-header-face-5))
  (emph) @typst-ts-markup-emphasis-face
  (strong) @typst-ts-markup-strong-face
- (item "item" @typst-ts-markup-item-face)
+ (item "-" @typst-ts-markup-item-face)
  (term
-  "item" @typst-ts-markup-term-indicator-face
+  "/" @typst-ts-markup-term-indicator-face
   term: (text) @typst-ts-markup-term-term-face
   ":" @typst-ts-markup-term-indicator-face
   (text) @typst-ts-markup-term-description-face)



[nongnu] elpa/typst-ts-mode 6a6ab91ff6 038/246: refactor: Refactored heading increase/decrease functions.

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 6a6ab91ff63a421ebe9bc5d1805cf0e8cb129279
Author: Huan Nguyen 
Commit: Huan Nguyen 

refactor: Refactored heading increase/decrease functions.
---
 README.md|   4 +-
 typst-ts-mode.el | 113 ---
 2 files changed, 67 insertions(+), 50 deletions(-)

diff --git a/README.md b/README.md
index c3fb7264cb..81f3bcc1e7 100644
--- a/README.md
+++ b/README.md
@@ -79,8 +79,8 @@ For reference, this is my configuration.
 `C-c C-c C` : `typst-ts-mode-compile`  
 `C-c C-c w` : `typst-ts-mode-watch-toggle`  
 `C-c C-c p` : `typst-ts-mode-preview`  
-`M-`  : `typst-ts-mode-shift-heading-left`  
-`M-` : `typst-ts-mode-shift-heading-right`  
+`M-`  : `typst-ts-mode-heading-decrease`
+`M-` : `typst-ts-mode-heading-increase`
 
 ## Customization Options
 
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index ad05a4da54..f83eae6a7d 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -31,6 +31,7 @@
 
 (require 'treesit)
 (require 'compile)
+(require 'subr-x)
 
 (defgroup typst-ts nil
   "Tree Sitter enabled Typst Writing."
@@ -124,7 +125,7 @@ is eliminated."
 (defcustom typst-ts-markup-header-scale
   '(2.0 1.7 1.4 1.1 1.0 1.0)
   "Header Scale."
-  :type 'list
+  :type '(list integer integer integer integer integer integer)
   :set (lambda (symbol value)
  (set-default symbol value)
  (when typst-ts-markup-header-same-height
@@ -567,64 +568,80 @@ buffer before compilation."
   (remove-hook 'compilation-finish-functions
(typst-ts-mode-compile--compilation-finish-function 
cur-buffer)
 
-(defun typst-ts-mode-meta--dwim (right-p)
-  "Either increase/decrease heading level or move by word.
-RIGHT-P non-nil for increasing heading level, RIGHT-P nil for decreasing."
-  (let ((node nil)
-   (tmp nil))
-(setq node
- ;; = header
- (cond
-  ((string=
-(treesit-node-type
- (setq tmp (treesit-node-parent
-(treesit-node-at (point)
-"heading")
-   (treesit-node-child tmp 0))
-  ;; = header with point at the end of line
-  ((string=
-(treesit-node-type
- (setq tmp (treesit-node-parent
-(treesit-node-at (line-beginning-position)
-"heading")
-   (treesit-node-child tmp 0))
-  (t nil)))
-(if node
-   (typst-ts-mode-shift--heading right-p node)
-  (execute-kbd-macro
-   (if right-p
-  (read-kbd-macro "M-")
-(read-kbd-macro "M-"))
-
-(defun typst-ts-mode-shift--heading (right-p node)
+(defun typst-ts-mode-heading--at-point-p ()
+  "Is thing at point a heading?
+Return the heading node when yes otherwise nil."
+  (let ((node nil))
+;; = header
+(cond
+ ((string=
+   (treesit-node-type
+   (setq node
+ (treesit-node-parent
+  (treesit-node-at (point)
+   "heading")
+  node)
+ ;; = header with point at the end of line
+ ((string=
+   (treesit-node-type
+   (setq node (treesit-node-parent
+   (treesit-node-at (line-beginning-position)
+   "heading")
+  node)
+ (t nil
+
+(defun typst-ts-mode-heading--increase/decrease (direction node)
   "Increase or decrease the heading level.
-RIGHT-P nil means increase the level while RIGHT-P non-nil means decrease.
+DIRECTION right means increase the level while DIRECTION right means decrease.
 NODE is the heading node.
 This does not handle #heading function."
-  (let* ((heading-string "")
-(heading-level 0))
+  (let ((heading-string "")
+   (heading-level 0))
 (setq heading-level
  (length (setq heading-string (treesit-node-text node
-(when (and (= heading-level 1) (not right-p))
+(when (and (= heading-level 1) (eq direction 'left))
   (user-error "Cannot decrease level 1 heading"))
-(save-excursion (replace-string-in-region heading-string
- (if right-p
- (concat heading-string "=")
- (substring-no-properties 
heading-string 1 heading-level))
- (treesit-node-start node)
- (treesit-node-end node)
+(replace-region-contents
+ (treesit-node-start node)
+ (treesit-node-end node)
+ (lambda ()
+   (pcase direction
+('right (concat heading-string "="))
+('left (substring-no-properties heading-string 1 heading-level))
+(_ (error "%s is not one of: `LEFT' `RIGHT'" direction)))
+
+(defun typst-ts-mode-meta--dwim (direction)
+  "Do something depending on the context with meta key + DIRECTION.
+`left': `typst-ts-mode-heading-decrease'
+`right': `typst-ts-mode-heading-increase'
+When there is no relevant action to do it will execut

[nongnu] elpa/typst-ts-mode 7485611871 048/246: style: change all tab into white space & add editorconfig file

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 74856118710e0b00044a191445088a69d2faef9a
Author: Meow King 
Commit: Meow King 

style: change all tab into white space & add editorconfig file
---
 .editorconfig|  21 
 typst-ts-mode.el | 146 +++
 2 files changed, 94 insertions(+), 73 deletions(-)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00..eee922ff2e
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,21 @@
+# https://EditorConfig.org
+# https://github.com/editorconfig/editorconfig/wiki/Projects-Using-EditorConfig
+
+# top-most EditorConfig file
+root = true
+
+# All Files
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 4
+# Unix-style newlines with a newline ending every file
+end_of_line = lf
+insert_final_newline = true
+
+# Tab indentation (no size specified)
+[Makefile]
+indent_style = tab
+
+[*.el]
+indent_size = 2
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index b23d4a00d5..fd8fe133fc 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -586,9 +586,9 @@ DIRECTION right means increase the level while DIRECTION 
right means decrease.
 NODE is the heading node.
 This does not handle #heading function."
   (let ((heading-string "")
-   (heading-level 0))
+ (heading-level 0))
 (setq heading-level
- (length (setq heading-string (treesit-node-text node
+   (length (setq heading-string (treesit-node-text node
 (when (and (= heading-level 1) (eq direction 'left))
   (user-error "Cannot decrease level 1 heading"))
 (replace-region-contents
@@ -596,9 +596,9 @@ This does not handle #heading function."
  (treesit-node-end node)
  (lambda ()
(pcase direction
-('right (concat heading-string "="))
-('left (substring-no-properties heading-string 1 heading-level))
-(_ (error "%s is not one of: `left' `right'" direction)))
+  ('right (concat heading-string "="))
+  ('left (substring-no-properties heading-string 1 heading-level))
+  (_ (error "%s is not one of: `left' `right'" direction)))
 
 (defun typst-ts-mode-heading--find-same-or-higher (node traverse-fn)
   "Return the first heading that is the same level or higher than NODE.
@@ -608,16 +608,16 @@ TRAVERSE-FN dictates in which direction to search.
 `treesit-node-next-sibling' for down.
 `treesit-node-prev-sibling' for up."
   (let ((iterate (funcall traverse-fn node))
-   (level (typst-ts-mode-heading--level node))
-   (iterate-level nil))
+ (level (typst-ts-mode-heading--level node))
+ (iterate-level nil))
 (while (and iterate
-   (not (and (string= (treesit-node-type iterate) "heading")
- (or (= (setq
- iterate-level ;; hack to make it not eval 
twice
- (typst-ts-mode-heading--level iterate))
-level)
- ;; parent heading or NODE was a leaf
- (< iterate-level level)
+   (not (and (string= (treesit-node-type iterate) 
"heading")
+   (or (= (setq
+ iterate-level ;; hack 
to make it not eval twice
+ 
(typst-ts-mode-heading--level iterate))
+level)
+   ;; parent heading or NODE was a 
leaf
+   (< iterate-level level)
   (setq iterate (funcall traverse-fn iterate)))
 ;; there are no level 0 heading
 (cons iterate (= (if iterate-level iterate-level 0) level
@@ -633,9 +633,9 @@ It will report a user-error when it could not find a node
 or it was blocked by its parent heading.
 See `typst-ts-mode-heading--find-same-or-higher' for TRAVERSE-FN."
   (let* ((other-heading/level
- (typst-ts-mode-heading--find-same-or-higher node traverse-fn)))
+   (typst-ts-mode-heading--find-same-or-higher node traverse-fn)))
 (if (cdr other-heading/level)
-   (car other-heading/level)
+ (car other-heading/level)
   (user-error "Could not find another heading"
 
 (defun typst-ts-mode-heading-up ()
@@ -652,63 +652,63 @@ See `typst-ts-mode-heading--find-same-or-higher' for 
TRAVERSE-FN."
   "Switch two heading of same level.
 CURRENT-HEADING and its content with above heading and its content."
   (let* ((current-heading-start (treesit-node-start current-heading))
-(other-heading
- (typst-ts-mode-heading--find-same-level
-  current-heading
-  #'treesit-node-next-sibling))
-(other-heading-start (treesit-node-start other-heading))
-(other-heading-end (car (typst-ts-mode-heading--find-same-or-higher
-  

[nongnu] elpa/typst-ts-mode 78cc859488 032/246: feat: add typst watch mode-line indicator

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 78cc8594880afbb24585749b29a65da0aaf2e6c6
Author: Ziqi Yang 
Commit: Ziqi Yang 

feat: add typst watch mode-line indicator
---
 typst-ts-mode.el | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index bc9d13a779..621f1ed9a8 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -76,6 +76,15 @@ The compile options will be passed to the
   :type 'string
   :group 'typst-ts)
 
+(defcustom typst-ts-mode-watch-modeline-indicator-enable t
+  "Whether to enable mode line indicator for typst watch."
+  :type 'boolean
+  :group 'typst-ts)
+
+(defcustom typst-ts-mode-watch-modeline-indicator "[Watch]"
+  "Modeline indicator for typst watch."
+  :type 'string
+  :group 'typst-ts)
 
 (defcustom typst-ts-mode-watch-process-name "*Typst-Watch*"
   "Process name for `typst watch' sub-command."
@@ -123,6 +132,12 @@ is eliminated."
   :set-after '(typst-ts-markup-header-same-height)
   :group 'typst-ts-faces)
 
+;; Face 
=
+(defface typst-ts-watch-modeline-indicator-face
+  '((t :inherit (underline bold)))
+  "Face for typst watch modeline indicator."
+  :group 'typst-ts-faces)
+
 ;; Common Face 
==
 
 (defface typst-ts-shorthand-face
@@ -662,6 +677,11 @@ PROC: process; OUTPUT: new output from PROC."
 (file-name-nondirectory buffer-file-name)
 typst-ts-mode-watch-options))
'typst-ts-mode--watch-process-filter)
+  ;; add mode line indicator
+  (when typst-ts-mode-watch-modeline-indicator-enable
+(push
+ (propertize typst-ts-mode-watch-modeline-indicator 'face 
'typst-ts-watch-modeline-indicator-face)
+ global-mode-string))
   (message "Start Watch :3"))
 
 ;;;###autoload
@@ -675,6 +695,9 @@ PROC: process; OUTPUT: new output from PROC."
 (when window
   (delete-window window)))
   (run-hooks typst-ts-mode-after-watch-hook)
+  ;; remove mode line indicator
+  (when typst-ts-mode-watch-modeline-indicator-enable
+(setq global-mode-string (remove typst-ts-mode-watch-modeline-indicator 
global-mode-string)))
   (message "Stop Watch :‑."))
 
 ;;;###autoload



[nongnu] elpa/typst-ts-mode c4a3c02c07 012/246: feat: indentation rules

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit c4a3c02c073e3caadbe82b033f36b63e7309936f
Author: Ziqi Yang 
Commit: Ziqi Yang 

feat: indentation rules
---
 .gitignore   |  1 +
 typst-ts-mode.el | 92 +---
 2 files changed, 82 insertions(+), 11 deletions(-)

diff --git a/.gitignore b/.gitignore
index c531d9867f..e420514d3a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 *.elc
+indentation-test.typ
\ No newline at end of file
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 3d75478289..6205dfc0ac 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -241,6 +241,9 @@
   "Face for math indicator $."
   :group 'typst-ts-faces)
 
+
+;; 
==
+
 (defvar typst-ts-mode-font-lock-rules
   '(;; Typst font locking
 :language typst
@@ -253,7 +256,8 @@
 
 :language typst
 :feature markup
-((heading) @typst-ts-markup-header-face
+((linebreak) @typst-ts-markup-linebreak-face
+ (heading (text) @typst-ts-markup-header-face)
  (url) @typst-ts-markup-url-face
  (emph) @typst-ts-markup-emphasis-face
  (strong) @typst-ts-markup-strong-face
@@ -264,7 +268,6 @@
   ":" @typst-ts-markup-term-indicator-face
   (text) @typst-ts-markup-term-description-face)
  (quote) @typst-ts-markup-quote-face
- (linebreak) @typst-ts-markup-linebreak-face
  (escape) @typst-ts-markup-escape-face
  (raw_span
   "`" @typst-ts-markup-rawspan-indicator-face
@@ -343,9 +346,75 @@
  (symbol) @font-lock-constant-face
  (letter) @font-lock-constant-face)))
 
-(defvar typst-ts-mode--indent-rules
-  `((typst
- (no-node parent 0)))
+(defconst typst-ts-mode--bracket-node-types
+  '("block" "content" "group")
+  "Bracket node types.")
+
+(defun typst-ts-mode--node-inside-brackets (parent)
+  "Return the bracket node if the PARENT of node is a bracket or inside 
bracket.
+Return nil if the node is not inside brackets."
+  (treesit-parent-until
+   parent
+   (lambda (parent)
+ (member (treesit-node-type parent) typst-ts-mode--bracket-node-types))
+   t))
+
+(defun typst-ts-mode--ancestor-in (types &optional return-bol)
+  "Return a function which is suits `treesit-simple-indent-rules' Match.
+An ancestor includes the query node itself.
+If RETURN-BOL is non-nil, then return returns the beginning of line position of
+the corresponding ancestor node that its type is in TYPES, else return the
+corresponding ancestor node.  Return nil if ancestor not matching."
+  (lambda (node parent _bol)
+(let* ((query-node (if node ;; considering node may be nil
+   node
+ parent))
+   (ancestor (treesit-parent-until
+  query-node
+  (lambda (parent)
+(member (treesit-node-type parent) types))
+  t)))
+  (if return-bol
+  (if ancestor
+  (save-excursion
+(goto-char (treesit-node-start ancestor))
+(back-to-indentation)
+(point))
+nil)
+ancestor
+
+(defun typst-ts-mode--ancestor-bol (types)
+  "See `typst-ts-mode--ancestor-in'.
+TYPES."
+  (typst-ts-mode--ancestor-in types t))
+
+(defconst typst-ts-mode--indent-rules
+  ;; you can set `treesit--indent-verbose' variable to t to see which 
indentation
+  ;; rule matches.
+  (let ((offset typst-ts-mode-indent-offset))
+`((typst
+   ;; ((lambda (node parent bol)
+   ;;(message "%s %s %s" (treesit-node-type node) (treesit-node-type 
parent) bol)
+   ;;nil) parent-bol 0)
+
+   ((and (node-is ")") (parent-is "group")) parent-bol 0)
+   ((and (node-is "}") (parent-is "block")) parent-bol 0)
+   ((and (node-is "]") (parent-is "content")) parent-bol 0)
+
+   ((and (node-is "item") (parent-is "item")) parent-bol ,offset)
+
+   ((parent-is "block") parent-bol ,offset)
+   ((parent-is "content") parent-bol ,offset)
+   ((parent-is "group") parent-bol ,offset)
+
+   ((and no-node
+ ,(typst-ts-mode--ancestor-in typst-ts-mode--bracket-node-types))
+,(typst-ts-mode--ancestor-bol typst-ts-mode--bracket-node-types)
+,offset)
+
+   ((and no-node
+ (not ,(typst-ts-mode--ancestor-in 
typst-ts-mode--bracket-node-types)))
+parent-bol 0
   "Tree-sitter indent rules for `rust-ts-mode'.")
 
 (defun typst-ts-mode-comment-setup()
@@ -377,12 +446,13 @@
   (typst-ts-mode-comment-setup)
 
   ;; Electric
-  (setq-local electric-indent-chars (append "{}()[]$" electric-indent-chars)
-  electric-pair-pairs '((?\" . ?\")
-(?\{ . ?\})
-(?\( . ?\))
-(?\[ . ?\])
-(?\$ . ?\$)))
+  (setq-local
+   electric-indent-chars (append "{}()[]$" electric-indent-chars)
+   e

[nongnu] elpa/typst-ts-mode 01ef0d45b9 018/246: feat: better functionality for typst watch process

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 01ef0d45b9b658de7f620401a155b4c9592897c2
Author: Ziqi Yang 
Commit: Ziqi Yang 

feat: better functionality for typst watch process
---
 typst-ts-mode.el | 105 ++-
 1 file changed, 96 insertions(+), 9 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 02de48cf0e..1571d933fb 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -28,6 +28,7 @@
 ;;; Code:
 
 (require 'treesit)
+(require 'compile)
 
 (defgroup typst-ts nil
   "Tree Sitter enabled Typst Writing."
@@ -73,6 +74,7 @@ The compile options will be passed to the
   :type 'string
   :group 'typst-ts)
 
+
 (defcustom typst-ts-mode-watch-process-name "*Typst-Watch*"
   "Process name for `typst watch' sub-command."
   :type 'string
@@ -83,6 +85,20 @@ The compile options will be passed to the
   :type 'string
   :group 'typst-ts)
 
+(defcustom typst-ts-mode-display-watch-process-bufer-automatically t
+  "Whether the typst watch process buffer should be displayed automatically.
+This means the buffer will be displayed when error occurs, hide when error
+is eliminated."
+  :type 'boolean
+  :group 'typst-ts)
+
+(defcustom typst-ts-mode-display-watch-process-buffer-parameters
+  `(display-buffer-at-bottom
+(window-height . fit-window-to-buffer))
+  "Display buffer parameters."
+  :type 'symbol
+  :group 'typst-ts)
+
 (defvar typst-ts-mode-before-watch-hook nil
   "Hook runs after compile.")
 
@@ -409,8 +425,6 @@ The compile options will be passed to the
  (attach ["^" "_"] @font-lock-operator-face)
  (align) @font-lock-operator-face)))
 
-
-
 (defconst typst-ts-mode--bracket-node-types
   '("block" "content" "group")
   "Bracket node types.")
@@ -530,7 +544,12 @@ buffer before compilation."
   ;; define them inside a let binding.
   (add-hook 'compilation-finish-functions
 (typst-ts-mode-compile--compilation-finish-function 
(current-buffer)))
-  (compile compile-command))
+  (compile
+   (format "%s compile %s %s"
+   typst-ts-mode-executable-location
+   (file-name-nondirectory buffer-file-name)
+   typst-ts-mode-compile-options)
+   'typst-ts-compilation-mode))
 
 ;;;###autoload
 (defun typst-ts-mode-preview (file)
@@ -551,6 +570,7 @@ buffer before compilation."
   (remove-hook 'compilation-finish-functions

(typst-ts-mode-compile-and-preview--compilation-finish-function cur-buffer)
 
+;;;###autoload
 (defun typst-ts-mode-compile-and-preview ()
   "Compile & Preview.
 Assuming the compile output file name is in default style."
@@ -562,17 +582,64 @@ Assuming the compile output file name is in default 
style."
  (current-buffer)))
   (typst-ts-mode-compile))
 
+(defun typst-ts-mode--watch-process-filter (proc output)
+  "Filter the `typst watch' process output.
+Only error will be transported to the process buffer.
+See `(info \"(elisp) Filter Functions\")'.
+PROC: process; OUTPUT: new output from PROC."
+  (when (buffer-live-p (process-buffer proc))
+(with-current-buffer (process-buffer proc)
+  (erase-buffer)
+  (let ((window (get-buffer-window))
+(re (rx bol "error:" (+ not-newline) "\n   ┌─ "
+(+ not-newline) ":" ;; file
+(+ num) ":" ;; start-line
+(+ num) "\n"
+(+ (+ (or blank num)) "│" (* not-newline) "\n")))
+(next-match-start-pos 0)
+res-output)
+(while (string-match re output next-match-start-pos)
+  (setq res-output (concat
+res-output
+(when res-output "\n")
+(substring output (match-beginning 0) (match-end 
0)))
+next-match-start-pos (match-end 0)))
+;; Insert the Error text
+(if (not res-output)
+(when (and typst-ts-mode-display-watch-process-bufer-automatically 
window)
+  (delete-window window))
+  (insert res-output)
+  (goto-char (point-min))
+  (when typst-ts-mode-display-watch-process-bufer-automatically
+(typst-ts-mode-display-watch-buffer)))
+
+(defun typst-ts-mode-display-watch-buffer ()
+  "Display typst watch process buffer."
+  (interactive)
+  (if (not (buffer-live-p (get-buffer 
typst-ts-mode-watch-process-buffer-name)))
+  (user-error "The typst watch process buffer %s is not alive!" 
typst-ts-mode-watch-process-buffer-name)
+(display-buffer
+ typst-ts-mode-watch-process-buffer-name
+ typst-ts-mode-display-watch-process-buffer-parameters)))
+
 ;;;###autoload
 (defun typst-ts-mode-watch ()
   "Watch(hot compile) current typst file."
   (interactive)
   (run-hooks typst-ts-mode-before-watch-hook)
-  (start-process-shell-command
-   typst-ts-mode-watch-process-name typst-ts-mode-watch-process-buffer-name
-   (format "%s watch %s %s"
-   typst-ts-mode-executable-location
-   (file-nam

[nongnu] elpa/typst-ts-mode 5ff1b21a51 025/246: fix(compilation + watch) error regexp error

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 5ff1b21a51c1f745faaa9fedc3ea6c705f8e5624
Author: Ziqi Yang 
Commit: Ziqi Yang 

fix(compilation + watch) error regexp error
---
 typst-ts-mode.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 674543ea9c..4972d7e92c 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -604,7 +604,7 @@ PROC: process; OUTPUT: new output from PROC."
 (with-current-buffer (process-buffer proc)
   (erase-buffer)
   (let ((window (get-buffer-window))
-(re (rx bol "error:" (+ not-newline) "\n   ┌─ "
+(re (rx bol "error:" (+ not-newline) "\n" (+ blank) "┌─ "
 (+ not-newline) ":" ;; file
 (+ num) ":" ;; start-line
 (+ num) "\n"
@@ -678,7 +678,7 @@ PROC: process; OUTPUT: new output from PROC."
 (typst-ts-mode-watch)))
 
 (defvar typst-ts-compilation-mode-error
-  (cons (rx bol "error:" (+ not-newline) "\n   ┌─ "
+  (cons (rx bol "error:" (+ not-newline) "\n" (+ blank) "┌─ "
 (group (+ not-newline)) ":" ;; file
 (group (+ num)) ":" ;; start-line
 (group (+ num)) "\n")   ;; start-col



[nongnu] elpa/typst-ts-mode ebdce771f3 035/246: doc: update README

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit ebdce771f3dc2574955928e588dad97b005e8e13
Author: Ziqi Yang 
Commit: Ziqi Yang 

doc: update README
---
 README.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/README.md b/README.md
index 5fd451586b..35e3abf1e3 100644
--- a/README.md
+++ b/README.md
@@ -79,6 +79,8 @@ For reference, this is my configuration.
 `C-c C-c C` : `typst-ts-mode-compile`  
 `C-c C-c w` : `typst-ts-mode-watch-toggle`  
 `C-c C-c p` : `typst-ts-mode-preview`  
+`M-`  : `typst-ts-mode-shift-heading-left`  
+`M-` : `typst-ts-mode-shift-heading-right`  
 
 ## Customization Options
 



[nongnu] elpa/typst-ts-mode b4b6444909 041/246: feat: Move heading and it contents down or up.

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit b4b644490981077160118af93733a4fab0146ece
Author: Huan Nguyen 
Commit: Huan Nguyen 

feat: Move heading and it contents down or up.
---
 typst-ts-mode.el | 62 +++-
 1 file changed, 52 insertions(+), 10 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 3989302dd8..7f98386dfa 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -649,9 +649,46 @@ See `typst-ts-mode-heading--same-or-higher' for 
TRAVERSE-FN."
   (user-error "Could not find another heading"
 
 (defun typst-ts-mode-heading-up ()
+  "Switch the current heading with the heading above."
   (interactive)
   (typst-ts-mode-meta--dwim 'up))
 
+(defun typst-ts-mode-heading-down ()
+  "Switch the current heading with the heading below."
+  (interactive)
+  (typst-ts-mode-meta--dwim 'down))
+
+(defun typst-ts-mode-heading--down (current-heading)
+  "Switch two heading of same level.
+CURRENT-HEADING and its content with above heading and its content."
+  (let* ((current-heading-start (treesit-node-start current-heading))
+(other-heading
+ (typst-ts-mode-heading--find-same-level
+  current-heading
+  #'treesit-node-next-sibling))
+(other-heading-start (treesit-node-start other-heading))
+(other-heading-end (car (typst-ts-mode-heading--same-or-higher
+ other-heading
+ #'treesit-node-next-sibling)))
+(current-heading-end (1- other-heading-start))
+(current-heading-content (buffer-substring current-heading-start
+   current-heading-end))
+(other-heading-content nil))
+(setq other-heading-end (if other-heading-end
+   (1- (treesit-node-start other-heading-end))
+ (point-max)))
+(setq other-heading-content
+ (buffer-substring other-heading-start
+   other-heading-end))
+(save-excursion
+  (delete-region current-heading-start other-heading-end)
+  (goto-char current-heading-start)
+  (insert other-heading-content)
+  (unless (= ?\n (aref other-heading-content
+  (1- (length other-heading-content
+   (newline))
+  (insert current-heading-content
+
 (defun typst-ts-mode-heading--up (current-heading)
   "Switch two heading of same level.
 CURRENT-HEADING and its content with above heading and its content."
@@ -675,18 +712,21 @@ CURRENT-HEADING and its content with above heading and 
its content."
 (setq current-heading-content
  (buffer-substring current-heading-start
current-heading-end))
-(delete-region other-heading-start current-heading-end)
-(goto-char other-heading-start)
-(if (= ?\n (aref current-heading-content
-(1- (length current-heading-content
-   (insert current-heading-content)
-  (insert (concat current-heading-content "\n")))
-(insert other-heading-content)))
+(save-excursion
+  (delete-region other-heading-start current-heading-end)
+  (goto-char other-heading-start)
+  (insert current-heading-content)
+  (unless (= ?\n (aref current-heading-content
+  (1- (length current-heading-content
+   (newline))
+  (insert other-heading-content
 
 (defun typst-ts-mode-meta--dwim (direction)
   "Do something depending on the context with meta key + DIRECTION.
-`left': `typst-ts-mode-heading-decrease'.
-`right': `typst-ts-mode-heading-increase'.
+`left': `typst-ts-mode-heading-decrease',
+`right': `typst-ts-mode-heading-increase',
+`up': `typst-ts-mode-heading-up',
+`down': `typst-ts-mode-heading-down'.
 When there is no relevant action to do it will execute the relevant function in
 the `GLOBAL-MAP' (example: `right-word')."
   (let ((heading (typst-ts-mode-heading--at-point-p))
@@ -704,7 +744,9 @@ the `GLOBAL-MAP' (example: `right-word')."
   ('up
(cons (lambda (node) (typst-ts-mode-heading--up node))
  "\\[typst-ts-mode-heading-up]"))
-  ('down "\\[typst-ts-mode-heading-down]")
+  ('down
+   (cons (lambda (node) (typst-ts-mode-heading--down node))
+ "\\[typst-ts-mode-heading-down]"))
   (_ (error "%s is not one of: `right' `left'" direction)
 (if heading
(funcall (car call-me/string) heading)



[nongnu] elpa/typst-ts-mode 21f263b341 039/246: doc: Fix flymake warnings.

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 21f263b3411f76b588eb976fb1ac3b1435b96454
Author: Huan Nguyen 
Commit: Huan Nguyen 

doc: Fix flymake warnings.
---
 typst-ts-mode.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index f83eae6a7d..42bbe652a1 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -50,7 +50,7 @@
   :group 'typst-ts)
 
 (defcustom typst-ts-mode-executable-location "typst"
-  "The location or name(if in `exec-path') for Typst executable."
+  "The location or name(if in variable `exec-path') for Typst executable."
   :type 'string
   :group 'typst-ts)
 
@@ -532,7 +532,7 @@ TYPES."
   "Tree-sitter indent rules for `rust-ts-mode'.")
 
 (defun typst-ts-mode-comment-setup()
-  "Setup comment related stuffs for typst-ts-mode."
+  "Setup comment related stuffs for `typst-ts-mode'."
   ;; stolen from `c-ts-common-comment-setup'
   (setq-local comment-start "// ")
   (setq-local comment-end "")



[nongnu] elpa/typst-ts-mode 5ee0e33683 010/246: feat: math fontification support

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 5ee0e336838df2ae70b535cdaef28886949144ae
Author: Ziqi Yang 
Commit: Ziqi Yang 

feat: math fontification support
---
 basic-syntax.typ  |  9 +
 highlight.compare.scm | 28 +--
 typst-ts-mode.el  | 52 +++
 3 files changed, 67 insertions(+), 22 deletions(-)

diff --git a/basic-syntax.typ b/basic-syntax.typ
index 70704ff11c..5628099a0e 100644
--- a/basic-syntax.typ
+++ b/basic-syntax.typ
@@ -20,6 +20,9 @@ sudo rm -rf *
  // label
 @reference // reference
 
+Hello\nWorld // escape
+
+
 #(4.2) // number
 #"El Psy Kongaroo" // string
 #[El Psy Kongraoo] // content
@@ -70,3 +73,9 @@ sudo rm -rf *
 )
 #(a, c: b) // tagged
 #a.b // field
+
+$a$ // math
+$ 1 + 1 = 2 $
+$ E = m * c^2 $
+$eq.not(0)$
+$ cal(A) := { x in RR | x "is natural" } $
diff --git a/highlight.compare.scm b/highlight.compare.scm
index e88ab2506b..969f1bb231 100644
--- a/highlight.compare.scm
+++ b/highlight.compare.scm
@@ -30,9 +30,9 @@
 (mul "*" @operator)   ;; DONE code
 (div "/" @operator)   ;; DONE code
 (cmp ["==" "<=" ">=" "!=" "<" ">"] @operator) ;; DONE code
-(fraction "/" @operator)  ;; TODO math
-(fac "!" @operator)   ;; TODO math
-(attach ["^" "_"] @operator)  ;; TODO math
+(fraction "/" @operator)  ;; DONE math
+(fac "!" @operator)   ;; DONE math
+(attach ["^" "_"] @operator)  ;; DONE math
 (wildcard) @operator  ;; DONE code
 
 ; VALUE
@@ -61,19 +61,19 @@
 (strong "*" @operator) @markup.bold ;; DONE markup 
 (item) @markup.list ;; DONE markup
 (term) @markup.list ;; DONE markup
-(symbol) @constant.character;; TODO math
+(symbol) @constant.character;; DONE math
 (shorthand) @constant.builtin   ;; DONE common
 (quote) @markup.quote   ;; DONE markup
-(align) @operator   ;; TODO math
-(letter) @constant.character;; TODO math
+(align) @operator   ;; DONE math
+(letter) @constant.character;; DONE math
 (linebreak) @constant.builtin   ;; DONE markup
 
-(math "$" @operator)
-"#" @operator
-"end" @operator
+(math "$" @operator) ;; DONE math
+"#" @operator;; DONE code
+"end" @operator  ;; DONE code
 
-(escape) @constant.character.escape
-["(" ")" "{" "}"] @ponctuation.bracket
-["," ";" ".." ":" "sep"] @ponctuation.delimiter
-"assign" @ponctuation
-(field "." @ponctuation)
+(escape) @constant.character.escape ;; DONE markup
+["(" ")" "{" "}"] @ponctuation.bracket  ;; DONE 
+["," ";" ".." ":" "sep"] @ponctuation.delimiter ;; DONE
+"assign" @ponctuation   ;; DONE
+(field "." @ponctuation);; DONE
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index b1a76137bf..cbb4dcf7cc 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -166,6 +166,11 @@
   "Face for linebreak."
   :group 'typst-ts-faces)
 
+(defface typst-ts-markup-escape-face
+  '((t :inherit escape-glyph))
+  "Face for linebreak."
+  :group 'typst-ts-faces)
+
 (defface typst-ts-markup-raw-indicator-face
   '((t :inherit shadow))
   "Face for rawblock and rawspan indicator."
@@ -221,6 +226,22 @@
   "Face for reference."
   :group 'typst-ts-faces)
 
+;; Code Faces 
===
+
+(defface typst-ts-code-indicator-face
+  '((t :inherit shadow))
+  "Face for code indicator #."
+  :group 'typst-ts-faces)
+
+
+;; Math Faces 
===
+
+(defface typst-ts-math-indicator-face
+  '((t :inherit shadow))
+  "Face for math indicator $."
+  :group 'typst-ts-faces)
+
+
 (defvar typst-ts-mode-font-lock-rules
   '(;; Typst font locking
 :language typst
@@ -245,6 +266,7 @@
   (text) @typst-ts-markup-term-description-face)
  (quote) @typst-ts-markup-quote-face
  (linebreak) @typst-ts-markup-linebreak-face
+ (escape) @typst-ts-markup-escape-face
  (raw_span
   "`" @typst-ts-markup-rawspan-indicator-face
   (blob) @typst-ts-markup-rawspan-blob-face
@@ -257,9 +279,12 @@
  (label) @typst-ts-markup-label-face ;; TODO more precise highlight 
(upstream)
  (ref) @typst-ts-markup-reference-face)
 
+;; please note that some feature there also in the math mode
 :language typst
 :feature code
-((number) @font-lock-number-face
+("#" @typst-ts-code-indicator-face
+ ;; "end" @typst-ts-code-indicator-face ;; "end" is nothing but only a 
indicator
+ (number) @font-lock-number-face
  (string) @font-lock-string-face
  (content ["[" "]"] @font-lock-punctuation-face)
  (builtin) @font-lock-builtin-face
@@ -268,6 +293,11 @@
  (auto) @font-lock-constant-face
  (ident) @font-lock-variable-use-face
 
+ ["(" ")" "{" "}"] @fon

[nongnu] elpa/typst-ts-mode d23140e91f 013/246: feat: add imenu support

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit d23140e91f9023043d151098c58a62fc9135c233
Author: Ziqi Yang 
Commit: Ziqi Yang 

feat: add imenu support
---
 README.md| 17 -
 basic-syntax.typ |  2 +-
 typst-ts-mode.el | 17 +
 3 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index 8f074d559c..1040b8f8a2 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,19 @@
 # typst-ts-mode
 
-![Static Badge](https://img.shields.io/badge/Made_with-Emacs-purple)  
+![Static Badge](https://img.shields.io/badge/Made_with-Emacs-purple)
 
 [Project](https://git.sr.ht/~meow_king/typst-ts-mode)
-[Public Inbox](https://lists.sr.ht/~meow_king/public-inbox): General Consults  
-[Sending a Patch](https://lists.sr.ht/~meow_king/dev)  
-[Discussion](https://lists.sr.ht/~meow_king/discussion): Questions and 
Feedback  
+[Public Inbox](https://lists.sr.ht/~meow_king/public-inbox): General Consults
+[Sending a Patch](https://lists.sr.ht/~meow_king/dev)
+[Discussion](https://lists.sr.ht/~meow_king/discussion): Questions and Feedback
 [Tickets](https://todo.sr.ht/~meow_king/typst-ts-mode)
 
-
 https://github.com/uben0/tree-sitter-typst
+
+``` emacs-lisp
+(setq
+ consult-imenu-config (append consult-imenu-config
+  '((typst-ts-mode :topLevel "Headings" :types
+   ((?h "Headings" 
typst-ts-markup-header-face)
+(?f "Functions" 
font-lock-function-name-face))
+```
diff --git a/basic-syntax.typ b/basic-syntax.typ
index ba0e56921b..0e2752cad4 100644
--- a/basic-syntax.typ
+++ b/basic-syntax.typ
@@ -1,4 +1,4 @@
-// This file only serves for testing highlight, and it is not a syntax 
completion test. 
+// This file only serves for testing highlight, and it is not a syntax 
completion test.
 
 // comment
 
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 6205dfc0ac..3ec039fe02 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -430,6 +430,17 @@ TYPES."
   (group (or (syntax comment-end)
  (seq (+ "*") "/"))
 
+(defun typst-ts-mode--imenu-function-defintion-p (node)
+  "Whether NODE is a function defintion node."
+  (let* ((parent-node (treesit-node-parent node))
+ (grandparent-node (treesit-node-parent parent-node)))
+(and (equal (treesit-node-type node) "ident")
+ (equal (treesit-node-type parent-node) "call")
+ (equal (treesit-node-type grandparent-node) "let"
+
+(defun typst-ts-mode--imenu-name-function (node)
+  "Generate name of NODE for displaying in Imenu."
+  (treesit-node-text node))
 
 ;;;###autoload
 (define-derived-mode typst-ts-mode text-mode "Typst"
@@ -464,6 +475,12 @@ TYPES."
   ;; Indentation
   (setq-local treesit-simple-indent-rules typst-ts-mode--indent-rules)
 
+  ;; Imenu
+  (setq-local treesit-simple-imenu-settings
+  `(("Functions" typst-ts-mode--imenu-function-defintion-p nil
+ typst-ts-mode--imenu-name-function)
+("Headings" "^heading$" nil 
typst-ts-mode--imenu-name-function)))
+
   (treesit-major-mode-setup))
 
 ;; TODO check consistence with typst-mode



[nongnu] elpa/typst-ts-mode 5700854a1e 036/246: doc: update README

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 5700854a1e159e0601870a6abd1ad2e6609d67be
Author: Ziqi Yang 
Commit: Ziqi Yang 

doc: update README
---
 README.md | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 35e3abf1e3..4ec0407e65 100644
--- a/README.md
+++ b/README.md
@@ -4,10 +4,10 @@ Tree Sitter support for Typst. Minimum Emacs version 
requirement: 29.
 
 ![Static Badge](https://img.shields.io/badge/Made_with-Emacs-purple)
 
-[Project](https://sr.ht/~meow_king/typst-mode)  
-[Home Package for this Package](https://git.sr.ht/~meow_king/typst-ts-mode)  
-[Send a Patch](https://lists.sr.ht/~meow_king/dev)  
-[Discussion](https://lists.sr.ht/~meow_king/discussion): Questions and 
Feedback  
+[Project Page](https://sr.ht/~meow_king/typst-mode)  
+[Home Page for this Package](https://git.sr.ht/~meow_king/typst-ts-mode)  
+[Send a Patch](https://lists.sr.ht/~meow_king/typst-ts-mode-dev)  
+[Discussion](https://lists.sr.ht/~meow_king/typst-ts-mode-discussion): 
Questions and Feedback  
 [Tickets](https://todo.sr.ht/~meow_king/typst-ts-mode): issues, feature 
requests, etc.  
 [Public Inbox](https://lists.sr.ht/~meow_king/public-inbox): General Consults
 



[nongnu] elpa/typst-ts-mode 439deb4b07 022/246: fix(preview): open non-english character file name

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 439deb4b07e926c69950a7b3ed916315356a50dd
Author: Ziqi Yang 
Commit: Ziqi Yang 

fix(preview): open non-english character file name
---
 typst-ts-mode.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 63d231cbf9..6ec45c9d2f 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -562,7 +562,8 @@ buffer before compilation."
   "Open the result compile file.
 FILE: file path for the result compile file."
   (interactive (list (concat (file-name-base buffer-file-name) ".pdf")))
-  (browse-url-of-file file))
+  ;; don't use `browse-url-of-file', which cannot open non-english documents
+  (browse-url file))
 
 (defun typst-ts-mode-compile-and-preview--compilation-finish-function 
(cur-buffer)
   "For `typst-ts-mode-compile-and-preview' and `compilation-finish-functions'.



[nongnu] elpa/typst-ts-mode 6c0c55f4f2 051/246: feat: add indentation rule for item with linebreak at ending

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 6c0c55f4f2b0e605ebc5d37de689438003702f46
Author: Meow King 
Commit: Meow King 

feat: add indentation rule for item with linebreak at ending

For example:
1. hello \
identation

2. hi
noidentation
---
 typst-ts-mode.el | 25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index cd987a43c7..1b6ca0c1ce 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -471,8 +471,9 @@ Return nil if the node is not inside brackets."
t))
 
 (defun typst-ts-mode--ancestor-in (types &optional return-bol)
-  "Return a function which is suits `treesit-simple-indent-rules' Match.
-An ancestor includes the query node itself.
+  "Return a function to check whether one of the ancestors of a node is in 
TYPES.
+The returned function suits `treesit-simple-indent-rules' Match.
+Ancestors include the query node itself.
 If RETURN-BOL is non-nil, then return returns the beginning of line position of
 the corresponding ancestor node that its type is in TYPES, else return the
 corresponding ancestor node.  Return nil if ancestor not matching."
@@ -504,7 +505,7 @@ TYPES."
   ;; rule matches.
   `((typst
  ;; ((lambda (node parent bol)
- ;;(message "%s %s %s" (treesit-node-type node) (treesit-node-type 
parent) bol)
+ ;;(message "%s %s %s" node parent bol)
  ;;nil) parent-bol 0)
 
  ((and (node-is ")") (parent-is "group")) parent-bol 0)
@@ -521,6 +522,24 @@ TYPES."
  ((and no-node ,(typst-ts-mode--ancestor-in (list "raw_blck")))
   no-indent 0)
 
+ ;; previous line is item type and the ending is a linebreak
+ ((and no-node
+   (lambda (_node _parent bol)
+ (when-let* (((not (eq bol (point-min
+ (prev-line-node (treesit-node-at (- bol 2)))
+ (prev-line-heading-node
+  (save-excursion
+(previous-logical-line)
+(back-to-indentation)
+(treesit-node-at (point
+ (prev-line-top-node (treesit-node-parent
+  prev-line-heading-node)))
+   (and
+(equal (treesit-node-type prev-line-top-node) "item")
+(equal (treesit-node-type prev-line-heading-node) "-")
+(equal (treesit-node-type prev-line-node) "linebreak")
+  parent-bol typst-ts-mode-indent-offset)
+
  ((and no-node
,(typst-ts-mode--ancestor-in typst-ts-mode--bracket-node-types))
   ,(typst-ts-mode--ancestor-bol typst-ts-mode--bracket-node-types)



[nongnu] elpa/typst-ts-mode 545bd677be 172/246: feat: add transient menu

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 545bd677be523bbd366400d3919a40b4c58869ad
Author: Meow King 
Commit: Meow King 

feat: add transient menu
---
 typst-ts-misc-commands.el | 11 ++-
 typst-ts-mode.el  |  7 +--
 typst-ts-transient.el | 47 +++
 3 files changed, 58 insertions(+), 7 deletions(-)

diff --git a/typst-ts-misc-commands.el b/typst-ts-misc-commands.el
index bb2e5ec964..1031675999 100644
--- a/typst-ts-misc-commands.el
+++ b/typst-ts-misc-commands.el
@@ -1,4 +1,4 @@
-;;; typst-ts-misc-commands.el --- core functions for typst-ts-mode -*- 
lexical-binding: t; -*-
+;;; typst-ts-misc-commands.el --- Miscellaneous commands for typst-ts-mode -*- 
lexical-binding: t; -*-
 ;; Copyright (C) 2023-2024 The typst-ts-mode Project Contributors
 
 ;; This file is NOT part of Emacs.
@@ -21,11 +21,20 @@
 
 ;;; Code:
 
+(require 'treesit)
+
 ;; (defgroup typst-ts-mc nil
 ;;   "Typst ts miscellaneous commands."
 ;;   :prefix "typst-ts-misc-commands"
 ;;   :group 'typst-ts)
 
+(defun typst-ts-mc-install-grammar ()
+  (interactive)
+  (let ((treesit-language-source-alist treesit-language-source-alist))
+(add-to-list 'treesit-language-source-alist
+ '(typst "https://github.com/Ziqi-Yang/tree-sitter-typst";))
+(treesit-install-language-grammar 'typst)))
+
 
 (defun typst-ts-mc-export-to-markdown ()
   (interactive)
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index bc2a873902..084c977e52 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -42,6 +42,7 @@
 (require 'typst-ts-editing)
 (require 'typst-ts-lsp)
 (require 'typst-ts-misc-commands)
+(require 'typst-ts-transient)
 
 (defgroup typst-ts nil
   "Tree Sitter enabled Typst Writing."
@@ -756,12 +757,6 @@ typst tree sitter grammar (at least %s)!" 
(current-time-string min-time))
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("\\.typ\\'" . typst-ts-mode))
 
-(defun typst-ts-mode-install-grammar ()
-  (interactive)
-  (let ((treesit-language-source-alist treesit-language-source-alist))
-(add-to-list 'treesit-language-source-alist
- '(typst "https://github.com/Ziqi-Yang/tree-sitter-typst";))
-(treesit-install-language-grammar 'typst)))
 
 (provide 'typst-ts-mode)
 
diff --git a/typst-ts-transient.el b/typst-ts-transient.el
new file mode 100644
index 00..1db16983c9
--- /dev/null
+++ b/typst-ts-transient.el
@@ -0,0 +1,47 @@
+;;; typst-ts-transient.el --- Transient menu for typst-ts-mode -*- 
lexical-binding: t; -*-
+;; Copyright (C) 2023-2024 The typst-ts-mode Project Contributors
+
+;; This file is NOT part of Emacs.
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Commentary:
+
+;; Miscellaneous commands
+
+;;; Code:
+
+(require 'transient)
+(require 'typst-ts-compile)
+(require 'typst-ts-misc-commands)
+
+(transient-define-prefix typst-ts-tmenu ()
+  "Typst-ts-mode transient menu."
+  [["Compile"
+("c" "compile & preview" typst-ts-compile-and-preview)
+("C" "compile" typst-ts-compile)
+("w" "watch" typst-ts-watch-mode)
+("p" "preview" typst-ts-mode-preview)]
+   
+   ["Export"
+("em" "markdown" typst-ts-mc-export-to-markdown)]
+   
+   ["Search"
+("ss" "symbol" typst-ts-mc-search-typst-symbol)
+("sr" "recognize symbol" typst-ts-mc-recognize-typst-symbol)
+("sp" "package" typst-ts-mc-search-package)]])
+
+
+(provide 'typst-ts-transient)
+
+;;; typst-ts-transient.el ends here



[nongnu] elpa/typst-ts-mode d9392ce43f 180/246: fix: delete list item when there is no text

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit d9392ce43ff4f8aa0ffe5d72883220ca4b0ccca0
Author: Huan Nguyen 
Commit: Huan Nguyen 

fix: delete list item when there is no text

- 1
- |< this line should be gone after pressing RETURN
---
 typst-ts-editing.el | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index e3b992da1d..2626d7f3e0 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -124,11 +124,10 @@ When prefix ARG is non-nil, call global return function."
 ;; on item node end
 ((and (eolp)
   (setq node 
(typst-ts-core-get-parent-of-node-at-bol-nonwhite))
-  (equal (treesit-node-type node) "item")
-  (length= (treesit-node-children node) 2))
+  (equal (treesit-node-type node) "item"))
  (if (> (treesit-node-child-count node) 1)
  (typst-ts-mode-insert--item node)
-   ;; no text means delete the item on current line
+   ;; no text means delete the item on current line: (item -) 
instead of (item - (text))
(beginning-of-line)
(kill-line)
(indent-according-to-mode))



[nongnu] elpa/typst-ts-mode f17ec1efa2 136/246: test: add indentation test file

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit f17ec1efa27445a0cd6d6297456abe2bd964fb20
Author: Meow King 
Commit: Meow King 

test: add indentation test file
---
 indentation-test.typ | 110 +++
 1 file changed, 110 insertions(+)

diff --git a/indentation-test.typ b/indentation-test.typ
new file mode 100644
index 00..c75b4e4e16
--- /dev/null
+++ b/indentation-test.typ
@@ -0,0 +1,110 @@
+// Note that some indentation bugs can only be found on real time inserting
+// Use `typst-ts/util/setup-indent-debug-environment' function in 
`side/utils.el'
+// you may also want to turn off `auto-visited-file-mode` or similar (for 
testing
+// end of buffer condition)
+
+// typst-ts-mode-indent-offset: 4
+
+#show: cv.with(
+author: "",
+[
+emacs
+eacs
+emacs
+emacs
+]
+)
+
+= El
+== Psy
+1. Kongaroo
+== ERROR indentation
+
+= Header 1
+stuff
+== Header 2
+stuff
+== Header 2
+- list
++ list
++ list
+2. list
+- list \
+El Psy Kongaroo
+El Psy Kongaroo \
+El Psy Kongaroo
+
+stuff
+=== Header 3
+stuffs
+stuffs
+
+= Raw Block
+```rust
+fn main() {
+println!("El Psy Kongaroo");
+}
+```
+
+```rust
+  fn main() {
+
+  }
+  ``` // FIXME: should be 0 offset
+
+= Script
+#if 1 < 2 [
+This is shown
+] else [
+This is not
+]
+
+#let n = 2
+#while n < 10 {
+n = (n * 2) - 1
+(n,)
+}
+
+#for letter in "abc nope" {
+if letter == " " {
+break
+}
+
+letter
+}
+
+#(
+"a, b, c"
+.split(", ")
+.join[ --- ]
+)
+
+= Math
+$
+A = pi r^2
+$
+  
+#[
+$
+cal(A) := {
+x in RR | x "is natural"
+}
+$
+]
+
+$
+cal(A) :=
+{
+x in RR | x "is natural"
+}
+$
+
+$ sum_(k=0)^n k
+&= 1 + ... + n \
+&= (n(n+1)) / 2 $
+
+$
+sum_(k=0)^n k
+&= 1 + ... + n \
+&= (n(n+1)) / 2
+$



[nongnu] elpa/typst-ts-mode d799bdffb0 088/246: doc: Rename variable and add it to documentation.

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit d799bdffb0c18c541f98d3f0847ae2722bde12fe
Author: Huan Nguyen 
Commit: Huan Nguyen 

doc: Rename variable and add it to documentation.
---
 README.md|  5 -
 typst-ts-mode.el | 18 ++
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md
index 043df9e45a..a71663bb53 100644
--- a/README.md
+++ b/README.md
@@ -83,6 +83,8 @@ For reference, this is my configuration.
 `M-`: `typst-ts-mode-heading-up`  
 `M-`  : `typst-ts-mode-heading-down`  
 `TAB`   : `typst-ts-mode-cycle`  
+`M-`: `typst-ts-mode-meta-return`  
+``  : `typst-ts-mode-return`  
 
 *NOTE*: `outline-minor-mode` is enabled by `typst-ts-mode`, so you can use 
comamnd 
 defined by `outline-minor-mode` such as `outline-cycle`.
@@ -92,7 +94,7 @@ defined by `outline-minor-mode` such as `outline-cycle`.
 For customizable options: `customize` -> `typst-ts`.  
 
 Here are some options you may find useful:  
-1. `typst-ts-mode-indent-offset` (default 4)  
+1. `typst-ts-mode-indent-offset` (default 2)  
 2. `typst-ts-mode-executable-location`  
 3. `typst-ts-mode-watch-options`.  
Set this to `--open` so typst will open the compiled file for you.
@@ -108,6 +110,7 @@ Here are some options you may find useful:
[auto-save](https://github.com/manateelazycat/auto-save) or 
[super-save](https://github.com/bbatsov/super-save) useful (or annoying).
 6. `typst-ts-mode-before-compile-hook` and `typst-ts-mode-after-compile-hook`  
+7. `typst-ts-mode-return-autoincrement` autoincrement lists when pressing 
RETURN (default `t`).
 
 ### Fontification
 1. `typst-ts-mode-fontification-precise-level` (default `'middle`)  
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index e0f1695e64..450cdcfe5f 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -154,11 +154,13 @@ level.  See 
`typst-ts-mode-fontification-precision-level'."
   :type 'boolean
   :group 'typst-ts-faces)
 
-(defcustom typst-ts-mode-return-smart t
-  "Whether return key should behave smart.
-Smart as in, automatically insert a new list item when point before
-pressing return was on an item.
-Pressing return again without inserting a value will remove the list item.
+(defcustom typst-ts-mode-return-autoincrement t
+  "Whether return key should autoincrement.
+Smart as in, when point is on an item with text,
+pressing return will insert a newline and then an item.
+
+When point is on an item without text pressing return it will remove the item.
+
 Example:
 + item RETURN
 + |< point is now here
@@ -1027,13 +1029,13 @@ Using ARG argument will ignore the context and it will 
insert a heading instead.
   (typst-ts-mode-insert--heading node)
 
 (defun typst-ts-mode-return (&optional arg interactive)
-  "Do something smart when `typst-ts-mode-return-smart' is non nil.
+  "Do something smart when `typst-ts-mode-return-autoincrement' is non nil.
 Pressing enter will do something depending on context.
 ARG and INTERACTIVE will be passed to `newline'.
 INTERACTIVE will be non nil when called interactively.
-`typst-ts-mode-return-smart' for more documentation."
+`typst-ts-mode-return-autoincrement' for more documentation."
   (interactive "*P\np")
-  (if (or arg (not typst-ts-mode-return-smart))
+  (if (or arg (not typst-ts-mode-return-autoincrement))
   (newline (if arg arg 1) interactive)
 (let ((node (typst-ts-mode--item-on-line-p)))
   (cond



[nongnu] elpa/typst-ts-mode 04c2cbab75 138/246: sync upstream

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 04c2cbab75b547cb13cb11ae3926794cee11a184
Author: Meow King 
Commit: Meow King 

sync upstream
---
 .gitignore|   1 +
 justfile  |  11 ++-
 side/sync_with_upstream.typ   | 101 ++
 test/basic-syntax.pdf | Bin 0 -> 179508 bytes
 basic-syntax.typ => test/basic-syntax.typ |  47 +-
 test/dumb_import.typ  |   2 +
 indentation-test.typ => test/indentation-test.typ |   0
 typst-ts-mode.el  |  19 ++--
 8 files changed, 141 insertions(+), 40 deletions(-)

diff --git a/.gitignore b/.gitignore
index 26b0e1402c..4c0e86d826 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 *.elc
+/side/*.pdf
 /makem.sh
 
 # Added by cargo
diff --git a/justfile b/justfile
index ed05277fd6..57c3887583 100644
--- a/justfile
+++ b/justfile
@@ -1,11 +1,10 @@
 els-settings-test:
-emacs --batch -l ./typst-ts-embedding-lang-settings.el \
--l ~/.emacs.d/.local/elpaca/repos/emacs-kotlin-ts-mode/kotlin-ts-mode.el \
--l ~/.emacs.d/.local/elpaca/repos/mermaid-ts-mode/mermaid-ts-mode.el \
+emacs --batch -l ./typst-ts-utils.el \
+-l ./typst-ts-embedding-lang-settings.el \
+-l 
~/.config/emacs/.local/elpaca/repos/emacs-kotlin-ts-mode/kotlin-ts-mode.el \
+-l ~/.config/emacs/.local/elpaca/repos/mermaid-ts-mode/mermaid-ts-mode.el \
 --eval "(typst-ts-embedding-lang-settings-test)"
 
 lint:
+# makem: https://github.com/alphapapa/makem.sh
 ./makem.sh lint
-
-lint-29:
-./makem.sh lint -E ~/myBin/emacs29.2
diff --git a/side/sync_with_upstream.typ b/side/sync_with_upstream.typ
new file mode 100644
index 00..877f59db8d
--- /dev/null
+++ b/side/sync_with_upstream.typ
@@ -0,0 +1,101 @@
+#import "@preview/cheq:0.1.0": unchecked-sym, checked-sym
+
+#let yes = checked-sym(fill: luma(95%), stroke: blue, radius: .2em)
+#let todo = unchecked-sym(fill: luma(95%), stroke: blue, radius: .2em)
+
+#let cyan = rgb("EAF2F5")
+#set table(fill: (_, y) => if y == 0 { cyan })
+#let tableSep(content) = table.cell(fill: cyan, colspan: 2, text(content))
+
+#link("https://github.com/uben0/tree-sitter-typst?tab=readme-ov-file";)[tree-sitter-typst]
+
+Grammar File Path: `/queries/typst/highlights.scm`
+
+Corresponding Commit: `4610172f312e8ce5184e6882be5ad1a1cd800fbe`
+
+Use `git diff` or `git blame` to get the grammar change.
+
+#table(
+columns: 2,
+table.header[*Rule*][*Status*],
+[`(call item: (ident) @function)`]   , yes,
+[`(call item: (field field: (ident) @function.method))`] , yes,
+[`(tagged field: (ident) @tag)`] , yes,
+[`(field field: (ident) @tag)`]  , yes,
+[`(comment) @comment`]   , yes,
+
+tableSep([_Control_]),
+[`(let "let" @keyword.storage.type)`]   , yes,
+[`(branch ["if" "else"] @keyword.control.conditional)`] , yes,
+[`(while "while" @keyword.control.repeat)`] , yes,
+[`(for ["for" "in"] @keyword.control.repeat)`]  , yes,
+[`(import "import" @keyword.control.import)`]   , yes,
+[`(as "as" @keyword.operator)`] , yes,
+[`(include "include" @keyword.control.import)`] , yes,
+[`(show "show" @keyword.control)`]  , yes,
+[`(set "set" @keyword.control)`], yes,
+[`(return "return" @keyword.control)`]  , yes,
+[`(flow ["break" "continue"] @keyword.control)`], yes,
+
+tableSep([_OPERATOR_]),
+[`(in ["in" "not"] @keyword.operator)`]   , yes,
+[`(context "context" @keyword.control)`]  , yes,
+[`(and "and" @keyword.operator)`] , yes,
+[`(or "or" @keyword.operator)`]   , yes,
+[`(not "not" @keyword.operator)`] , yes,
+[`(sign ["+" "-"] @operator)`], yes,
+[`(add "+" @operator)`]   , yes,
+[`(sub "-" @operator)`]   , yes,
+[`(mul "*" @operator)`]   , yes,
+[`(div "/" @operator)`]   , yes,
+[`(cmp ["==" "<=" ">=" "!=" "<" ">"] @operator)`] , yes,
+[`(fraction "/" @operator)`]  , yes,
+[`(fac "!" @operator)`]   , yes,
+[`(attach ["^" "_"] @operator)`]  , yes,
+[`(wildcard) @operator`]  , yes,
+
+tableSep([_VALUE_]),
+[#raw("(raw_blck \"```\" @operator) @markup.raw.block")] , yes,
+[```(raw_span "`" @operator) @markup.raw.block```]   , yes,
+[`(raw_blck lang: (ident) @tag)`], yes,
+[`(label) @tag`] , yes,
+[`(ref) @tag`]

[nongnu] elpa/typst-ts-mode 443d92f868 156/246: feat!: raw block highlight now uses non-tree-sitter method!

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 443d92f8683e6454f997df4362945f71b8e50835
Author: Meow King 
Commit: Meow King 

feat!: raw block highlight now uses non-tree-sitter method!
---
 justfile|   9 +-
 typst-ts-embedding-lang-settings.el | 739 +++-
 typst-ts-mode.el|  91 ++---
 3 files changed, 67 insertions(+), 772 deletions(-)

diff --git a/justfile b/justfile
index 9e04bc8b37..ecd4e25a01 100644
--- a/justfile
+++ b/justfile
@@ -4,18 +4,11 @@ emacs := env("EMACS", "emacs")
 test-file := env("TEST_FILE", "./test/basic-syntax.typ")
 
 eval:
-{{emacs}} -Q -L . --eval "(require 'typst-ts-mode)" {{test-file}}
+{{emacs}} -Q --debug-init -L . --eval "(require 'typst-ts-mode)" 
{{test-file}}
 
 clean:
 rm -f ./*.elc
 
-els-settings-test:
-{{emacs}} --batch -l ./typst-ts-utils.el \
--l ./typst-ts-embedding-lang-settings.el \
--l 
~/.config/emacs/.local/elpaca/repos/emacs-kotlin-ts-mode/kotlin-ts-mode.el \
--l ~/.config/emacs/.local/elpaca/repos/mermaid-ts-mode/mermaid-ts-mode.el \
---eval "(typst-ts-embedding-lang-settings-test)"
-
 lint:
 # makem: https://github.com/alphapapa/makem.sh
 ./makem.sh lint
diff --git a/typst-ts-embedding-lang-settings.el 
b/typst-ts-embedding-lang-settings.el
index c663fb8c53..c1edfbabdb 100644
--- a/typst-ts-embedding-lang-settings.el
+++ b/typst-ts-embedding-lang-settings.el
@@ -23,199 +23,6 @@
 (require 'treesit)
 (require 'typst-ts-core)
 
-(defcustom typst-ts-highlight-raw-block-langs-not-in-predefined-settings t
-  "Whether to highlight raw block of language that is not in settings.
-i.e. not in `typst-ts-embedding-lang-settings'.
-The cost for setting up other languages is usually higher than those
-languages in settings."
-  :type 'boolean
-  :group 'typst-ts)
-
-(defvar typst-ts-els-lang-tags-map
-  #s(hash-table
- size 182
- test equal
- data
- (
-  txt ("txt" )
-  asp ("asa" "asp" )
-  actionscript ("actionscript" "as" )
-  applescript ("applescript" "script editor" )
-  bat ("bat" "cmd" )
-  build ("build" )
-  c-sharp ("cs" "c#" "csx" )
-  cpp ("cc" "cp" "cxx" "c++" "hpp" "hxx" "cpp" "inl" "ipp" "h++" "hh" )
-  c ("c" )
-  css ("css.erb" "css" "css.liquid" )
-  clojure ("cljs" "edn" "clj" "cljc" "clojure" )
-  d ("di" "d" )
-  diff ("diff" "patch" )
-  erlang ("erlang" "emakefile" "escript" "erl" "hrl" )
-  yaws ("yaws" )
-  attributes ("attributes" ".gitattributes" "gitattributes" )
-  commit_editmsg ("tag_editmsg" "merge_msg" "commit_editmsg" )
-  gitconfig (".gitconfig" ".gitmodules" "gitconfig" )
-  exclude ("exclude" "gitignore" ".gitignore" )
-  .git (".git" )
-  gitlog ("gitlog" )
-  .mailmap (".mailmap" "mailmap" )
-  git-rebase-todo ("git-rebase-todo" )
-  go ("go" )
-  dot ("dot" "gv" )
-  groovy ("groovy" "gradle" "gvy" "jenkinsfile" )
-  html ("htm" "shtml" "html" "xhtml" )
-  haskell ("hs" "haskell" )
-  lhs ("lhs" )
-  json ("ipynb" "sublime-build" "sublime-theme" "sublime-keymap" 
"sublime-macro" "sublime-color-scheme" "sublime-completions" "sublime-project" 
"pipfile.lock" "sublime-settings" "json" "sublime-mousemap" "sublime-commands" 
"sublime-menu" )
-  jsp ("jsp" )
-  java ("java" "bsh" )
-  javadoc ("javadoc" )
-  properties ("properties" )
-  javascript ("js" "htc" "javascript" )
-  bibtex ("bib" "bibtex" )
-  latex ("ltx" "latex" )
-  tex ("cls" "sty" "tex" )
-  commonlisp ("clisp" )
-  lisp ("lsp" "lisp" "ss" "l" "fasl" "el" "mud" "cl" "scm" )
-  lua ("lua" )
-  makefile ("makefile.am" "ocamlmakefile" "make" "makefile" "mk" 
"gnumakefile" "mak" "makefile.in" )
-  markdown ("markdn" "markdown" "mdown" "md" )
-  multimarkdown ("multimarkdown" )
-  matlab ("matlab" )
-  ocaml ("mli" "ocaml" "ml" )
-  ocamllex ("mll" "ocamllex" )
-  ocamlyacc ("mly" "ocamlyacc" )
-  camlp4 ("camlp4" )
-  objective-c++ ("objective-c++" "mm" )
-  objective-c ("m" "h" "objective-c" )
-  php ("phtml" "php" "php5" "php7" "phpt" "php4" "php3" "phps" )
-  pascal ("dpr" "p" "pas" "pascal" )
-  perl ("pc" "pl" "perl" "pmc" "t" "pm" "pod" )
-  python ("pxi" "bazel" "rpy" "gyp" "python" "py" "py3" "bzl" "pyw" 
"pxd.in" "pyx.in" "snakefile" "sconscript" "pyi" "sconstruct" "wscript" "pyx" 
"pxd" "pxi.in" "gypi" "cpy" "vpy" )
-  r ("r" "rprofile" )
-  rd ("rd" )
-  rails ("html.erb" "rails" "erb" "rhtml" )
-  js.erb ("js.erb" )
-  haml ("sass" "haml" )
-  rxml ("builder" "rxml" )
-  erbsql ("erbsql" "sql.erb" )
-  re ("re" )
-  restructuredtext ("restructuredtext" "rest" "rst" )
-  ruby ("brewfile" "fcgi" "jbuilder" "appfile" "rakefile" "ruby" 
"cheffile" "rabl" "podfile" "rbx" "config.ru" "irbrc" "cgi" "deliverfile" 
"guardfile" "gemfile" "appraisals" "ruby.rail" "gemspec" "vagrantfile" 
"berk

[nongnu] elpa/typst-ts-mode b68f3595aa 140/246: chore

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit b68f3595aa67b52df24094f30632c4a8c35cc73b
Author: Meow King 
Commit: Meow King 

chore
---
 typst-ts-edit-indirect.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/typst-ts-edit-indirect.el b/typst-ts-edit-indirect.el
index 472dc00742..115a43b52d 100644
--- a/typst-ts-edit-indirect.el
+++ b/typst-ts-edit-indirect.el
@@ -110,7 +110,8 @@ If there is no fitting mode or no lang it will be 
`normal-mode'."
   (save-excursion
 (goto-char beg)
 (insert " "))
-  (edit-indirect-region beg end t)
+  (when (fboundp 'edit-indirect-region)  ; pass elisp's dumb linter
+(edit-indirect-region beg end t))
   ;; delete the inserted space
   (save-excursion
 (goto-char (point-min))



[nongnu] elpa/typst-ts-mode 1a3126f6b1 108/246: fix(indentation): inside ERROR

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 1a3126f6b146e94fd5518ec7ed9df36b6c3c8a37
Author: Meow King 
Commit: Meow King 

fix(indentation): inside ERROR
---
 typst-ts-mode.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index eec10dff33..6df6844ac6 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -853,6 +853,7 @@ Used in `typst-ts-mode-indent-rules'."
  ;;nil)
  ;;  parent-bol 0)
  
+ ((and no-node (parent-is "source_file")) prev-line 0)
  ((parent-is "source_file") column-0 0)
 
  ((n-p-gp ,(regexp-opt '(")" "]" "}" "$"))
@@ -909,6 +910,8 @@ Used in `typst-ts-mode-indent-rules'."
 
  (no-node parent-bol 0)
 
+ ((parent-is "ERROR") no-indent 0)
+
  ;; example: (item (text) (text) (text)) when `(text)' is in different line
  (catch-all prev-line 0)))
   "Tree-sitter indent rules for `rust-ts-mode'.")



[nongnu] elpa/typst-ts-mode 14affa17e3 043/246: refactor: Renamed function that finds next higher/same level heading.

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 14affa17e3679fa69188a73f8be51c55376b
Author: Huan Nguyen 
Commit: Huan Nguyen 

refactor: Renamed function that finds next higher/same level heading.
---
 typst-ts-mode.el | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 7f98386dfa..3c094c8079 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -610,7 +610,7 @@ This does not handle #heading function."
 ('left (substring-no-properties heading-string 1 heading-level))
 (_ (error "%s is not one of: `left' `right'" direction)))
 
-(defun typst-ts-mode-heading--same-or-higher (node traverse-fn)
+(defun typst-ts-mode-heading--find-same-or-higher (node traverse-fn)
   "Return the first heading that is the same level or higher than NODE.
 `car' will be the found heading node.
 `cdr' will say if it is the same level or not.
@@ -641,9 +641,9 @@ This functions does not check if NODE is actually a 
heading."
   "Return the first node with the same level as NODE.
 It will report a user-error when it could not find a node
 or it was blocked by its parent heading.
-See `typst-ts-mode-heading--same-or-higher' for TRAVERSE-FN."
+See `typst-ts-mode-heading--find-same-or-higher' for TRAVERSE-FN."
   (let* ((other-heading/level
- (typst-ts-mode-heading--same-or-higher node traverse-fn)))
+ (typst-ts-mode-heading--find-same-or-higher node traverse-fn)))
 (if (cdr other-heading/level)
(car other-heading/level)
   (user-error "Could not find another heading"
@@ -667,7 +667,7 @@ CURRENT-HEADING and its content with above heading and its 
content."
   current-heading
   #'treesit-node-next-sibling))
 (other-heading-start (treesit-node-start other-heading))
-(other-heading-end (car (typst-ts-mode-heading--same-or-higher
+(other-heading-end (car (typst-ts-mode-heading--find-same-or-higher
  other-heading
  #'treesit-node-next-sibling)))
 (current-heading-end (1- other-heading-start))
@@ -699,7 +699,7 @@ CURRENT-HEADING and its content with above heading and its 
content."
   #'treesit-node-prev-sibling))
 (other-heading-start (treesit-node-start other-heading))
 (other-heading-end (1- current-heading-start))
-(current-heading-end (car (typst-ts-mode-heading--same-or-higher
+(current-heading-end (car (typst-ts-mode-heading--find-same-or-higher
current-heading
#'treesit-node-next-sibling)))
 (current-heading-content nil)



[nongnu] elpa/typst-ts-mode 7dc8a883d0 158/246: chore: delete abandoned files

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 7dc8a883d0bdd7d9bc8a1ae83e4f57131ec29d7e
Author: Meow King 
Commit: Meow King 

chore: delete abandoned files
---
 ...block-highlighting-mechanism-explain-0.plantuml |  52 
 .../raw-block-highlighting-mechanism-explain-0.png | Bin 76229 -> 0 bytes
 ...block-highlighting-mechanism-explain-1.plantuml |  64 
 .../raw-block-highlighting-mechanism-explain-1.png | Bin 113446 -> 0 bytes
 doc/raw-block-highlighing.md   |  67 -
 5 files changed, 183 deletions(-)

diff --git a/assets/raw-block-highlighting-mechanism-explain-0.plantuml 
b/assets/raw-block-highlighting-mechanism-explain-0.plantuml
deleted file mode 100644
index 4ab4c34b6a..00
--- a/assets/raw-block-highlighting-mechanism-explain-0.plantuml
+++ /dev/null
@@ -1,52 +0,0 @@
-@startuml
-start
-floating note
-purple: built-in functions / variables
-blue: typst-ts-mode functions / variable
-red: typst-ts-mode raw block configuration variables
-end note
-
-partition customization {
-  :typst-ts-els-lang-tags-map: used in 
treesit-language-at-point-function
-  typst-ts-els-tag-lang-map: used in 
treesit-range-settings
-  typst-ts-embedding-lang-settings;
-  
-  note right
-  use function typst-ts-els--add-lang-tags-relationship and
-  function typst-ts-els--lang-name-remap to change 
variables
-  typst-ts-els-lang-tags-map and 
typst-ts-els-tag-lang-map
-  
-  use shortdoc to search for alist 
related
-  functions to modifiy typst-ts-embedding-lang-settings
-  end note
-}
-
-partition mode initialization {
-  :create typst tree sitter parser;
-  
-  if ( typst-ts-mode-enable-raw-blocks-highlight) is (t) 
then
-  :add typst-ts-els-include-dynamically function to
-  parser notification functions list;
-
-  note right
-  so typst-ts-els-include-dynamically will receive buffer
-  change notification
-  end note
-
-  :set treesit-language-at-point-function and 
treesit-range-settings;
-  
-  note right
-  They are used to create tree sitter parsers. Moreover,
-  treesit-range-settings defined which area these parser
-  will act on.
-  end note
-  
-  :run hooks (functions added in typst-ts-mode-hook);
-
-  if ( typst-ts-mode-highlight-raw-blocks-at-startup) is (t) then
-  :load and merge predefined settings from variable
-  typst-ts-embedding-lang-settings;
-  endif
-  endif
-}
-@enduml
diff --git a/assets/raw-block-highlighting-mechanism-explain-0.png 
b/assets/raw-block-highlighting-mechanism-explain-0.png
deleted file mode 100644
index e87d0533ad..00
Binary files a/assets/raw-block-highlighting-mechanism-explain-0.png and 
/dev/null differ
diff --git a/assets/raw-block-highlighting-mechanism-explain-1.plantuml 
b/assets/raw-block-highlighting-mechanism-explain-1.plantuml
deleted file mode 100644
index 67fee33a8b..00
--- a/assets/raw-block-highlighting-mechanism-explain-1.plantuml
+++ /dev/null
@@ -1,64 +0,0 @@
-@startuml
-
-floating note
-purple: built-in functions / variables
-blue: typst-ts-mode functions / variable
-red: typst-ts-mode raw block configuration variables
-end note
-
-partition editing {
-  if ( typst-ts-mode-enable-raw-blocks-highlight) is (t) 
then
-fork
-  partition function: 
treesit-language-at-point-function {
-floating note: i.e. 
typst-ts-mode--language-at-point
-:raw block tag (**ignore case**) will be converted to tree sitter
-language symbol via typst-ts-els-tag-lang-map;
-if (langauge symbol in map) is (nil) then
-  :use language symbol **typst**;
-endif
-  }
-
-  if (language symbol **not** in treesit-range-settings
-  and dynamic library file for language is loaded) then
-:treesit will create a toplevel parser of that language;
-note left
-  which is what we don't want, since it will mess the foncication
-  (i.e. highlight area outside the raw block)
-  we will delete it later
-end note
-  endif
-  
-fork again
-  partition treesit-range-settings {
-:create local parsers (parse specific areas) according to
-treesit-range-settings (which defines queries for
-finding area, and specifys parser language for that area);
-  }
-end fork
-
-partition function: typst-ts-els-include-dynamically {
-  note
-  this function is called when buffer changes.
-  see treesit-parser-add-notifier
-  end note
-
-  :get all parsers (including toplevel, local);
-
-  while (parser in parsers)
-if (the language of the parser haven't been marked loaded) then
-  if (try load settings via 
typst-ts-embedding-lang-settings) is (not success) then
-if 
(typst-ts-highlight-raw-block-langs-not-in-predefined-settings)
 is (t) then
-  :guess the corresponding tree sitter major mode of the language;
-  :create a temporary buffer with hooks disabled;
-  :load settings from local 

[nongnu] elpa/typst-ts-mode 89ee073562 045/246: chore

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 89ee073562a7bb325458a9a48e07f28d0cf3
Author: Meow King 
Commit: Meow King 

chore
---
 typst-ts-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index f1afa99eab..72db5212da 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -44,7 +44,7 @@
   :group 'typst-ts)
 
 (defcustom typst-ts-mode-indent-offset 4
-  "Number of spaces for each indentation step in `json-ts-mode'."
+  "Number of spaces for each indentation step in `typst-ts-mode'."
   :type 'integer
   :group 'typst-ts)
 



[nongnu] elpa/typst-ts-mode aad1cde153 049/246: refactor: Use outline library for headings.

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit aad1cde1538f9996f77826fa98827ba0013ca388
Author: Huan Nguyen 
Commit: Huan Nguyen 

refactor: Use outline library for headings.
---
 typst-ts-mode.el | 212 +++
 1 file changed, 58 insertions(+), 154 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index fd8fe133fc..f8d3afa04a 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -31,7 +31,7 @@
 
 (require 'treesit)
 (require 'compile)
-(require 'subr-x)
+(require 'outline)
 
 (defgroup typst-ts nil
   "Tree Sitter enabled Typst Writing."
@@ -568,6 +568,26 @@ buffer before compilation."
   (remove-hook 'compilation-finish-functions
(typst-ts-mode-compile--compilation-finish-function 
cur-buffer)
 
+;; outline-minor-mode 

+
+(defconst typst-ts-mode-outline-regexp "=+ "
+  "Regexp identifying Typst header.")
+
+(defun typst-ts-mode-outline-level ()
+  "Return the level of the heading at point."
+  (save-excursion
+(end-of-line)
+(if (re-search-backward "^=+ " nil t)
+   (1- (- (match-end 0) (match-beginning 0)))
+  0)))
+
+(defconst typst-ts-mode-outline-heading-alist
+  '(("= " . 1)
+("== " . 2)
+("=== " . 3)
+(" " . 4)
+("= " . 5)))
+
 (defun typst-ts-mode-heading--at-point-p ()
   "Whether the current line is a heading.
 Return the heading node when yes otherwise nil."
@@ -580,136 +600,29 @@ Return the heading node when yes otherwise nil."
 node
   nil)))
 
-(defun typst-ts-mode-heading--increase/decrease (direction node)
-  "Increase or decrease the heading level.
-DIRECTION right means increase the level while DIRECTION right means decrease.
-NODE is the heading node.
-This does not handle #heading function."
-  (let ((heading-string "")
- (heading-level 0))
-(setq heading-level
-   (length (setq heading-string (treesit-node-text node
-(when (and (= heading-level 1) (eq direction 'left))
-  (user-error "Cannot decrease level 1 heading"))
-(replace-region-contents
- (treesit-node-start node)
- (treesit-node-end node)
- (lambda ()
-   (pcase direction
-  ('right (concat heading-string "="))
-  ('left (substring-no-properties heading-string 1 heading-level))
-  (_ (error "%s is not one of: `left' `right'" direction)))
-
-(defun typst-ts-mode-heading--find-same-or-higher (node traverse-fn)
-  "Return the first heading that is the same level or higher than NODE.
-`car' will be the found heading node.
-`cdr' will say if it is the same level or not.
-TRAVERSE-FN dictates in which direction to search.
-`treesit-node-next-sibling' for down.
-`treesit-node-prev-sibling' for up."
-  (let ((iterate (funcall traverse-fn node))
- (level (typst-ts-mode-heading--level node))
- (iterate-level nil))
-(while (and iterate
-   (not (and (string= (treesit-node-type iterate) 
"heading")
-   (or (= (setq
- iterate-level ;; hack 
to make it not eval twice
- 
(typst-ts-mode-heading--level iterate))
-level)
-   ;; parent heading or NODE was a 
leaf
-   (< iterate-level level)
-  (setq iterate (funcall traverse-fn iterate)))
-;; there are no level 0 heading
-(cons iterate (= (if iterate-level iterate-level 0) level
-
-(defun typst-ts-mode-heading--level (node)
-  "Get the level of the heading NODE.
-This functions does not check if NODE is actually a heading."
-  (length (treesit-node-text (treesit-node-child node 0
-
-(defun typst-ts-mode-heading--find-same-level (node traverse-fn)
-  "Return the first node with the same level as NODE.
-It will report a user-error when it could not find a node
-or it was blocked by its parent heading.
-See `typst-ts-mode-heading--find-same-or-higher' for TRAVERSE-FN."
-  (let* ((other-heading/level
-   (typst-ts-mode-heading--find-same-or-higher node traverse-fn)))
-(if (cdr other-heading/level)
- (car other-heading/level)
-  (user-error "Could not find another heading"
-
+;;;###autoload
 (defun typst-ts-mode-heading-up ()
   "Switch the current heading with the heading above."
   (interactive)
   (typst-ts-mode-meta--dwim 'up))
 
+;;;###autoload
 (defun typst-ts-mode-heading-down ()
   "Switch the current heading with the heading below."
   (interactive)
   (typst-ts-mode-meta--dwim 'down))
 
-(defun typst-ts-mode-heading--down (current-heading)
-  "Switch two heading of same level.
-CURRENT-HEADING and its content with above heading and its content."
-  (let* ((current-heading-start (t

[nongnu] elpa/typst-ts-mode fbbf281e60 160/246: chore(lsp): add autoload indicator

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit fbbf281e603ac84bbc8f8e252f17e9b52466e94c
Author: Meow King 
Commit: Meow King 

chore(lsp): add autoload indicator
---
 typst-ts-lsp.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/typst-ts-lsp.el b/typst-ts-lsp.el
index 9847fef041..0c4f97652a 100644
--- a/typst-ts-lsp.el
+++ b/typst-ts-lsp.el
@@ -32,11 +32,13 @@
   :group 'typst-ts-lsp
   :type 'file)
 
+;;;###autoload
 (add-to-list 'eglot-server-programs
  `((typst-ts-mode)
.
,(eglot-alternatives `(,typst-ts-lsp-download-path 
"tinymist"
 
+;;;###autoload
 (defun typst-ts-lsp-download-binary ()
   "Download latest tinymist binary to `typst-ts-lsp-download-path'.
 Will override old versions."



[nongnu] elpa/typst-ts-mode 64de2a1d97 185/246: merge: fix: maarkup-extended font feature

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 64de2a1d97acd9940d8e66070bf02e320bcc951d
Merge: 2a3fb8e577 fab310f9a0
Author: meowking 
Commit: meowking 

merge: fix: maarkup-extended font feature



[nongnu] elpa/typst-ts-mode 53bc7cf2f1 037/246: doc(README): update co-maintainer information

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 53bc7cf2f194d3a37e0efbfb290fa39c9057b05b
Author: Ziqi Yang 
Commit: Ziqi Yang 

doc(README): update co-maintainer information
---
 README.md | 4 
 1 file changed, 4 insertions(+)

diff --git a/README.md b/README.md
index 4ec0407e65..c3fb7264cb 100644
--- a/README.md
+++ b/README.md
@@ -116,6 +116,10 @@ command [consult](https://github.com/minad/consult), you 
way want this setting.
(?f "Functions" font-lock-function-name-face))
 ```
 
+## Co-Maintainer
+
+[Huan Nguyen](https://sr.ht/~huan)
+
 ## Do you want to develop a new Tree Sitter Major Mode?
 
 Here are some resources:



[nongnu] elpa/typst-ts-mode 3ba9c73723 042/246: doc: Added new feature and its keybinding to readme.

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit 3ba9c73723ff064cc702efd60124a8d348347e1f
Author: Huan Nguyen 
Commit: Huan Nguyen 

doc: Added new feature and its keybinding to readme.
---
 README.md | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 81f3bcc1e7..6013797d53 100644
--- a/README.md
+++ b/README.md
@@ -79,8 +79,10 @@ For reference, this is my configuration.
 `C-c C-c C` : `typst-ts-mode-compile`  
 `C-c C-c w` : `typst-ts-mode-watch-toggle`  
 `C-c C-c p` : `typst-ts-mode-preview`  
-`M-`  : `typst-ts-mode-heading-decrease`
-`M-` : `typst-ts-mode-heading-increase`
+`M-`  : `typst-ts-mode-heading-decrease`  
+`M-` : `typst-ts-mode-heading-increase`  
+`M-`: `typst-ts-mode-heading-up`  
+`M-`  : `typst-ts-mode-heading-down`  
 
 ## Customization Options
 



[nongnu] elpa/typst-ts-mode d56c499e09 213/246: refactor: no more C-c C-c prefix keybindings #21

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit d56c499e09eaede992401d1806726043d491775b
Author: Huan Nguyen 
Commit: Huan Nguyen 

refactor: no more C-c C-c prefix keybindings #21
---
 typst-ts-mode.el | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 5143cd77d4..b868bc2cfb 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -605,10 +605,10 @@ FILE: file path for the result compile file."
 
 ;;;###autoload
 (defvar-keymap typst-ts-mode-map
-  "C-c C-c c" #'typst-ts-compile-and-preview
-  "C-c C-c C" #'typst-ts-compile
-  "C-c C-c w" #'typst-ts-watch-mode
-  "C-c C-c p" #'typst-ts-mode-preview
+  "C-c C-c" #'typst-ts-compile-and-preview
+  "C-u C-c C-c" #'typst-ts-compile
+  "C-c C-w" #'typst-ts-watch-mode
+  "C-c C-p" #'typst-ts-mode-preview
 
   "M-" #'typst-ts-mode-heading-decrease
   "M-" #'typst-ts-mode-heading-increase



[nongnu] elpa/typst-ts-mode d88d8feeee 206/246: fix: #15

2025-02-14 Thread ELPA Syncer
branch: elpa/typst-ts-mode
commit d88d8f587ee9b58a0e334d1a9704a6159d69
Author: Huan Nguyen 
Commit: Huan Nguyen 

fix: #15

- #[
 text
  ] |< M-Enter

Auto inserting not working yet
---
 typst-ts-editing.el | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index 8f15490ffd..1cb3c75884 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -92,10 +92,13 @@ the `GLOBAL-MAP' (example: `right-word')."
 The new heading is created after the ending of current heading.
 Using ARG argument will ignore the context and it will insert a heading 
instead."
   (interactive "P")
-  (let ((node (typst-ts-core-get-parent-of-node-at-bol-nonwhite)))
+  (let ((node (treesit-parent-until
+   (treesit-node-at (line-beginning-position))
+   (lambda (node)
+ (string= "item" (treesit-node-type node))
 (cond
  (arg (typst-ts-mode-insert--heading nil))
- ((string= (treesit-node-type node) "item")
+ (node
   (typst-ts-mode-insert--item node))
  (t
   (typst-ts-mode-insert--heading node)



  1   2   3   4   >