emacs-devel
[Top][All Lists]
Advanced

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

Re: how to align the comments to start from the same column?


From: Stefan Monnier
Subject: Re: how to align the comments to start from the same column?
Date: Tue, 10 Jul 2007 09:41:03 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

> 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





reply via email to

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