From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: c-mode comment indent alignment issue Date: Wed, 24 Apr 2013 11:56:22 +0000 (UTC) Organization: muc.de e.V. Message-ID: References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1366805042 19431 80.91.229.3 (24 Apr 2013 12:04:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 24 Apr 2013 12:04:02 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 24 14:04:06 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UUyQf-0003xT-Bs for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Apr 2013 14:04:05 +0200 Original-Received: from localhost ([::1]:40542 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUyQe-0007HX-Dl for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Apr 2013 08:04:04 -0400 Original-Path: usenet.stanford.edu!newsfeed.news.ucla.edu!news.snarked.org!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news.space.net!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 62 Original-NNTP-Posting-Host: news.muc.de Original-X-Trace: colin.muc.de 1366804582 8142 193.149.48.2 (24 Apr 2013 11:56:22 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: Wed, 24 Apr 2013 11:56:22 +0000 (UTC) User-Agent: tin/1.9.6-20101126 ("Burnside") (UNIX) (FreeBSD/8.4-PRERELEASE (amd64)) Original-Xref: usenet.stanford.edu gnu.emacs.help:198056 X-Mailman-Approved-At: Wed, 24 Apr 2013 08:03:52 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:90323 Archived-At: Francis Belliveau 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).