Subject: bug#3370: 23.0.94; `comment-region' indents comment chars inappropriately

From: "Drew Adams" <[email-masked]>
Date: Mon, 25 May 2009 00:02:02 -0700

> 'indent was also the preference of the person that wrote the new
> incarnation of the region indent code and who explicitly approved the
> change: Stefan.

`comment-region' is not, or at least was not, about indenting. It is about
commenting out the code in the region.

There is nothing in the Elisp manual about `comment-region'. What there is about
it in the Emacs manual does not mention at all how it affects indenting or is
affected by indenting, and it does not mention `comment-style' at all.

The only mention of indenting in a node that talks also about `comment-region'
is the mention that lines with multiple comment delimiters can sometimes be
indented differently, depending on the number of comment delimiters. That has
always been the case in Emacs (;;; vs ;; vs ; - indented differently by TAB or
C-M-q etc.). Previously, there was no relation between `comment-region' and
indenting, AFAIK. And there is still no documented relation, that I can find.

Finally, the doc string for `comment-region' still says exactly what it said for
Emacs 22. And it says that it comments (or uncomments) "each line" in the
region. Not just some text in the line, starting after some whitespace, but the
(whole) line. And it says nothing about indenting the commented line.

And it says, "By default, comments start at the left margin". Admittedly, that
is vague and could be interpreted to mean different things. But there is
definitely no mention that `comment-region' indents lines that it comments, that
is, that it produces an indented comment.