From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: how to align the comments to start from the same column? Date: Tue, 10 Jul 2007 09:41:03 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1184074874 3737 80.91.229.12 (10 Jul 2007 13:41:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 10 Jul 2007 13:41:14 +0000 (UTC) Cc: emacs-devel@gnu.org To: "William Xue" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 10 15:41:11 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I8Fxm-0000zw-Ie for ged-emacs-devel@m.gmane.org; Tue, 10 Jul 2007 15:41:10 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I8Fxm-00082D-4S for ged-emacs-devel@m.gmane.org; Tue, 10 Jul 2007 09:41:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I8Fxj-00081y-Du for emacs-devel@gnu.org; Tue, 10 Jul 2007 09:41:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I8Fxh-00081m-Uv for emacs-devel@gnu.org; Tue, 10 Jul 2007 09:41:07 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I8Fxh-00081j-SZ for emacs-devel@gnu.org; Tue, 10 Jul 2007 09:41:05 -0400 Original-Received: from tomts5.bellnexxia.net ([209.226.175.25] helo=tomts5-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I8Fxh-0008AH-Ft for emacs-devel@gnu.org; Tue, 10 Jul 2007 09:41:05 -0400 Original-Received: from pastel.home ([70.55.140.102]) by tomts5-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20070710134103.OTLX25465.tomts5-srv.bellnexxia.net@pastel.home> for ; Tue, 10 Jul 2007 09:41:03 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 4A7257FEF; Tue, 10 Jul 2007 09:41:02 -0400 (EDT) In-Reply-To: (William Xue's message of "Tue\, 10 Jul 2007 10\:44\:58 +0800") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-detected-kernel: Solaris 8 (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:74557 Archived-At: > when I am coding in cpp files, I will use M-; to make some comments, like > following: > IoCreateFileSpecifyDeviceObjectHint(&h_rd_file, // > file handle > GENERIC_READ | > GENERIC_WRITE, // desire access > &rd_file_obj_attr, > // object attributes > &rd_io_status_block, > // io status block > 0, // > allocation size > FILE_ATTRIBUTE_NORMAL, > // file attributes > FILE_SHARE_READ, > // share access > Is there a way to format the comments to the same column? > I want something like: > 1. select the codes as a region > 2. press a magic keybinding > 3. the comments align to the longest column of comments in the region. The Emacs-22.1 version of M-; already tries to align comments on neighbouring lines. This feature has been slightly improved in Emacs-CVS, but if it doesn't work for you in Emacs-22.1, then it probably won't work any better in Emacs-CVS. The most likely reason why it may appear not to work is that it only aligns comments if it can do so without pushing them past the `comment-fill-column' (which defaults to `fill-column'). So try setting this value to something larger (or better yet: reformat your code so as not to use so many columns ;-). Stefan