[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/typst-ts-mode 098abf17c8 233/246: Merge pull request 'Chan
From: |
ELPA Syncer |
Subject: |
[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 |
Date: |
Fri, 14 Feb 2025 16:55:48 -0500 (EST) |
branch: elpa/typst-ts-mode
commit 098abf17c864c05c89fc84ca5093c1a03c33f8b8
Merge: d3e44b5361 131c404ee0
Author: Meow King <mr.meowking@tutamail.com>
Commit: Meow King <mr.meowking@tutamail.com>
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-<left>" #'typst-ts-mode-meta-left
"M-<right>" #'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 131c404ee0 232/246: Bound `C-c C-C` to `typst-ts-compile-and-preview`, (continued)
- [nongnu] elpa/typst-ts-mode 131c404ee0 232/246: Bound `C-c C-C` to `typst-ts-compile-and-preview`, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 07c6de2c46 240/246: doc: clarify with comment what this is #33, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode f0e8633147 152/246: add notice for the migration (from sourcehut to codeberg), ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 93f93c85cb 167/246: feat: update raw block language tags, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 0d2b61f320 173/246: feat: make `url` fontification inside `markup-standard` feature, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 3394ec08dc 179/246: chore, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 8917b08650 190/246: fix: typst-ts-mode-cycle, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 147b4d6885 192/246: fix(editing): typst-ts-mode-return end of buffer situation, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 272ecc1db7 212/246: fix: font lock highlight order, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 42094eb250 224/246: chore, ELPA Syncer, 2025/02/14
- [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,
ELPA Syncer <=
- [nongnu] elpa/typst-ts-mode 51e05c7075 237/246: Merge pull request 'fix: Bound typst-ts-compile-and-preview to C-S-C' (#34) from vslavkin/typst-ts-mode:main into main, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode d952a8156e 245/246: doc: update package header, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode d4e4a21f13 246/246: doc: update version header, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 6037bc1866 188/246: refactor: item editing, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 64c98b7646 195/246: fix: typst-ts-core-for-lines-covered-by-node last line of buffer situation, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 0e4894ffcd 200/246: merge: fix: maarkup-extended font feature, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 449f2b0728 204/246: fix: #12, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 22ff816058 218/246: feat: #16 do something depending on point, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode ecfc70c965 221/246: chore: remove debug message echo, ELPA Syncer, 2025/02/14
- [nongnu] elpa/typst-ts-mode 4198faf667 228/246: `typst-ts-compile-and-preview` using `typst-ts-compile`, ELPA Syncer, 2025/02/14