[Bug: 21.4.20] icalendar-import-buffer hangs

Jeff Miller jmiller at cablespeed.com
Sat Jan 20 19:12:03 EST 2007


Mark Purtill writes:
 > ================================================================
 > Dear Bug Team!
 > 
 > Using xemacs-21.4.20 and the 2006-12-21 sumos,
 > icalendar-import-buffer hangs on any input (or, at least, any imput
 > I've tried).
 > 
 > The problem is that icalendar--rris is passed arguments in the
 > order (regexp newtext string), and passes them on to
 > replace-in-string in the same order.  But replace-in-string wants
 > the order (string regexp newtext).  So any time something is being
 > replaced with "" (newtext is ""), replace-in-string thinks the
 > regexp is "" and goes into an infinite loop.
 > 
 > (BTW, fixing this eliminates the hang, but icalendar-import-buffer
 > still doesn't work; it can't find the icalendar message.)

I can confirm that this is indeed the case.  The following patch seems
to fix things.  Mark, can you test this please?

Jeff 

--- icalendar.el.orig   2007-01-20 19:06:19.000000000 -0500
+++ icalendar.el        2007-01-20 19:07:56.000000000 -0500
@@ -224,16 +224,16 @@
         (replace-match "" nil nil)))
     unfolded-buffer))
 
-(defsubst icalendar--rris (&rest args)
+(defsubst icalendar--rris (regexp newtext str &optional fixed-case literal)
   "Replace regular expression in string.
 Pass ARGS to `replace-regexp-in-string' (Emacs) or to
 `replace-in-string' (XEmacs)."
   ;; XEmacs:
   (if (fboundp 'replace-in-string)
       (save-match-data ;; apparently XEmacs needs save-match-data
-        (apply 'replace-in-string args))
+        (replace-in-string str regexp newtext literal ))
     ;; Emacs:
-    (apply 'replace-regexp-in-string args)))
+    (replace-regexp-in-string regexp newtext str args fixed-case literal)))
 
 (defun icalendar--read-element (invalue inparams)
   "Recursively read the next iCalendar element in the current buffer.



-- 
Jeff Miller
jmiller at cablespeed.com




More information about the XEmacs-Beta mailing list