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: Alan Mackenzie
Subject: Re: how to align the comments to start from the same column?
Date: Tue, 10 Jul 2007 12:31:48 +0100
User-agent: Mutt/1.5.9i

Hi, William!

On Tue, Jul 10, 2007 at 10:44:58AM +0800, William Xue wrote:
> Hi,
> 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
 
[ Note: the above code appeared to go well beyond column 70.  I've
"re-unformatted" it to make it fit.  I don't think I've distorted its
meaning.]
 
> 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.

There is nothing quite like that at the moment.  However, you can
realign the comments on each line, one after the other.  First, set the
user option comment-column to a sensible value (say, 40), whether by
customize-variable or set-variable, or whatever.  Then do M-; on each
line.  This is described on the page "Comment Commands" of the Emacs
manual.

Another point: this thread would probably be more appropriate on
address@hidden rather than emacs-devel.

> -- 
> Sincerely yours,
> William

-- 
Alan Mackenzie (Ittersbach, Germany).




reply via email to

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