From: Alan Mackenzie <acm@muc.de>
To: help-gnu-emacs@gnu.org
Subject: Re: c-mode comment indent alignment issue
Date: Wed, 24 Apr 2013 11:56:22 +0000 (UTC) [thread overview]
Message-ID: <kl8h96$7ue$1@colin.muc.de> (raw)
In-Reply-To: mailman.24526.1366762780.855.help-gnu-emacs@gnu.org
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).
next parent reply other threads:[~2013-04-24 11:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.24526.1366762780.855.help-gnu-emacs@gnu.org>
2013-04-24 11:56 ` Alan Mackenzie [this message]
2013-04-26 0:12 ` c-mode comment indent alignment issue Francis Belliveau
2013-04-30 14:47 ` Ludwig, Mark
2013-04-24 0:01 Francis Belliveau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='kl8h96$7ue$1@colin.muc.de' \
--to=acm@muc.de \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).