[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing the Emacs engine to Guile
From: |
Cecil Westerhof |
Subject: |
Re: Changing the Emacs engine to Guile |
Date: |
Wed, 08 Dec 2010 15:15:26 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Op dinsdag 22 jun 2010 19:28 CEST schreef Pascal J. Bourguignon:
>>> this (while (re-search-forward ...)) loop modifies the line for each
>>> occurence of the regexp, replacing it with (substring substitute-str 0
>>> match-length), which is a different replacement string in general.
>>
>> Why? I would think the replacement string is the same. (When using
>> single byte characters.)
>
> With:
>
> substitute-str = "Abcdef" ; initally
> start-match = 4
> end-match = 12
> match-length = 8
>
>
> substitute-str will become "AbcdefAbcdef",
> and (substring substitute-str 0 match-length) = "AbcdefAb"
> while (substring substitute-str start-match end-match) = "efAbcdef"
I made a stupid mistake. It did not show because I only changed a
substring at the start of the line. Better code is at:
http://www.decebal.nl/guile/sources/substituteExpression.scm
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof