String reboot - (1a) incidental whitespace

Guy Steele guy.steele at oracle.com
Fri Apr 19 01:12:18 UTC 2019



> On Apr 18, 2019, at 8:04 PM, John Rose <john.r.rose at oracle.com> wrote:
> . . .
> One reason people hate those extra stars in comments is
> that they are using an editor (like Emacs) which is pretty
> good at generic indentation, but doesn't know about
> language-specific left margin markup, like stars or
> (in Guy's second proposal) single quotes.

Actually, Emacs in Java mode does know quite a bit about doc comments.  If you are in the middle of a doc comment:

	(1) If you open up a blank line and type *, the indentation of the star automatically matches that of the leading star on the preceding line.

	(2) If you’re within a doc comment and type Meta-J to insert a line break (a routine thing to do in Emacs), a correctly indented star (and a space) are supplied on the new line after the break.

	(3) If you use Meta-Q to fill (that is, rejustify) a paragraph, all the right things happen to maintain the stars even as the line breaks and number of lines in the paragraph change.  I do this all the time.

	(4) If you set these variables as follows:
			comment-style		extra-line
			comment-start		“/* “
			comment-end		“ */“
	    then the command Meta-; will create a new doc comment, properly indented stars and all, around the text you have selected.
	    (If you don’t set those variables as indicated, the default for Java is to use // comments instead.)



More information about the amber-spec-experts mailing list