summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-09-22 15:32:54 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-09-22 15:32:54 +0200
commitde5ce58331aa1f0ceab03e7dab42f82bdf709e4d (patch)
treea5a1008b3b22afc343a3448971478ba9bbc73c13 /.config
parent0025c20588f2ede2726662a692c432df27add003 (diff)
emacs: Add function to go from ts-mode to normal mode
Diffstat (limited to '.config')
-rw-r--r--.config/emacs/init.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index d5e4bd3..3794825 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -68,6 +68,13 @@ BODY directly after ‘(interactive)’."
(string-remove-suffix "-mode" (symbol-name mode))
"-ts-mode")))
+(defun x-ts-mode-to-mode (ts-mode)
+ "Get the non-tree-sitter mode corresponding to TS-MODE."
+ (declare (pure t) (side-effect-free t))
+ (intern (concat
+ (string-remove-suffix "-ts-mode" (symbol-name ts-mode))
+ "-mode")))
+
(defun x-string-split (separators string)
"Wrapper around ‘string-split' that puts SEPARATORS first. This makes
it convenient to use in ‘thread-last’."