help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: M-q on comments in source code


From: Andreas Röhler
Subject: Re: M-q on comments in source code
Date: Sat, 24 May 2014 17:41:25 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Icedove/24.5.0

On 24.05.2014 13:37, lee wrote:
Hi,

modes like c-mode indent comments with the code, which is fine as an end
result and not so ideal when writing them.  To give an example:


,----
|                       if(full)
|                               {
|                                       //
|                                       // A max value might be removed when 
the arrays are shifted.  In
|                                       // that case, find a new one after 
shifting.  Otherwise, the max
`----


Now press M-q to format the comment and the above looks like this:


,----
|                       if(full)
|                               {
|                                       //
|                                       // A max value might be
|                                       // removed when the arrays are
|                                       // shifted.  In that case,
|                                       // find a new one after
|                                       // shifting.  Otherwise, the
|                                       // max continues to be known.
`----


This formatting is a bit silly ...  What can I do to get the comments
formatted as in the first example, i. e. the comment indented with the
source but with each line trimmed to a length of about max 75
characters, not counting the indentation?

I can manually unindent the lines, edit them, format them and reindent
them, and I`m looking for a better way.  Even something like
auto-fill-mode for comments that does it automatically would be nice.



M-x customize-variable RET comment-style RET

setting it to 0, "plain", does this solve it?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]