summaryrefslogtreecommitdiff
path: root/.config/emacs
diff options
context:
space:
mode:
authorThomas Voss <thomas.voss@humanwave.nl> 2026-03-20 16:36:40 +0100
committerThomas Voss <thomas.voss@humanwave.nl> 2026-03-20 16:36:40 +0100
commit4052c02106550f7a33677d28103310fd46b791fd (patch)
treeccf279fd9e040f8de4f4187055d21ca13c4ad0bc /.config/emacs
parentcb3a583e6969262ecab14f026922492b4594a2f7 (diff)
emacs: Add Rust commenting support
Diffstat (limited to '.config/emacs')
-rw-r--r--.config/emacs/modules/mm-editing.el17
1 files changed, 12 insertions, 5 deletions
diff --git a/.config/emacs/modules/mm-editing.el b/.config/emacs/modules/mm-editing.el
index eb8b7be..91a290e 100644
--- a/.config/emacs/modules/mm-editing.el
+++ b/.config/emacs/modules/mm-editing.el
@@ -136,22 +136,29 @@ those should be listed in `mm-editing-indentation-settings'."
;;; Code Commenting
-(defun mm-c-comment-no-continue ()
+(defun mm-newcomment-c-config ()
(setq-local comment-continue " "))
-(defun mm-mhtml-comment-no-continue ()
+(defun mm-newcomment-html-config ()
(setq-local comment-continue " "))
+(defun mm-newcomment-rust-config ()
+ (setq-local comment-start "/* "
+ comment-end " */"
+ comment-continue " * " ; rustfmt doesn’t play nice
+ comment-quote-nested nil))
+
(use-package newcomment
:custom
(comment-style 'multi-line)
:config
(dolist (mode '(c-mode c++-mode))
- (add-hook (mm-mode-to-hook mode) #'mm-c-comment-no-continue)
+ (add-hook (mm-mode-to-hook mode) #'mm-newcomment-c-config)
(when-let ((ts-mode (mm-mode-to-ts-mode mode))
((fboundp ts-mode)))
- (add-hook (mm-mode-to-hook ts-mode) #'mm-c-comment-no-continue)))
- (add-hook 'mhtml-mode #'mm-mhtml-comment-no-continue))
+ (add-hook (mm-mode-to-hook ts-mode) #'mm-newcomment-c-config)))
+ (add-hook 'mhtml-mode #'mm-newcomment-html-config)
+ (add-hook 'rust-ts-mode #'mm-newcomment-rust-config))
;;; Multiple Cursors