unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
To: "William Xue" <william.xue@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: how to align the comments to start from the same column?
Date: Fri, 13 Jul 2007 11:18:49 -0700	[thread overview]
Message-ID: <200707131818.l6DIIoG1003172@oogie-boogie.ics.uci.edu> (raw)
In-Reply-To: <op.tu79w8dbhkv0w5@williamnb> (William Xue's message of "Tue\, 10 Jul 2007 10\:44\:58 +0800")

"William Xue" <william.xue@gmail.com> 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 <burgett@eecs.berkeley.edu>
;; $Id: bc-mode.el,v 1.1 1996/10/19 18:54:00 burgett Exp burgett $
;;
;; Author: Steve Burgett <burgett@eecs.berkeley.edu>
;; 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. 

  parent reply	other threads:[~2007-07-13 18:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-10  2:44 how to align the comments to start from the same column? William Xue
2007-07-10 11:31 ` Alan Mackenzie
2007-07-10 13:41 ` Stefan Monnier
2007-07-11  1:44   ` William Xue
2007-07-11  4:01     ` Stefan Monnier
2007-07-11  7:03       ` William Xue
2007-07-13 18:18 ` Dan Nicolaescu [this message]
2007-07-14  6:04   ` William Xue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200707131818.l6DIIoG1003172@oogie-boogie.ics.uci.edu \
    --to=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    --cc=william.xue@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).