[comp.editors] How to write this macro?

news@massey.ac.nz (USENET News System) (04/12/91)

How do I write a macro to do this?

In a file, delete the first 25 chars of every line.

-Raminder Singh

melling@cs.psu.edu (Michael D Mellinger) (04/12/91)

In GNU Emacs,

C-x ( M-25 C-d C-n C-x )

This assume that there are at least 25 characters on each line.  To do
the entire file, type M-"some number larger than number of lines" C-x e.

-Mike

meissner@osf.org (Michael Meissner) (04/13/91)

In article <1991Apr11.211336.19184@massey.ac.nz> news@massey.ac.nz
(USENET News System) writes:

| How do I write a macro to do this?
| 
| In a file, delete the first 25 chars of every line.

Another approach with GNU emacs is to use kill-rectangle.  Many people
seem to not know about the rectangle functions.  The rectangle
functions are safe even if the line doesn't contain 25 characters.
Quoting from the fine help file:

kill-rectangle:
Delete rectangle with corners at point and mark; save as last killed one.
Calling from program, supply two args START and END, buffer positions.
But in programs you might prefer to use delete-extract-rectangle.

yank-rectangle:
Yank the last killed rectangle with upper left corner at point.

open-rectangle:
Blank out rectangle with corners at point and mark, shifting text right.
The text previously in the region is not overwritten by the blanks,
but insted winds up to the right of the rectangle.
--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142

Considering the flames and intolerance, shouldn't USENET be spelled ABUSENET?