"William Xue" <address@hidden> writes:
> 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
>
> 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.
You can find this package:
;;; bc-mode.el --- Minor mode for formatting right-margin block comments.
;;
;; Copyright (C) 1991-1996 Steve Burgett <address@hidden>
;; $Id: bc-mode.el,v 1.1 1996/10/19 18:54:00 burgett Exp burgett $
;;
;; Author: Steve Burgett <address@hidden>
;; Created: July 1992
;; Version: 1.1
;; Keywords: comment minor-mode programming editing
;; HTTP: http://robotics.eecs.berkeley.edu/~burgett/
It has very sophisticated comment handling, I think it does what you
want.