branch: elpa/typst-ts-mode commit 154640e61c8e5d08220133a027c5c9c59051373a Author: Tamás K. Papp <tkp...@gmail.com> Commit: Tamás K. Papp <tkp...@gmail.com>
Add an option to customize the preview function. Fixes #29. --- 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) "┌─ "