>>>> "Paul" == Paul Krause
<paulkrause1(a)mediaone.net> writes:
Paul> Adrian Aichner <adrian(a)xemacs.org> writes:
> >> Do we want to make C-u M-x comment-region smarter?
>
Paul> No! Make indentation smarter. If a comment begins in column
Paul> 1, don't
Paul> indent it when reindenting a region. This solves the
Paul> problem without
Paul> style-changes or hacks to comment-region.
>
Paul> Have I overlooked anything?
>
>> This, maybe?
>
>> (Info-goto-node
"(xemacs)Comments")
>
>> Adrian
Paul> Could you be a little more specific? I don't what you're
Paul> referring to. Maybe this?
Paul> You can also use `Meta-;' to align an existing comment. If a line
Paul> already contains the string that starts comments, `M-;' just moves
Paul> point after it and re-indents it to the conventional place.
Paul> Exception:
Paul> comments starting in column 0 are not moved.
Yes, that, and also the following paragraph.
Some major modes have special rules for indenting certain kinds of
comments in certain contexts. For example, in Lisp code, comments which
start with two semicolons are indented as if they were lines of code,
instead of at the comment column. Comments which start with three
semicolons are supposed to start at the left margin. Emacs understands
these conventions by indenting a double-semicolon comment using TAB and
by not changing the indentation of a triple-semicolon comment at all.
You have a valid point, though.
single-; comments srarting in column 0 should not be moved and
comment-region would work as advertised!
You opened my eyes!
To All:
Isn't this what we should do?
Martin?
Stephen?
Best regards,
Adrian
Paul> The trouble is, it doesn't work as documented. Here's a sample.
Paul> ;;; header comment
Paul> ;; This function is just an example.
Paul> ;;; Here either two or three semicolons are appropriate.
Paul> (defun foo (x)
Paul> ;;; And now, the first part of the function:
Paul> (lambda (foo bar)
Paul> (if (foo bar)
Paul> 'bif
Paul> 'baz))
Paul> ;; The following line adds one.
Paul> (1+ x)) ; This line adds one.
Paul> ;; This function is just an example.
Paul> ;;; Here either two or three semicolons are appropriate.
Paul> (defun foo (x)
Paul> ;;; And now, the first part of the function:
Paul> ;; The following sexp is commented out using comment-region.
Paul> ; (lambda (foo bar)
Paul> ; (if (foo bar)
Paul> ; 'bif
Paul> ; 'baz))
Paul> ;; The following line adds one.
Paul> (1+ x)) ; This line adds one.
Paul> I get the same indentation using either M-; or C-M-q.
Paul> Testing using xemacs -vanilla on
Paul> XEmacs 21.2 (beta37) "Pan" (win32) of Sun Dec 03 2000 on
PAULKRAUSE
Paul> as well as
Paul> XEmacs 21.0 "20 minutes to Nikko" (win32) of Fri Mar 26 1999 on
Paul> BLACKBIRD
Paul> (which I just happen to have lying around)
--
Adrian Aichner
mailto:adrian@xemacs.org
http://www.xemacs.org/