summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2025-06-11 15:36:43 +0200
committerThomas Voss <mail@thomasvoss.com> 2025-06-11 15:36:43 +0200
commitdbda47d09961b3527b965470845034c78136bab8 (patch)
tree703853e87146c55b1ed5fb42d8981867bd27e970 /.config
parentc878998ee2114e69b0c5d3eb6eda5aff67cb5131 (diff)
emacs: Don’t break with markdown-inline
Diffstat (limited to '.config')
-rw-r--r--.config/emacs/modules/mm-treesit.el15
1 files changed, 12 insertions, 3 deletions
diff --git a/.config/emacs/modules/mm-treesit.el b/.config/emacs/modules/mm-treesit.el
index 68f3bb0..4e052de 100644
--- a/.config/emacs/modules/mm-treesit.el
+++ b/.config/emacs/modules/mm-treesit.el
@@ -122,18 +122,27 @@ the associated language’s major-mode should be enabled.
This alist is used to configure `auto-mode-alist'.")
+(defvar mm-treesit-dont-have-modes
+ '(markdown-inline)
+ "List of languages that don't have modes.
+Some languages may come with multiple parsers, (e.g. `markdown' and
+`markdown-inline') and as a result one-or-more of the parsers won't be
+associated with a mode. To avoid breaking the configuration, these
+languages should be listed here.")
+
(dolist (spec treesit-language-source-alist)
(let* ((lang (car spec))
(lang (alist-get lang mm-treesit-language-remap-alist lang))
- (symbol-name (symbol-name lang))
- (name-mode (intern (concat symbol-name "-mode")))
- (name-ts-mode (intern (concat symbol-name "-ts-mode"))))
+ (name-mode (intern (format "%s-mode" lang)))
+ (name-ts-mode (intern (format "%s-ts-mode" lang))))
;; If ‘name-ts-mode’ is already in ‘auto-mode-alist’ then we don’t
;; need to do anything, however if that’s not the case then if
;; ‘name-ts-mode’ and ‘name-mode’ are both bound we do a simple
;; remap. If the above is not true then we lookup the extensions in
;; ‘mm-treesit-language-file-name-alist’.
(cond
+ ((memq lang mm-treesit-dont-have-modes)
+ nil)
((not (fboundp name-ts-mode))
(warn "`%s' is missing." name-ts-mode))
((rassq name-ts-mode auto-mode-alist)