[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/typst-ts-mode 2d25a0ac3f 097/246: refactor: `typst-ts-mode
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/typst-ts-mode 2d25a0ac3f 097/246: refactor: `typst-ts-mode-insert--item` |
Date: |
Fri, 14 Feb 2025 16:54:20 -0500 (EST) |
branch: elpa/typst-ts-mode
commit 2d25a0ac3f444ff16449afb702419324280d9a2f
Author: Meow King <mr.meowking@anche.no>
Commit: Meow King <mr.meowking@anche.no>
refactor: `typst-ts-mode-insert--item`
---
typst-ts-mode.el | 34 ++++++++++++----------------------
1 file changed, 12 insertions(+), 22 deletions(-)
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index d3931cec01..090e3fdc92 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -1145,39 +1145,29 @@ INTERACTIVE will be non nil when called interactively.
NODE must be an item node!
This function respects indentation."
(let* (;; +, -, or <num>.
- (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))
- ;; do the same indentation level in case I am pointing at a parent
- (column (typst-ts-mode-column-at-pos
- (typst-ts-mode--get-node-bol node))))
+ (item-end (treesit-node-end node)))
(goto-char item-end)
- ;; I am not sure what happens when someone uses tab characters to indent
- ;; that's why I will do it like that
(newline-and-indent)
- (move-to-column column)
- (kill-line)
(insert (if (= item-number 0)
item-type
(concat (number-to-string (1+ item-number)) "."))
- " ")
- ;; something can be below me
- (save-excursion
- (newline))))
+ " ")))
(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 below point."
(let* ((section
- (treesit-parent-until
- node
- (lambda (node)
- (string= (treesit-node-type node) "section"))
- t))
- ;; first child is heading
- (heading (treesit-node-child section 0))
- (heading-level (treesit-node-type (treesit-node-child heading 0))))
+ (treesit-parent-until
+ node
+ (lambda (node)
+ (string= (treesit-node-type node) "section"))
+ t))
+ ;; first child is heading
+ (heading (treesit-node-child section 0))
+ (heading-level (treesit-node-type (treesit-node-child heading
0))))
(if section
(goto-char (treesit-node-end section))
;; no headings so far
- [nongnu] elpa/typst-ts-mode 07cf3bcc89 229/246: Added function `typst-ts-preview`, (continued)
- [nongnu] elpa/typst-ts-mode 07cf3bcc89 229/246: Added function `typst-ts-preview`, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode f643036cc2 239/246: fix: having point after last column did not count as item #33, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 7c01c6821c 243/246: Merge pull request 'Add an option to customize the preview function.' (#36) from tkpapp/typst-ts-mode:tp/customize-preview-function into develop, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 271cedb1de 066/246: feat: add customization option to enable raw block highlighting, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode fded764913 069/246: fix(els): remove language tag map duplication, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode d6cd6d7283 076/246: feat: Also auto insert numbered list., ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 49a3981040 083/246: fix: Only search for the current line., ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 0454e44977 087/246: feat: Autoincrement on enter and fix heading insertion., ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 078b2efbb9 089/246: fix: disable echoing indentation debug information, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 3d373bba6f 095/246: fix: fix outline recognization error when section indent offset is not nil, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 2d25a0ac3f 097/246: refactor: `typst-ts-mode-insert--item`,
ELPA Syncer <=
- [nongnu] elpa/typst-ts-mode 893430dc14 100/246: merge `develop` branch, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode d8d36ba3e9 110/246: doc: update README.md, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 42c080fa64 122/246: fix(compabiilty): Emacs29 treesit-lparser-list -> typst-ts-utils-parser-list, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode dc45e44e38 153/246: doc: update README, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode d614af3433 163/246: fix: don't add lsp configuration by default to respect user's custom configuration, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 6b54ff7084 175/246: refactor: remove `typst-ts-mode--item-on-line-p` function, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode e2309a468c 191/246: fix: typst-ts-mode-cycle, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode eb988ca372 187/246: fix: multiline item indentation issue, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 78e6ec9921 207/246: fix: #15 heading inserting should still work, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 322b52e3cd 209/246: fix: typst-ts-mode-return delete new added line, ELPA Syncer, 2025/02/14