unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* delete the first few chars of each line
@ 2003-09-21 19:43 Zimmen Gnauh
  2003-09-21 19:51 ` David Kastrup
  2003-09-22 20:08 ` Pascal Bourguignon
  0 siblings, 2 replies; 5+ messages in thread
From: Zimmen Gnauh @ 2003-09-21 19:43 UTC (permalink / raw)


  To delete the first 10 chars of a line. Is there any simpler way
than the following:

(let beg (progn (beginning-of-line) (point))
        (delete-region beg 10))

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

* Re: delete the first few chars of each line
  2003-09-21 19:43 delete the first few chars of each line Zimmen Gnauh
@ 2003-09-21 19:51 ` David Kastrup
  2003-09-21 20:21   ` Stefan Monnier
  2003-09-22 20:08 ` Pascal Bourguignon
  1 sibling, 1 reply; 5+ messages in thread
From: David Kastrup @ 2003-09-21 19:51 UTC (permalink / raw)


Zimmen Gnauh <yah00204052@yahoo.com> writes:

>   To delete the first 10 chars of a line. Is there any simpler way
> than the following:
> 
> (let beg (progn (beginning-of-line) (point))
>         (delete-region beg 10))

This is a trick question.  The code above does something completely
different.

I'd probably do something like
(progn
  (beginning-of-line)
  (delete-region (point) (+ 10 (point))))

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: delete the first few chars of each line
  2003-09-21 19:51 ` David Kastrup
@ 2003-09-21 20:21   ` Stefan Monnier
  2003-09-21 20:49     ` David Kastrup
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2003-09-21 20:21 UTC (permalink / raw)


>   (delete-region (point) (+ 10 (point))))

Isn't this (delete-char 10) ?


        Stefan

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

* Re: delete the first few chars of each line
  2003-09-21 20:21   ` Stefan Monnier
@ 2003-09-21 20:49     ` David Kastrup
  0 siblings, 0 replies; 5+ messages in thread
From: David Kastrup @ 2003-09-21 20:49 UTC (permalink / raw)


"Stefan Monnier" <monnier@iro.umontreal.ca> writes:

> >   (delete-region (point) (+ 10 (point))))
> 
> Isn't this (delete-char 10) ?

Only if you have a brain.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: delete the first few chars of each line
  2003-09-21 19:43 delete the first few chars of each line Zimmen Gnauh
  2003-09-21 19:51 ` David Kastrup
@ 2003-09-22 20:08 ` Pascal Bourguignon
  1 sibling, 0 replies; 5+ messages in thread
From: Pascal Bourguignon @ 2003-09-22 20:08 UTC (permalink / raw)


Zimmen Gnauh <yah00204052@yahoo.com> writes:

>   To delete the first 10 chars of a line. Is there any simpler way
> than the following:
> 
> (let beg (progn (beginning-of-line) (point))
>         (delete-region beg 10))
 
C-h f let RET

(while (re-search-forward "^.........." nil t) 
    (delete-region (match-beginning 0) (match-end 0)))

or if you don't need it in a script:

M-x replace-regexp RET ^.......... RET RET


-- 
__Pascal_Bourguignon__
http://www.informatimago.com/
Do not adjust your mind, there is a fault in reality.

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

end of thread, other threads:[~2003-09-22 20:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-21 19:43 delete the first few chars of each line Zimmen Gnauh
2003-09-21 19:51 ` David Kastrup
2003-09-21 20:21   ` Stefan Monnier
2003-09-21 20:49     ` David Kastrup
2003-09-22 20:08 ` Pascal Bourguignon

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