all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Please help: How to reformat existing c++ files using emacs
@ 2005-03-29 21:46 Xiaopeng Xiong
       [not found] ` <d2ciba$acg-49YGyUKL1LK+Hifv2AGDuZVzexx5G7lz@public.gmane.org>
       [not found] ` <mailman.569.1112135487.28103.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Xiaopeng Xiong @ 2005-03-29 21:46 UTC (permalink / raw)


I have a bunch of files that look ugly (e.g., inappropriate indents). I just 
can not
type TAB at each line.

If there is any command for formatting all files under a directory, that
would be best. But currently, formatting a single file is enough for me. If 
you know any command to do so, please help!


Thanks a lot!



-- 
Xiaopeng Xiong
CS143, Computer Sciences Building
Purdue University, West Lafayette, IN, 47907
Tel: (765)496-6038
URL: http://www.cs.purdue.edu/homes/xxiong 

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

* Re: Please help: How to reformat existing c++ files using emacs
       [not found] ` <d2ciba$acg-49YGyUKL1LK+Hifv2AGDuZVzexx5G7lz@public.gmane.org>
@ 2005-03-29 21:57   ` Jochen Küpper
  0 siblings, 0 replies; 3+ messages in thread
From: Jochen Küpper @ 2005-03-29 21:57 UTC (permalink / raw)


"Xiaopeng Xiong" <xpxiong-olO2ZdjDehc3uPMLIKxrzw@public.gmane.org> writes:

> formatting a single file is enough for me. If you know any command
> to do so, please help!

C-PgUp C-<SPC> C-PgDn M-x indent region or similar...

,----[ C-h f indent-region RET ]
| indent-region is an interactive compiled Lisp function in `indent'.
| It is bound to C-M-\.
| (indent-region START END &optional COLUMN)
| 
| Indent each nonblank line in the region.
| A numeric prefix argument specifies a column: indent each line to that column.
| 
| With no prefix argument, the command chooses one of these methods and
| indents all the lines with it:
| 
|   1) If `fill-prefix' is non-nil, insert `fill-prefix' at the
|      beginning of each line in the region that does not already begin
|      with it.
|   2) If `indent-region-function' is non-nil, call that function
|      to indent the region.
|   3) Indent each line as specified by the variable `indent-line-function'.
| 
| Called from a program, START and END specify the region to indent.
| If the third argument COLUMN is an integer, it specifies the
| column to indent to; if it is nil, use one of the three methods above.
| 
| [back]
`----

Greetings,
Jochen
-- 
Einigkeit und Recht und Freiheit                http://www.Jochen-Kuepper.de
    Liberté, Égalité, Fraternité                GnuPG key: CC1B0B4D
        (Part 3 you find in my messages before fall 2003.)

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

* Re: Please help: How to reformat existing c++ files using emacs
       [not found] ` <mailman.569.1112135487.28103.help-gnu-emacs@gnu.org>
@ 2005-03-30  1:43   ` Quokka
  0 siblings, 0 replies; 3+ messages in thread
From: Quokka @ 2005-03-30  1:43 UTC (permalink / raw)


Jochen Küpper wrote:
> "Xiaopeng Xiong" <xpxiong@purdue.edu> writes:
> 
> 
>>formatting a single file is enough for me. If you know any command
>>to do so, please help!
> 
> 
> C-PgUp C-<SPC> C-PgDn M-x indent region or similar...

Alternatively use a seperate tool such as gnu indent...

http://www.gnu.org/software/indent/indent.html

I find this a much better way to go for indenting
multiple files... also indent will do formating that
emacs will not! such as moving the position of
braces.

Although emacs is the One True Editor.. sometimes
it is better to use other tools.

Paul

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

end of thread, other threads:[~2005-03-30  1:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-29 21:46 Please help: How to reformat existing c++ files using emacs Xiaopeng Xiong
     [not found] ` <d2ciba$acg-49YGyUKL1LK+Hifv2AGDuZVzexx5G7lz@public.gmane.org>
2005-03-29 21:57   ` Jochen Küpper
     [not found] ` <mailman.569.1112135487.28103.help-gnu-emacs@gnu.org>
2005-03-30  1:43   ` Quokka

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.