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

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

Re: A variant of match-end, but after replacement?


From: Pascal J. Bourguignon
Subject: Re: A variant of match-end, but after replacement?
Date: Sun, 19 Jul 2015 15:41:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Marcin Borkowski <mbork@mbork.pl> writes:

>>     (let ((old-end (prog1 (match-end 1)
>>                      (replace-match "newtext" t t string 1)))) 
>>        (do-something old-end))
>
> Still not there - I can't assume that "newtext" will have the same
> length as the thing it replaced...

Sorry, I misread what you wanted. 

    (let ((new-end (+ (prog1 (match-beginning 1)
                         (replace-match new-text t t string 1)))
                      (length new-text)))
       (do-somthing-from new-end))


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


reply via email to

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