From: bg66 Date: Mon, 30 Mar 2009 10:53:50 +0000 (+0000) Subject: (riece-keyword-message-filter): Fix for the infinite X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=078ccecd21debb3db53e23f858ab231c52fb280e;p=elisp%2Friece.git (riece-keyword-message-filter): Fix for the infinite loop. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9dfc800..2ff65e0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2009-03-30 OHASHI Akira + + * riece-keyword.el (riece-keyword-message-filter): Fix for the infinite + loop. + 2008-10-13 OHASHI Akira * riece-mini.el (riece-mini-show-backlog): Fix for multibyte diff --git a/lisp/riece-keyword.el b/lisp/riece-keyword.el index 22acb0e..9cb568d 100644 --- a/lisp/riece-keyword.el +++ b/lisp/riece-keyword.el @@ -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)