From 4052c02106550f7a33677d28103310fd46b791fd Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 20 Mar 2026 16:36:40 +0100 Subject: emacs: Add Rust commenting support --- .config/emacs/modules/mm-editing.el | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to '.config') 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 -- cgit v1.2.3