branch: elpa/zig-mode commit 905917322b8b5f191593c66b5f26dd347fe1290d Author: Erik Arvstedt <erik.arvst...@gmail.com> Commit: Joachim Schmidt <joachim.schmidt...@outlook.com>
Add `comment-start-skip` This fixes many builtin comment-related functions (`newcomment.el`) that depend on this variable. This also fixes test `test-font-lock-comments` on Emacs 28: In Emacs 28, `comment-start-skip` is assigned a default value based on `comment-start`, which results in comment delimiters (//) being fontified with `font-lock-comment-delimiter-face`. --- tests.el | 6 ++++-- zig-mode.el | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests.el b/tests.el index e0ef563593..60a4caf3ea 100644 --- a/tests.el +++ b/tests.el @@ -61,9 +61,11 @@ const string = // This is a normal comment\n /// This is a doc comment\n //// This is a normal comment again\n" - '(("// This is a normal comment\n" font-lock-comment-face) + '(("// " font-lock-comment-delimiter-face) + ("This is a normal comment\n" font-lock-comment-face) ("/// This is a doc comment\n" font-lock-doc-face) - ("//// This is a normal comment again\n" font-lock-comment-face)))) + ("//// " font-lock-comment-delimiter-face) + ("This is a normal comment again\n" font-lock-comment-face)))) (ert-deftest test-font-lock-decl-const () (zig-test-font-lock diff --git a/zig-mode.el b/zig-mode.el index 4064605557..3baee90932 100644 --- a/zig-mode.el +++ b/zig-mode.el @@ -529,6 +529,7 @@ This is written mainly to be used as `end-of-defun-function' for Zig." \\{zig-mode-map}" :group 'zig-mode (setq-local comment-start "// ") + (setq-local comment-start-skip "//+ *") (setq-local comment-end "") (setq-local electric-indent-chars (append zig-electric-indent-chars