From 3c25f659284207f1bc6012333c4e840253c6443b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20G=C3=B6ttschkes?= Date: Sat, 12 Apr 2025 20:42:21 +0200 Subject: [PATCH] Set adaptive-fill-regexp and fix comment-start-skip. Configures the adaptive-fill-regexp for zig-mode, such that other commands like fill-region can automatically determine a fill-prefix for comments. Also, adds doc comment style comments to comment-start-skip, so these commands also work in doc comments. --- zig-mode.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/zig-mode.el b/zig-mode.el index 30f44d8..e025e1a 100644 --- a/zig-mode.el +++ b/zig-mode.el @@ -447,8 +447,15 @@ This is written mainly to be used as `end-of-defun-function' for Zig." ;;;###autoload (define-derived-mode zig-mode prog-mode "Zig" "A major mode for the Zig programming language." + (setq-local adaptive-fill-regexp + (concat "//[!/]* *" + (if (default-value 'adaptive-fill-regexp) + (concat "\\(" + (default-value 'adaptive-fill-regexp) + "\\)") + ""))) (setq-local comment-start "// ") - (setq-local comment-start-skip "//+ *") + (setq-local comment-start-skip "//[!/]* *") (setq-local comment-end "") (setq-local electric-indent-chars (append zig-electric-indent-chars