unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* inserting a space in front of all lines
@ 2004-01-29  0:56 Jade Dang
  2004-01-29  1:19 ` Jesper Harder
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jade Dang @ 2004-01-29  0:56 UTC (permalink / raw)


Hi,
I have a file with thousands of lines and I want to indent all of them. Is there 
an easy way to do this?
Thanks,
Jade

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

* Re: inserting a space in front of all lines
  2004-01-29  0:56 inserting a space in front of all lines Jade Dang
@ 2004-01-29  1:19 ` Jesper Harder
  2004-01-29  2:03   ` Jade Dang
  2004-01-29  1:33 ` Jeffery B. Rancier
  2004-01-29 19:02 ` kgold
  2 siblings, 1 reply; 5+ messages in thread
From: Jesper Harder @ 2004-01-29  1:19 UTC (permalink / raw)


Jade Dang <jaddang@cisco.com> writes:

> I have a file with thousands of lines and I want to indent all of
> them. Is there an easy way to do this?

Mark the lines, `C-x h', and press `C-M-\' (indent-region).

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

* Re: inserting a space in front of all lines
  2004-01-29  0:56 inserting a space in front of all lines Jade Dang
  2004-01-29  1:19 ` Jesper Harder
@ 2004-01-29  1:33 ` Jeffery B. Rancier
  2004-01-29 19:02 ` kgold
  2 siblings, 0 replies; 5+ messages in thread
From: Jeffery B. Rancier @ 2004-01-29  1:33 UTC (permalink / raw)


Jade Dang <jaddang@cisco.com> writes:

> I have a file with thousands of lines and I want to indent all of
> them. Is there an easy way to do this?

,----[ C-h k C-x h ]
| C-x h runs the command mark-whole-buffer
|    which is an interactive compiled Lisp function in `simple'.
| (mark-whole-buffer)
| 
| Put point at beginning and mark at end of buffer.
| You probably should not use this function in Lisp programs;
| it is usually a mistake for a Lisp function to use any subroutine
| that uses or sets the mark.
`----

followed by:

,----[ C-h f indent-region RET ]
| indent-region is an interactive compiled Lisp function in `indent'.
| (indent-region START END COLUMN)
| 
| Indent each nonblank line in the region.
| With prefix no argument, indent each line using `indent-according-to-mode',
| or use `indent-region-function' to do the whole region if that's non-nil.
| If there is a fill prefix, make each line start with the fill prefix.
| With argument COLUMN, indent each line to that column.
| 
| When you call this from a program, START and END specify
| the region to indent, and COLUMN specifies the indentation column.
| If COLUMN is nil, then indent each line according to the mode.
`----
-- 
Thanks,
Jeff

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

* Re: inserting a space in front of all lines
  2004-01-29  1:19 ` Jesper Harder
@ 2004-01-29  2:03   ` Jade Dang
  0 siblings, 0 replies; 5+ messages in thread
From: Jade Dang @ 2004-01-29  2:03 UTC (permalink / raw)


Thanks to everyone who replied. I got it to work. I really appreciate the help!
Still learning all that emacs has to offer...


Jesper Harder wrote:
> Jade Dang <jaddang@cisco.com> writes:
> 
> 
>>I have a file with thousands of lines and I want to indent all of
>>them. Is there an easy way to do this?
> 
> 
> Mark the lines, `C-x h', and press `C-M-\' (indent-region).

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

* Re: inserting a space in front of all lines
  2004-01-29  0:56 inserting a space in front of all lines Jade Dang
  2004-01-29  1:19 ` Jesper Harder
  2004-01-29  1:33 ` Jeffery B. Rancier
@ 2004-01-29 19:02 ` kgold
  2 siblings, 0 replies; 5+ messages in thread
From: kgold @ 2004-01-29 19:02 UTC (permalink / raw)


Jade Dang <jaddang@cisco.com> writes:

> I have a file with thousands of lines and I want to indent all of
> them. Is there an easy way to do this?

You've received replies for indenting.  

To insert arbitrary text, look at the rectangle commands.  In
particular, after defining a rectangle with all the lines of interest
and of zero width starting in the first column:

C-x r t runs the command string-rectangle
   which is an interactive autoloaded Lisp function in `rect'.

Replace rectangle contents with STRING on each line.
The length of STRING need not be the same as the rectangle width.

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

end of thread, other threads:[~2004-01-29 19:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-29  0:56 inserting a space in front of all lines Jade Dang
2004-01-29  1:19 ` Jesper Harder
2004-01-29  2:03   ` Jade Dang
2004-01-29  1:33 ` Jeffery B. Rancier
2004-01-29 19:02 ` kgold

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