[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: c-mode comment indent alignment issue
From: |
Alan Mackenzie |
Subject: |
Re: c-mode comment indent alignment issue |
Date: |
Wed, 24 Apr 2013 11:56:22 +0000 (UTC) |
User-agent: |
tin/1.9.6-20101126 ("Burnside") (UNIX) (FreeBSD/8.4-PRERELEASE (amd64)) |
Francis Belliveau <f.belliveau@comcast.net> wrote:
> I am having trouble figuring out how to control comment indentation and
> alignment. Consider the following sequence of comments:
> /*****
> *
> * @file foo.h
> *
> *****
> */
> /*
> * $Revision$
> *
> *****
> */
> /*
> *****
> *
> * Sample...
> *
> *****
> */
> In c-mode when they are all in the region and I "indent-region", the
> first two comments don't change, but the content of the last comment
> gets jammed against the left edge.
> If I put a " *" before the upper row of asterisks all is okay.
> Can anybody tell me how I can take control of the comment indentation
> logic to stop the indentation from being eliminated?
This is difficult. The critical line which determines the indentation
of the entire comment is the second line, thus:
/*
***** <===============
....
If the number of asterisks is greater than the number in the "/***"
comment opener, the second line is "aligned left" under the "/***".
(This is what you don't like here.) Otherwise, like in the "foo.h"
and "$Revision$" comments, it is "aligned right". The thinking behind
this left alignment is to indent this case:
/*
** Text.
** Text.
*/
This is all done by the lisp function `c-lineup-C-comments'. Adapting
this function to change this behaviour could give you the result you want.
Instructions for doing this are on page "Custom Line-Up" of the CC Mode
manual.
Sorry I can't be more helpful.
> Fran
--
Alan Mackenzie (Nuremberg, Germany).