help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[h-e-w] replace-match bug ???


From: Gian Uberto Lauri
Subject: [h-e-w] replace-match bug ???
Date: Thu, 11 Oct 2001 12:17:26 +0200 (MET DST)

Hello!

I have this function

(defun sed(file from to)
  "I know, I should learn to use the real sed :), this one changes occurrences 
of
FROM to TO in the FILE file, saves the buffer and kills it. Meant to be used 
with 
gnudoit."
  (find-file file)
  (while (search-forward from nil t)
    (replace-match to))
  (save-buffer)
  (kill-buffer (buffer-name))
  file)

When I try to run this on a file calling it this way:

(sed "f:/A2Euro/Asp3/A2S_BAT_ordini_vecchi.asp" 
     "/BonificaA2/Asp" 
     "/A2V2/asp3" )

the   first   occurrence   of   "/BonificaA2/Asp"  is   changed   into
"//Bonifica/A2" and then I get an (args-out-of-range 0 nn) that's shot
by the font lock code.

If  I run  the (sed)  function with  the buffer  loaded and  the point
placed after the first occurrence of "/BonificaA2/Asp" everything goes
fine.

I ask the gurus : "Where's the problem". Did I write something stupid
in my function ?

Gian Uberto Lauri               "Bloody instructions which, being taught, 
address@hidden                     return to plague their inventor" 
C.so Stati Uniti 23              ("Macbeth", Atto 1, Scena 7; Hacker Jargon
Tel: +39 049 828 3556             File 4.0.0, voce: Programming, 1)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]