branch: elpa/typst-ts-mode
commit 739777e5bc9e1e6a147a4479906e631db71fc771
Author: Meow King <mr.meowk...@anche.no>
Commit: Meow King <mr.meowk...@anche.no>

    fix: `typst-ts-compile-get-result-pdf-filename` buffer-file-name issue
---
 typst-ts-compile.el | 4 ++--
 typst-ts-mode.el    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/typst-ts-compile.el b/typst-ts-compile.el
index dbcac7be47..fc9a6b0cfa 100644
--- a/typst-ts-compile.el
+++ b/typst-ts-compile.el
@@ -86,8 +86,8 @@ If BUFFER is nil, it means use the current buffer.
 CHECK: non-nil mean check the file existence.
 Return nil if the BUFFER has not associated file or the there is
 no compiled pdf file when CHECK is non-nil."
-  (when buffer-file-name
-    (let ((res (concat (file-name-base (buffer-file-name buffer)) ".pdf")))
+  (when-let ((typst-file (buffer-file-name buffer)))
+    (let ((res (concat (file-name-base typst-file) ".pdf")))
       (if check
           (when (file-exists-p res)
             res)
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index a91271e6c2..e9f110dda5 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -925,7 +925,7 @@ When there is no section it will insert a heading below 
point."
 (defun typst-ts-mode-preview (file)
   "Open the result compile file.
 FILE: file path for the result compile file."
-  (interactive (typst-ts-compile-get-result-pdf-filename))
+  (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))
 

Reply via email to