In Common Lisp you can define multiline comments with #| \n\n\n |#.
However when I press Return with cursor above such comment, each line of the comment is appended with ' ;' and pressing Return multiple time can result in many ; ; ; ;.
;; aaa.lisp
(warn "beginning")
#|
; ; ; ; ;
ala ma ; ; ; ; ;
kota ; ; ; ; ;
; ; ; ; ;
|#
(warn "end")
That is very annoying.
I suspect the culprit is the code indicated below, but I do not know how to fix it. If there is no easy fix, do you suggest any alternatives?
emacs-31/lisp/newcomment.el::1117
(defun comment-add (arg)
"Compute the number of extra comment starter characters.
\(Extra semicolons in Lisp mode, extra stars in C mode, etc.)
If ARG is non-nil, just follow ARG.
If the comment starter is multi-char, just follow ARG.
Otherwise obey `comment-add'."
(if (and (null arg) (= (string-match "[ \t]*\\'" comment-start) 1))
(* comment-add 1)
(1- (prefix-numeric-value arg))))
Alternative
I can select a region and then press C-x r t for the command string-rectangle. The command asks me for the character, so I enter the comment characters ';;'. That gives me the same as the multiline comment but without the problem with garbling by adding the ; at column 40.
It's Paredit related problem
Commenting out these two lines hides the problem https://github.com/bigos/prelude/blob/c4a2e859fe11a0d5731d2109ecf253d51b0301d0/personal/organised.el#L845
Minimal configuration
Starting Emacs with minimal configuration https://github.com/bigos/Pyrulis/blob/master/Emacs/problem-with-paredit-garbling-multiline-comments.org#replicating-minimal-config
and trying to edit example Common Lisp file with multi line comment, still shows the problem.
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(unless (package-installed-p 'paredit)
(package-install 'paredit))
(add-hook 'lisp-mode-hook 'enable-paredit-mode)
;; end of init.el -----------------------------
emacs -Q
?emacs -Q
and it does not work fine when you load your init file, then bisect your init file to find the breakage.