branch: elpa/typst-ts-mode commit 7c01c6821cbffd01b8d88e95b21a808cad053686 Merge: 743f05267b 154640e61c Author: Meow King <mr.meowk...@posteo.com> Commit: Meow King <mr.meowk...@posteo.com>
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) "┌─ "