GNU bug report logs - #77424
[PATCH] Add block-comment-start and block-comment-end to supported modes.

Previous Next

Package: emacs;

Reported by: Elijah Gabe Pérez <eg642616 <at> gmail.com>

Date: Tue, 1 Apr 2025 00:47:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 77424 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#77424; Package emacs. (Tue, 01 Apr 2025 00:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Elijah Gabe Pérez <eg642616 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 01 Apr 2025 00:47:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Add block-comment-start and block-comment-end to supported
 modes.
Date: Mon, 31 Mar 2025 18:46:21 -0600
[Message part 1 (text/plain, inline)]
Tags: patch


For make =electric-block-comment-mode= works, it needs that the major
modes that support block comments set =block-comment-start= and
=block-comment-end= (which both were unused).

This patch do this work.

/Note: I didn't included cc modes because i don't know which part to add it./



[Message part 2 (text/html, inline)]
[0001-Add-block-comment-start-and-block-comment-end-to-sup.patch (text/patch, attachment)]
[Message part 4 (text/plain, inline)]
-- 
                                          - E.G via GNU Emacs and Org.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77424; Package emacs. (Sun, 13 Apr 2025 08:16:04 GMT) Full text and rfc822 format available.

Message #8 received at 77424 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Elijah Gabe Pérez <eg642616 <at> gmail.com>
Cc: 77424 <at> debbugs.gnu.org
Subject: Re: bug#77424: [PATCH] Add block-comment-start and block-comment-end
 to supported modes.
Date: Sun, 13 Apr 2025 11:15:00 +0300
> From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
> Date: Mon, 31 Mar 2025 18:46:21 -0600
> 
> For make electric-block-comment-mode works, it needs that the major
> modes that support block comments set block-comment-start and
> block-comment-end (which both were unused).
> 
> This patch do this work.

Thanks, installed on the master branch.

> Note: I didn't included cc modes because i don't know which part to add it.

Please tell more about this aspect: what exactly did you not know?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77424; Package emacs. (Sun, 13 Apr 2025 18:38:02 GMT) Full text and rfc822 format available.

Message #11 received at 77424 <at> debbugs.gnu.org (full text, mbox):

From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 77424 <at> debbugs.gnu.org
Subject: Re: bug#77424: [PATCH] Add block-comment-start and
 block-comment-end to supported modes.
Date: Sun, 13 Apr 2025 12:36:55 -0600
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> Note: I didn't included cc modes because i don't know which part to add it.
>
> Please tell more about this aspect: what exactly did you not know?

I think that i found the solution.  See below patch:

[0001-Add-block-comment-variables-to-cc-mode.patch (text/x-patch, inline)]
From 7a02efe1243b5047795cd95c2ac3935953a01c23 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616 <at> gmail.com>
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/progmodes/cc-cmds.el | 1 +
 lisp/progmodes/cc-mode.el | 2 ++
 2 files changed, 3 insertions(+)

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 @@ c-indent-new-comment-line
 		      (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 efeb6c1005a..fa3788ba383 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -610,6 +610,8 @@ c-basic-common-init
   (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.49.0

[Message part 3 (text/plain, inline)]
-- 
                                          - E.G via GNU Emacs and Org.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77424; Package emacs. (Mon, 14 Apr 2025 00:22:02 GMT) Full text and rfc822 format available.

Message #14 received at 77424 <at> debbugs.gnu.org (full text, mbox):

From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 77424 <at> debbugs.gnu.org
Subject: Re: bug#77424: [PATCH] Add block-comment-start and
 block-comment-end to supported modes.
Date: Sun, 13 Apr 2025 18:21:49 -0600
[Message part 1 (text/plain, inline)]
I've noticed and bug in the previous patch, I'm sending here a fixed one.

[0001-Add-block-comment-variables-to-cc-mode.patch (text/x-patch, inline)]
From a006c041e3daff358cd30ba273c73b3105caef54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616 <at> gmail.com>
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.
---
 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 ce79393fb90..f27baae1b36 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -701,8 +701,6 @@ lisp-mode-variables
   (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)
@@ -830,6 +828,8 @@ lisp-mode
 	      "\\(\\(^\\|[^\\\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 @@ c-indent-new-comment-line
 		      (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 efeb6c1005a..fa3788ba383 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -610,6 +610,8 @@ c-basic-common-init
   (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.49.0

[Message part 3 (text/plain, inline)]
-- 
                                          - E.G via GNU Emacs and Org.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77424; Package emacs. (Tue, 15 Apr 2025 13:14:02 GMT) Full text and rfc822 format available.

Message #17 received at 77424 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Elijah Gabe Pérez <eg642616 <at> gmail.com>
Cc: 77424 <at> debbugs.gnu.org
Subject: Re: bug#77424: [PATCH] Add block-comment-start and
 block-comment-end to supported modes.
Date: Tue, 15 Apr 2025 16:13:26 +0300
> From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
> Cc: 77424 <at> debbugs.gnu.org
> Date: Sun, 13 Apr 2025 18:21:49 -0600
> 
> I've noticed and bug in the previous patch, I'm sending here a fixed one.

Thanks, installed.




This bug report was last modified 8 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.