unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to format a assignment statement in cc-mode
@ 2007-08-30  9:01 Yu Hong
  2007-08-30 12:57 ` David Hansen
       [not found] ` <mailman.63.1188479300.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Yu Hong @ 2007-08-30  9:01 UTC (permalink / raw)
  To: help-gnu-emacs

I have some assignment statements like the following:

int first_variable = 1;
unsigned char another_variable = 'c';

I'm wandering how to make all the all the variable names start on the
same column. And the following equal signs, literal values should all
start on the same column. In this way the statements can be easier to
read. How can i do this easily in emacs? Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to format a assignment statement in cc-mode
  2007-08-30  9:01 how to format a assignment statement in cc-mode Yu Hong
@ 2007-08-30 12:57 ` David Hansen
  2007-08-31  5:01   ` William Xu
       [not found] ` <mailman.63.1188479300.18990.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 4+ messages in thread
From: David Hansen @ 2007-08-30 12:57 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, 30 Aug 2007 02:01:24 -0700 Yu Hong wrote:

> I have some assignment statements like the following:
>
> int first_variable = 1;
> unsigned char another_variable = 'c';
>
> I'm wandering how to make all the all the variable names start on the
> same column. And the following equal signs, literal values should all
> start on the same column. In this way the statements can be easier to
> read. How can i do this easily in emacs? Thanks.

I haven't tried it myself, but i think the `align' package can do such
stuff (ships with Emacs 22).

David

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to format a assignment statement in cc-mode
       [not found] ` <mailman.63.1188479300.18990.help-gnu-emacs@gnu.org>
@ 2007-08-31  0:57   ` Yu Hong
  0 siblings, 0 replies; 4+ messages in thread
From: Yu Hong @ 2007-08-31  0:57 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 30, 8:57 pm, David Hansen <david.han...@gmx.net> wrote:
> On Thu, 30 Aug 2007 02:01:24 -0700 Yu Hong wrote:
>
> > I have some assignment statements like the following:
>
> > int first_variable = 1;
> > unsigned char another_variable = 'c';
>
> > I'm wandering how to make all the all the variable names start on the
> > same column. And the following equal signs, literal values should all
> > start on the same column. In this way the statements can be easier to
> > read. How can i do this easily in emacs? Thanks.
>
> I haven't tried it myself, but i think the `align' package can do such
> stuff (ships with Emacs 22).
>
> David

Yes, `M-x align-current' works. Thanks, David.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to format a assignment statement in cc-mode
  2007-08-30 12:57 ` David Hansen
@ 2007-08-31  5:01   ` William Xu
  0 siblings, 0 replies; 4+ messages in thread
From: William Xu @ 2007-08-31  5:01 UTC (permalink / raw)
  To: help-gnu-emacs

David Hansen <david.hansen@gmx.net> writes:

> I haven't tried it myself, but i think the `align' package can do such
> stuff (ships with Emacs 22).

Correct. After `M-x align' on marked region, it turns into: 

,----
| int           first_variable   = 1;
| unsigned char another_variable = 'c';
`----

-- 
William

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-31  5:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-30  9:01 how to format a assignment statement in cc-mode Yu Hong
2007-08-30 12:57 ` David Hansen
2007-08-31  5:01   ` William Xu
     [not found] ` <mailman.63.1188479300.18990.help-gnu-emacs@gnu.org>
2007-08-31  0:57   ` Yu Hong

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).