From fa21857da30904fa6ca7e555e2d2dc5b8813600a Mon Sep 17 00:00:00 2001 From: =?utf8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= Date: Sun, 13 Apr 2025 12:26:08 -0600 Subject: [PATCH] Add block-comment variables to cc-mode. * lisp/progmodes/cc-cmds.el (c-indent-new-comment-line): Add block-comment-start and block-comment-end * lisp/progmodes/cc-mode.el (c-basic-common-init): Declare block-comment-start and block-comment-end buffer-local. * lisp/emacs-lisp/lisp-mode.el (lisp-mode-variables): Move block-comment variables ... (lisp-mode): ... to here. (Bug#77424) (cherry picked from commit 74842b4cb2c164ceed5cbe6ee5ad578ee46fe012) --- lisp/emacs-lisp/lisp-mode.el | 4 ++-- lisp/progmodes/cc-cmds.el | 1 + lisp/progmodes/cc-mode.el | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 41f9f74e711..39425e1c983 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -695,8 +695,6 @@ font-lock keywords will not be case sensitive." (setq-local add-log-current-defun-function #'lisp-current-defun-name) (setq-local comment-start ";") (setq-local comment-start-skip ";+ *") - (setq-local block-comment-start "#|") - (setq-local block-comment-end "|#") (setq-local comment-add 1) ;default to `;;' in comment-region (setq-local comment-column 40) (setq-local comment-use-syntax t) @@ -1161,6 +1159,8 @@ or to switch back to an existing one." "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") (setq-local comment-end-skip "[ \t]*\\(\\s>\\||#\\)") (setq-local font-lock-comment-end-skip "|#") + (setq-local block-comment-start "#|") + (setq-local block-comment-end "|#") (setq imenu-case-fold-search t)) (defun lisp-find-tag-default () diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 9230faa56da..06397d23321 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -5015,6 +5015,7 @@ If a fill prefix is specified, it overrides all the above." (setq comment-start "/* " comment-end " */")) (unless (string-match "[ \t]*//" comment-start) (setq comment-start "// " comment-end ""))) + (setq block-comment-start "/*" block-comment-end "*/") (setq col (save-excursion (back-to-indentation) (current-column))) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index d500fb29959..ae7d27c0ae6 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -610,6 +610,8 @@ that requires a literal mode spec at compile time." (make-local-variable 'comment-start) (make-local-variable 'comment-end) (make-local-variable 'comment-start-skip) + (make-local-variable 'block-comment-start) + (make-local-variable 'block-comment-end) (make-local-variable 'paragraph-start) (make-local-variable 'paragraph-separate) -- 2.39.5