>>>> "APA" == Adrian Aichner
<adrian(a)xemacs.org> writes:
Hi Vin, Didier,
21.1.14 shows the buggy behavior for short and long strings!
(emacs-version)
"XEmacs 21.1 (patch 14) \"Cuyahoga Valley\" [Lucid] (i386-pc-win32) of Mon
May 21 2001 on D5DC120J"
entertains this bug for strings of any length:
(replace-in-string
"This %s has under 50 characters." "%S" "string")
"This string has under 50 characters."
(replace-in-string
"This %s, on the other hand, has just over 50 characters." "%S"
"string")
"This string, on the other hand, has just over 50 characters."
Didier, we might need to work around this bug in patcher.el.
What do you think?
Adrian
APA> Hi again!
APA> replace-in-string implements an arbitrary limit bug that would turn
APA> some guys in Redwood green with envy :-)
APA> The second r-i-s does NOT honor case-fold-search in
APA> (emacs-version)
APA> "XEmacs 21.4 (patch 9) \"Informed Management (RC1)\" [Lucid]
(i586-pc-win32) of Sat May 25 2002 on D5DC120J"
APA> "XEmacs 21.5 (beta7) \"broccoflower\" [Lucid] (i586-pc-win32,
Mule) of Sat Jul 06 2002 on D5DC120J"
APA> (with-temp-buffer
APA> (let (case-fold-search)
APA> (message
APA> "%s"
APA> (replace-in-string
APA> "%s under 50 characters in length"
APA> "%S"
APA> "STRING"
APA> t))
APA> (sit-for 3)
APA> (message
APA> "%s"
APA> (replace-in-string
APA> "This %s, on the other hand, is well over 50 characters in
length"
APA> "%S"
APA> "STRING"
APA> t))))
APA> It does, however work correctly in
APA> "XEmacs 21.1 (patch 14) \"Cuyahoga Valley\" [Lucid]
(i386-pc-win32) of Mon May 21 2001 on D5DC120J"
APA> Who has the inside story?
APA> Best regards,
APA> Adrian
>>>> "APA" == Adrian Aichner
<adrian(a)xemacs.org> writes:
APA> It's a case-fold-search issue I haven't been able to resolve in
APA> half-an-hour.
APA> %S replacement is done, even though patcher-logmsg-commit-command
APA> %contains %s.
APA> I was able to commit my pending change using patcher.el<1.11>.
APA> case treatment in
APA> (defun replace-in-string (str regexp newtext &optional literal)
APA> is on trial.
APA> It uses re-search-forward for strings longer than 50, string-match otherwise.
APA> case treatment is undocumented for re-search-forward, depending on
APA> buffer argument for string-match.
APA> (if (> (length str) 50)
APA> (with-temp-buffer
APA> (insert str)
APA> (goto-char 1)
APA> (while (re-search-forward regexp nil t)
APA> (replace-match newtext t literal))
APA> (buffer-string))
APA> (let ((start 0) newstr)
APA> (while (string-match regexp str start)
APA> --
APA> Adrian Aichner
APA> mailto:adrian@xemacs.org
APA>
http://www.xemacs.org/
APA> --
APA> Adrian Aichner
APA> mailto:adrian@xemacs.org
APA>
http://www.xemacs.org/
--
Adrian Aichner
mailto:adrian@xemacs.org
http://www.xemacs.org/