branch: elpa/typst-ts-mode commit eb4bcb0a85a0ad96841cfe2112f378d7ab673758 Author: Meow King <mr.meowk...@anche.no> Commit: Meow King <mr.meowk...@anche.no>
doc: update README --- .editorconfig | 21 --------------------- README.md | 3 +++ typst-ts-mode.el | 42 +++++++++++++++++++++++------------------- 3 files changed, 26 insertions(+), 40 deletions(-) diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index eee922ff2e..0000000000 --- a/.editorconfig +++ /dev/null @@ -1,21 +0,0 @@ -# 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/README.md b/README.md index ce058bcde4..053688c5e0 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,9 @@ For reference, this is my configuration. `M-<up>` : `typst-ts-mode-heading-up` `M-<down>` : `typst-ts-mode-heading-down` +*NOTE*: `outline-minor-mode` is enabled by `typst-ts-mode`, so you can use comamnd +defined by `outline-minor-mode` such as `outline-cycle`. + ## Customization Options `customize` -> `typst-ts` diff --git a/typst-ts-mode.el b/typst-ts-mode.el index f8d3afa04a..cd987a43c7 100644 --- a/typst-ts-mode.el +++ b/typst-ts-mode.el @@ -578,7 +578,7 @@ buffer before compilation." (save-excursion (end-of-line) (if (re-search-backward "^=+ " nil t) - (1- (- (match-end 0) (match-beginning 0))) + (1- (- (match-end 0) (match-beginning 0))) 0))) (defconst typst-ts-mode-outline-heading-alist @@ -633,26 +633,26 @@ Return the heading node when yes otherwise nil." 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)) - ;; car function, cdr string of function for `substitute-command-keys' - (call-me/string - (pcase direction - ('left - (cons #'outline-promote - "\\[typst-ts-mode-heading-decrease]")) - ('right - (cons #'outline-demote - "\\[typst-ts-mode-heading-decrease]")) - ('up - (cons #'outline-move-subtree-up - "\\[typst-ts-mode-heading-up]")) - ('down - (cons #'outline-move-subtree-down - "\\[typst-ts-mode-heading-down]")) - (_ (error "%s is not one of: `right' `left'" direction))))) + ;; car function, cdr string of function for `substitute-command-keys' + (call-me/string + (pcase direction + ('left + (cons #'outline-promote + "\\[typst-ts-mode-heading-decrease]")) + ('right + (cons #'outline-demote + "\\[typst-ts-mode-heading-decrease]")) + ('up + (cons #'outline-move-subtree-up + "\\[typst-ts-mode-heading-up]")) + ('down + (cons #'outline-move-subtree-down + "\\[typst-ts-mode-heading-down]")) + (_ (error "%s is not one of: `right' `left'" direction))))) (if heading - (call-interactively (car call-me/string)) + (call-interactively (car call-me/string)) (call-interactively - (keymap-lookup global-map (substitute-command-keys (cdr call-me/string))))))) + (keymap-lookup global-map (substitute-command-keys (cdr call-me/string))))))) (defun typst-ts-mode-compile () "Compile current typst file." @@ -875,6 +875,10 @@ PROC: process; OUTPUT: new output from PROC." (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 + (outline-minor-mode t) + (treesit-major-mode-setup)) ;;;###autoload