(riece-keyword-message-filter): Fix for the infinite
authorbg66 <bg66>
Mon, 30 Mar 2009 10:53:50 +0000 (10:53 +0000)
committerbg66 <bg66>
Mon, 30 Mar 2009 10:53:50 +0000 (10:53 +0000)
loop.

lisp/ChangeLog
lisp/riece-keyword.el

index 9dfc800..2ff65e0 100644 (file)
@@ -1,3 +1,8 @@
+2009-03-30  OHASHI Akira  <bg66@koka-in.org>
+
+       * riece-keyword.el (riece-keyword-message-filter): Fix for the infinite
+       loop.
+
 2008-10-13  OHASHI Akira  <bg66@koka-in.org>
 
        * riece-mini.el (riece-mini-show-backlog): Fix for multibyte
index 22acb0e..9cb568d 100644 (file)
@@ -91,19 +91,21 @@ and the matched message object."
             index)
        (while alist
          (setq index 0)
-         (while (string-match (car (car alist))
-                              (riece-message-text message) index)
+         (while (and (< index (length (riece-message-text message)))
+                     (string-match (car (car alist))
+                                   (riece-message-text message) index))
            (put-text-property (match-beginning (cdr (car alist)))
                               (match-end (cdr (car alist)))
                               'riece-overlay-face riece-keyword-face
                               (riece-message-text message))
-           (run-hook-with-args 'riece-notify-keyword-functions
-                               (match-string (cdr (car alist))
-                                             (riece-message-text message)))
-           (run-hook-with-args 'riece-keyword-notify-functions
-                               (cdr (car alist))
-                               message)
-           (setq index (match-end (cdr (car alist)))))
+           (save-match-data
+             (run-hook-with-args 'riece-notify-keyword-functions
+                                 (match-string (cdr (car alist))
+                                               (riece-message-text message)))
+             (run-hook-with-args 'riece-keyword-notify-functions
+                                 (cdr (car alist))
+                                 message))
+           (setq index (1+ (match-end (cdr (car alist))))))
          (setq alist (cdr alist)))))
   message)