Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions emacs/elisp/mode-hooks.el
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
;; I usually want my .h files in C++ mode.
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(add-to-list 'auto-mode-alist
'("\\.ts\\'" . (lambda ()
(if (fboundp 'typescript-ts-mode)
(typescript-ts-mode)
Comment on lines +12 to +14

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard typescript-ts-mode on tree-sitter grammar availability

In Emacs 29+, typescript-ts-mode is defined even if the tree-sitter TypeScript grammar is not installed. This entry only checks fboundp, so opening a .ts file on a machine without the grammar will raise an error and the buffer won’t open, instead of falling back to typescript-mode. Consider checking treesit-ready-p (or handling the error) before calling typescript-ts-mode so users without the grammar can still open .ts files.

Useful? React with 👍 / 👎.

(typescript-mode)))))
(add-to-list 'auto-mode-alist '("mutt-[a-z0-9]+-[0-9]+-[0-9]+-[0-9]+" . post-mode))
;; YAML mode
;; https://raw.githubusercontent.com/yoshiki/yaml-mode/master/yaml-mode.el
Expand Down