branch: elpa/typst-ts-mode
commit 44ed423508cacceaead2ce7089e752bfbaff325c
Author: Huan Thieu Nguyen <nguyenthieuh...@gmail.com>
Commit: Huan Thieu Nguyen <nguyenthieuh...@gmail.com>

    fix: apply some suggestions from linters #42
---
 typst-ts-edit-indirect.el           |  4 ----
 typst-ts-embedding-lang-settings.el |  5 ++---
 typst-ts-lsp.el                     |  2 +-
 typst-ts-mode.el                    |  7 +++++--
 typst-ts-watch-mode.el              | 19 ++++++++++---------
 5 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/typst-ts-edit-indirect.el b/typst-ts-edit-indirect.el
index cb282dfd26..7c3400dc13 100644
--- a/typst-ts-edit-indirect.el
+++ b/typst-ts-edit-indirect.el
@@ -117,9 +117,5 @@ If there is no fitting mode or no lang it will be 
`normal-mode'."
         (goto-char (point-min))
         (delete-char 1)))))
 
-(add-hook 'typst-ts-mode-hook (lambda ()
-                                (setq-local edit-indirect-guess-mode-function
-                                            
#'typst-ts-edit-indirect--guess-mode)))
-
 (provide 'typst-ts-edit-indirect)
 ;;; typst-ts-edit-indirect.el ends here
diff --git a/typst-ts-embedding-lang-settings.el 
b/typst-ts-embedding-lang-settings.el
index 2c8dbf2c22..1b694bd7fc 100644
--- a/typst-ts-embedding-lang-settings.el
+++ b/typst-ts-embedding-lang-settings.el
@@ -222,8 +222,7 @@
       "authorized_keys2" authorized_keys "authorized_keys" authorized_keys 
"known_hosts" known_hosts
       "known_hosts.old" known_hosts "ssh_config" ssh_config "sshd_config" 
sshd_config
       "syslog" syslog "varlink" varlink "typ" typst
-      "typc" typst "typst" typst
-      ))
+      "typc" typst "typst" typst))
   "Raw block tag -> tree sitter language map.")
 
 
@@ -233,7 +232,7 @@
 LANG is a string, and the returned major mode is a symbol."
   (let ((lang-norm (downcase lang)))
     (cl-find-if
-     #'(lambda (mode) (and mode (fboundp mode)))
+     (lambda (mode) (and mode (fboundp mode)))
      (list
       (and (treesit-language-available-p (intern lang-norm))
            (intern (concat lang-norm "-ts-mode")))
diff --git a/typst-ts-lsp.el b/typst-ts-lsp.el
index 79ae36142e..4068568c3a 100644
--- a/typst-ts-lsp.el
+++ b/typst-ts-lsp.el
@@ -27,7 +27,7 @@
 
 ;;; Code:
 
-(defgroup typs-ts-lsp nil
+(defgroup typst-ts-lsp nil
   "Typst TS eglot integration with tinymist."
   :prefix "typst-ts-compile"
   :group 'typst-ts)
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 001e0f8cce..289ee8db7f 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -683,12 +683,15 @@ typst tree sitter grammar (at least %s)!" 
(current-time-string min-time))
 
 
   ;; auto fill function
-  (setq-local normal-auto-fill-function 'typst-ts-editing-auto-fill-function)
+  (setq-local normal-auto-fill-function #'typst-ts-editing-auto-fill-function)
 
   (treesit-major-mode-setup)
 
   (setq-local font-lock-unfontify-region-function 
#'typst-ts-mode-unfontify-region)
-  (setq-local indent-line-function #'typst-ts-mode-indent-line-function))
+  (setq-local indent-line-function #'typst-ts-mode-indent-line-function)
+  (add-hook 'typst-ts-mode-hook (lambda ()
+                                  (setq-local edit-indirect-guess-mode-function
+                                              
#'typst-ts-edit-indirect--guess-mode))))
 
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("\\.typ\\'" . typst-ts-mode))
diff --git a/typst-ts-watch-mode.el b/typst-ts-watch-mode.el
index c2c337fac7..661340c560 100644
--- a/typst-ts-watch-mode.el
+++ b/typst-ts-watch-mode.el
@@ -61,17 +61,18 @@ is eliminated."
   '(display-buffer-at-bottom
     (window-height . fit-window-to-buffer))
   "Display buffer parameters.
-Note that since the major mode of typst watch buffer is derived from  
compilation
- mode. If you have a rule like `((derived-mode . compilation-mode) ...)' in
-your `display-buffer-alist', then this option will be covered by that rule."
+Note that since the major mode of typst watch buffer is derived from
+compilation mode.
+If you have a rule like `((derived-mode . `compilation-mode') ...)'
+in your `display-buffer-alist', then this option will be covered by that rule."
   :type 'symbol)
 
-(defvar typst-ts-before-watch-hook nil
+(defvar typst-ts-watch-before-watch-hook nil
   "Hook runs before compile.")
-(defvar typst-ts-after-watch-hook nil
+(defvar typst-ts-watch-after-watch-hook nil
   "Hook runs after compile.")
 
-(defun typst-ts--watch-process-filter (proc output)
+(defun typst-ts-watch--process-filter (proc output)
   "Filter the `typst watch' process output.
 Only error will be transported to the process buffer.
 See `(info \"(elisp) Filter Functions\")'.
@@ -116,7 +117,7 @@ PROC: process; OUTPUT: new output from PROC."
 (defun typst-ts-watch-start ()
   "Watch(hot compile) current typst file."
   (interactive)
-  (run-hooks typst-ts-before-watch-hook)
+  (run-hooks typst-ts-watch-before-watch-hook)
   (with-current-buffer (get-buffer-create typst-ts-watch-process-buffer-name)
     (erase-buffer)
     (unless (derived-mode-p 'typst-ts-compilation-mode)
@@ -131,7 +132,7 @@ PROC: process; OUTPUT: new output from PROC."
             (file-name-nondirectory buffer-file-name)
             (typst-ts-compile-get-result-pdf-filename)
             typst-ts-watch-options))
-   'typst-ts--watch-process-filter)
+   'typst-ts-watch--process-filter)
   (message "Start Watch"))
 
 ;;;###autoload
@@ -144,7 +145,7 @@ PROC: process; OUTPUT: new output from PROC."
     (kill-buffer typst-ts-watch-process-buffer-name)
     (when window
       (delete-window window)))
-  (run-hooks typst-ts-after-watch-hook)
+  (run-hooks typst-ts-watch-after-watch-hook)
   (message "Stop Watch"))
 
 (provide 'typst-ts-watch-mode)

Reply via email to