In lisp-mode.el there is lisp-fill-paragraph, that is hardcoded to
handle only lisp style comments that start with ';'.
With a moderate amount of effort, this function could be extended to
handle any language that has 'comment-start'.
For example, the expression (looking-at "[ \t]*;[; \t]*") could be changed
to (looking-at (concat "[ \t]*" comment-start-regexp "\\("
comment-start-regexp "\\|[ \t]\\)*"))
where comment-start-regexp is (regexp-quote (or comment-start ";"))
(defun lisp-fill-paragraph (&optional justify)
"Like \\[fill-paragraph], but handle Emacs Lisp comments.
If any of the current line is a comment, fill the comment or the
paragraph of it that point is in, preserving the comment's indentation
and initial semicolons."
;; Figure out what kind of comment we are looking at.
;; A line with nothing but a comment on it?
((looking-at "[ \t]*;[; \t]*")
Show replies by thread