M README.md => README.md +8 -8
@@ 25,12 25,12 @@ Requires Emacs 29+ with tree-sitter installed.
### Project detection
-When `deno-setup-auto-mode-alist` is used, `deno-ts-mode` will detect
-whether the currently visited TypeScript file (`.ts` or `.tsx`) is a
-Deno project by looking at its project root for a `deno.json` file. If
-successful, that TypeScript file is considered a Deno file for the
-purposes of `deno-ts-mode`. Otherwise, `deno-setup-auto-mode-alist`
-will fallback to `typescript-ts-mode`.
+When `deno-ts-setup-auto-mode-alist` is used, `deno-ts-mode` will
+detect whether the currently visited TypeScript file (`.ts` or `.tsx`)
+is a Deno project by looking at its project root for a `deno.json`
+file. If successful, that TypeScript file is considered a Deno file
+for the purposes of `deno-ts-mode`. Otherwise,
+`deno-ts-setup-auto-mode-alist` will fallback to `typescript-ts-mode`.
This all means that the default Deno file detection is based on the
presence of a `deno.json` file in an [Emacs
@@ 43,11 43,11 @@ control.
```elisp
(use-package deno-ts-mode
:config
- (deno-setup-auto-mode-alist))
+ (deno-ts-setup-auto-mode-alist))
(use-package eglot
:ensure t
:hook ((deno-ts-mode . eglot-ensure))
:config
- (deno-setup-eglot))
+ (deno-ts-setup-eglot))
```
M deno-ts-mode.el => deno-ts-mode.el +8 -8
@@ 36,24 36,24 @@
(require 'project)
(require 'typescript-ts-mode) ; Make sure to load auto-mode-alist here first
-(defgroup deno nil
+(defgroup deno-ts nil
"Major mode for Deno."
:link '(url-link "https://git.sr.ht/~mgmarlow/deno-ts-mode")
:group 'languages)
-(defcustom deno-bin "deno"
+(defcustom deno-ts-bin "deno"
"Path to deno executable."
:type 'string
:group 'deno)
-(defun deno-project-p ()
+(defun deno-ts-project-p ()
"Return t if `project-current' is a Deno project."
(when-let* ((project (project-current))
(p-root (project-root project)))
(file-exists-p (concat p-root "deno.json"))))
;; https://deno.land/manual@v1.36.1/getting_started/setup_your_environment#eglot
-(defun deno-setup-eglot ()
+(defun deno-ts-setup-eglot ()
"Add `deno-ts-mode' to `eglot-server-programs'."
(add-to-list 'eglot-server-programs
'(deno-ts-mode . ("deno" "lsp" :initializationOptions (:enable t :lint t)))))
@@ 85,18 85,18 @@
"Major mode for Deno."
:group 'deno-ts-mode)
-(defun deno--auto-mode ()
+(defun deno-ts--auto-mode ()
"Return `deno-ts-mode' if project is a Deno project, else `typescript-ts-mode'."
- (cond ((deno-project-p) (deno-ts-mode))
+ (cond ((deno-ts-project-p) (deno-ts-mode))
(t (typescript-ts-mode))))
-(defun deno-setup-auto-mode-alist ()
+(defun deno-ts-setup-auto-mode-alist ()
"Add Deno to `auto-mode-alist' for .ts and .tsx files.
If the visited .ts file does not detect a Deno project (as
determined by `deno-project-p') this function will fallback to
`typescript-ts-mode'."
- (add-to-list 'auto-mode-alist '("\\.tsx?\\'" . deno--auto-mode)))
+ (add-to-list 'auto-mode-alist '("\\.tsx?\\'" . deno-ts--auto-mode)))
(provide 'deno-ts-mode)
;;; deno-ts-mode.el ends here