]> git.eshelyaron.com Git - emacs.git/commitdiff
Add block-comment-start and block-comment-end to supported modes
authorElías Gabriel Pérez <eg642616@gmail.com>
Mon, 31 Mar 2025 23:58:16 +0000 (17:58 -0600)
committerEshel Yaron <me@eshelyaron.com>
Sun, 13 Apr 2025 20:55:36 +0000 (22:55 +0200)
* lisp/emacs-lisp/lisp-mode.el (lisp-mode-variables):
Add block-comment-start and block-comment-end from here...
* lisp/newcomment.el (block-comment-start, block-comment-end):...
* lisp/nxml/nxml-mode.el (nxml-mode):...
* lisp/progmodes/c-ts-common.el (c-ts-common-comment-setup):...
* lisp/progmodes/go-ts-mode.el (go-work-ts-mode):...
* lisp/progmodes/js.el (js--mode-setup):...
* lisp/progmodes/json-ts-mode.el (json-ts-mode):...
* lisp/progmodes/lua-ts-mode.el (lua-ts-mode):...
* lisp/progmodes/opascal.el (opascal-mode):...
* lisp/progmodes/pascal.el (pascal-mode):...
* lisp/progmodes/typescript-ts-mode.el (tsx-ts-mode):...
* lisp/textmodes/css-mode.el (css-base-mode, scss-mode):...
* lisp/textmodes/sgml-mode.el (sgml-mode): ... to here.
(Bug#77424)

(cherry picked from commit 4c6b1712a4d67ae40ccc087c7946de4cb14e8cc7)

13 files changed:
lisp/emacs-lisp/lisp-mode.el
lisp/newcomment.el
lisp/nxml/nxml-mode.el
lisp/progmodes/c-ts-common.el
lisp/progmodes/go-ts-mode.el
lisp/progmodes/js.el
lisp/progmodes/json-ts-mode.el
lisp/progmodes/lua-ts-mode.el
lisp/progmodes/opascal.el
lisp/progmodes/pascal.el
lisp/progmodes/typescript-ts-mode.el
lisp/textmodes/css-mode.el
lisp/textmodes/sgml-mode.el

index 450782c1af5729c3e2d110551017d049a1df8022..06b68f35d73114ffb3ebc501518ed7b2de29ef3c 100644 (file)
@@ -698,6 +698,8 @@ 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)
index 945187e863f31b55d063f33be43621a88242e637..eb36f91104d262f853911be7694b54c26b57c77a 100644 (file)
@@ -56,7 +56,6 @@
 ;; - spill auto-fill of comments onto the end of the next line.
 ;; - uncomment-region with a consp (for blocks) or somehow make the
 ;;   deletion of continuation markers less dangerous.
-;; - drop block-comment-<foo> unless it's really used.
 ;; - uncomment-region on a subpart of a comment.
 ;; - support gnu-style "multi-line with space in continue".
 ;; - somehow allow comment-dwim to use the region even if transient-mark-mode
@@ -183,9 +182,11 @@ guaranteed to be correctly ordered.  It is called within `save-excursion'.
 Applicable at least in modes for languages like fixed-format Fortran where
 comments always start in column zero.")
 
-;; ?? never set
-(defvar block-comment-start nil)
-(defvar block-comment-end nil)
+(defvar block-comment-start nil
+  "String to insert to start a new block comment, or nil if no supported.")
+
+(defvar block-comment-end nil
+  "String to insert to end a new block comment, or nil if no supported.")
 
 (defvar comment-quote-nested t
   "Non-nil if nested comments should be quoted.
index 7acc19b90586f1edaddf71c5c299c55ce6ed98b8..994b2779d1aac983c1a88da0efbf6804664decde 100644 (file)
@@ -529,6 +529,8 @@ Many aspects this mode can be customized using
   (setq-local comment-start-skip "<!--[ \t\r\n]*")
   (setq-local comment-end "-->")
   (setq-local comment-end-skip "[ \t\r\n]*-->")
+  (setq-local block-comment-start "<!--")
+  (setq-local block-comment-end "-->")
   (setq-local comment-line-break-function #'nxml-newline-and-indent)
   (setq-local comment-quote-nested-function #'nxml-comment-quote-nested)
   (setq-local comment-continue "") ; avoid double-hyphens as a padding
index 516d5f9b7227f84c77d040d25192bc6f80384c43..9fd2a678903c81b4c4a2f3f19a05e910a7dd40eb 100644 (file)
@@ -275,6 +275,8 @@ Set up:
  - `comment-end'
  - `comment-start-skip'
  - `comment-end-skip'
