From: yamaoka Date: Thu, 19 Feb 2004 05:52:36 +0000 (+0000) Subject: (wl-highlight-signature-search): Don't use re-search-backward for a long X-Git-Tag: wl-2_11_25~55 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5cdfe53478e24435f9e214cbce5be7163c9792d;p=elisp%2Fwanderlust.git (wl-highlight-signature-search): Don't use re-search-backward for a long word since it is possible to crash XEmacs because of a bug. --- diff --git a/wl/ChangeLog b/wl/ChangeLog index a0d86ce..d391256 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,9 @@ +2004-02-19 Katsumi Yamaoka + + * wl-highlight.el (wl-highlight-signature-search): Don't use + re-search-backward for a long word since it is possible to crash + XEmacs because of a bug. + 2004-02-15 Tetsurou Okazaki * wl-message.el (wl-message-buffer-prefetch-p): Change `defsubst' to `defun'. diff --git a/wl/wl-highlight.el b/wl/wl-highlight.el index f03fe3b..2796e8d 100644 --- a/wl/wl-highlight.el +++ b/wl/wl-highlight.el @@ -1078,17 +1078,25 @@ Returns start point of signature." (goto-char end) (or ;; look for legal signature separator (check at first for fasten) - (re-search-backward "\n-- \n" beg t) + (search-backward "\n-- \n" beg t) ;; look for dual separator - (save-excursion - (and - (re-search-backward "^[^A-Za-z0-9> \t\n]+ *$" beg t) - (> (- (match-end 0) (match-beginning 0)) 10);; "10" is a magic number. - (re-search-backward - (concat "^" - (regexp-quote (buffer-substring (match-beginning 0) (match-end 0))) - "$") beg t))) + (let ((pt (point)) + separator) + (prog1 + (and (re-search-backward "^[^A-Za-z0-9> \t\n]+ *$" beg t) + ;; `10' is a magic number. + (> (- (match-end 0) (match-beginning 0)) 10) + (setq separator (buffer-substring (match-beginning 0) + (match-end 0))) + ;; We should not use `re-search-backward' for a long word + ;; since it is possible to crash XEmacs because of a bug. + (if (search-backward (concat "\n" separator "\n") beg t) + (1+ (point)) + (and (search-backward (concat separator "\n") beg t) + (bolp) + (point)))) + (goto-char pt))) ;; look for user specified signature-separator (if (stringp wl-highlight-signature-separator)