X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fsubr.el;h=9adf57e5bd7a05c3c3b08f1cc0050e187632a087;hb=b8893d79a7c7c1870ac9263eef28461223346fe3;hp=6a49cff64abe5980037cfd3d43aa4fa96abf3fe0;hpb=c1191056c64c77073f1a3bdae1d6ca4eb4a08627;p=chise%2Fxemacs-chise.git diff --git a/lisp/subr.el b/lisp/subr.el index 6a49cff..9adf57e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -294,10 +294,14 @@ Otherwise treat \\ in NEWTEXT string as special: If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (or pattern (setq pattern "[ \f\t\n\r\v]+")) - ;; The FSF version of this function takes care not to cons in case - ;; of infloop. Maybe we should synch? - (let (parts (start 0)) - (while (string-match pattern string start) + (let (parts (start 0) (len (length string))) + (if (string-match pattern string) + (setq parts (cons (substring string 0 (match-beginning 0)) parts) + start (match-end 0))) + (while (and (< start len) + (string-match pattern string (if (> start (match-beginning 0)) + start + (1+ start)))) (setq parts (cons (substring string start (match-beginning 0)) parts) start (match-end 0))) (nreverse (cons (substring string start) parts))))