+ - `block-comment-start'
+ - `block-comment-end'
  - `adaptive-fill-mode'
  - `adaptive-fill-first-line-regexp'
  - `paragraph-start'
@@ -291,6 +293,8 @@ Set up:
               (rx (* (syntax whitespace))
                   (group (or (syntax comment-end)
                              (seq (+ "*") "/")))))
+  (setq-local block-comment-start "/*")
+  (setq-local block-comment-end "*/")
   (setq-local adaptive-fill-mode t)
   (setq-local adaptive-fill-function #'c-ts-common--adaptive-fill-prefix)
   ;; Always accept * or | as prefix, even if there's only one line in
index 82bcf5ef7c1063f497da19a1401b8bbfac107c55..1bd946a6c3695f64adc92f774fbd0931d0f3d160 100644 (file)
@@ -679,6 +679,8 @@ what the parent of the node would be if it were a node."
     (setq-local comment-start "// ")
     (setq-local comment-end "")
     (setq-local comment-start-skip (rx "//" (* (syntax whitespace))))
+    (setq-local block-comment-start "/*")
+    (setq-local block-comment-end "*/")
 
     ;; Indent.
     (setq-local indent-tabs-mode t
index 0b4c9f814529de6868207536b993885b66dc7454..5f06ea1139849fd458e10d774169045f5f5459ff 100644 (file)
@@ -3771,6 +3771,8 @@ Currently there are `js-mode' and `js-ts-mode'."
   (setq-local comment-start "// ")
   (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
   (setq-local comment-end "")
+  (setq-local block-comment-start "/*")
+  (setq-local block-comment-end "*/")
   (setq-local fill-paragraph-function #'js-fill-paragraph)
   (setq-local normal-auto-fill-function #'js-do-auto-fill)
 
index 1b8f033e97ad1d4fb9d26bd254fe25505ebcbab5..c13e2e7f956daf0fea310ad83630636907f41f18 100644 (file)
@@ -137,6 +137,8 @@ Return nil if there is no name or if NODE is not a defun node."
   (setq-local comment-start "// ")
   (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
   (setq-local comment-end "")
+  (setq-local block-comment-start "/*")
+  (setq-local block-comment-end "*/")
 
   ;; Electric
   (setq-local electric-indent-chars
index cac56ace749ed304afb520ae250585ea8f6f1e62..d606ad6ccd96a00de6507f9479bcb30554e5c299 100644 (file)
@@ -667,6 +667,8 @@ Calls REPORT-FN directly."
     (setq-local comment-start "--")
     (setq-local comment-start-skip "--\\s-*")
     (setq-local comment-end "")
+    (setq-local block-comment-start "--[[" )
+    (setq-local block-comment-end "]]"))
 
     ;; Font-lock.
     (setq-local treesit-font-lock-settings lua-ts--font-lock-settings)
index bd6bc3b28ac08dfcf3a72452da2b8cc6886b175c..9dcaff9645e1df9a85b5635b95cc9629f0936109 100644 (file)
@@ -1767,7 +1767,9 @@ Coloring:
 
   (setq-local comment-start "// ")
   (setq-local comment-start-skip "\\(?://\\|(\\*\\|{\\)[ \t]*")
-  (setq-local comment-end-skip "[ \t]*\\(?:\n\\|\\*)\\|}\\)"))
+  (setq-local comment-end-skip "[ \t]*\\(?:\n\\|\\*)\\|}\\)")
+  (setq-local block-comment-start "(*")
+  (setq-local block-comment-end "*)"))
 
 (provide 'opascal)
 ;;; opascal.el ends here
index b6316d4dfe19b92b7c666f6c590737af854bc4ac..113cf68c8d607f83fa20c2a06895aa9a4efd6382 100644 (file)
@@ -348,6 +348,8 @@ See also the user variables `pascal-type-keywords', `pascal-start-keywords' and
   (setq-local comment-start "{")
   (setq-local comment-start-skip "(\\*+ *\\|{ *")
   (setq-local comment-end "}")
+  (setq-local block-comment-start "(*")
+  (setq-local block-comment-end "*)")
   (add-hook 'completion-at-point-functions 'pascal-completions-at-point nil t)
   ;; Font lock support
   (setq-local font-lock-defaults '(pascal-font-lock-keywords nil t))
index 3162bf665009300ebeea2b935c8c3637aa1b8e4b..d9437297bb63da4e28cb102b2971c92f195f46b8 100644 (file)
@@ -650,6 +650,8 @@ at least 3 (which is the default value)."
     ;; Comments.
     (setq-local comment-start "// ")
     (setq-local comment-end "")
+    (setq-local block-comment-start "/*")
+    (setq-local block-comment-end "*/")
     (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
                                            (seq "/" (+ "*")))
                                        (* (syntax whitespace))))
index e715a11a03b536fc42ffd9957d17e75922b5d727..45d8a77489bb1c3d2e73405e4ad00b987516b97a 100644 (file)
@@ -1853,6 +1853,8 @@ implementations: `css-mode' and `css-ts-mode'."
   (setq-local comment-start-skip "/\\*+[ \t]*")
   (setq-local comment-end "*/")
   (setq-local comment-end-skip "[ \t]*\\*+/")
+  (setq-local block-comment-start "/*")
+  (setq-local block-comment-end "*/")
   (setq-local electric-indent-chars
               (append css-electric-keys electric-indent-chars))
   ;; The default "." creates ambiguity with class selectors.
@@ -2076,6 +2078,8 @@ be used to fill comments.
   "Major mode to edit \"Sassy CSS\" files."
   (setq-local comment-start "// ")
   (setq-local comment-end "")
+  (setq-local block-comment-start "/*")
+  (setq-local block-comment-end "*/")
   (setq-local comment-continue " *")
   (setq-local comment-start-skip "/[*/]+[ \t]*")
   (setq-local comment-end-skip "[ \t]*\\(?:\n\\|\\*+/\\)")
index c4a000dbfc810a947295642e4d2136efe8c89347..c188fa2d3d105a1ad5c86e4550daa7cccf2f4478 100644 (file)
@@ -622,6 +622,8 @@ Do \\[describe-key] on the following bindings to discover what they do.
   (setq-local indent-line-function #'sgml-indent-line)
   (setq-local comment-start "<!-- ")
   (setq-local comment-end " -->")
+  (setq-local block-comment-start "<!--")
+  (setq-local block-comment-end "-->")
   (setq-local comment-indent-function #'sgml-comment-indent)
   (setq-local comment-line-break-function #'sgml-comment-indent-new-line)
   (setq-local skeleton-further-elements '((completion-ignore-case t)))