comparison lisp/isearch.el @ 94330:52fb31c78b25

(isearch-search-string): Avoid string-bytes and aset.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 24 Apr 2008 17:59:51 +0000
parents 5be46d0e04dd
children ee5932bf781d
comparison
equal deleted inserted replaced
94329:22f1fdbf5cde 94330:52fb31c78b25
2135 (let ((func (isearch-search-fun)) 2135 (let ((func (isearch-search-fun))
2136 (len (length string)) 2136 (len (length string))
2137 pos1 pos2) 2137 pos1 pos2)
2138 (setq pos1 (save-excursion (funcall func string bound noerror))) 2138 (setq pos1 (save-excursion (funcall func string bound noerror)))
2139 (if (and (char-table-p translation-table-for-input) 2139 (if (and (char-table-p translation-table-for-input)
2140 (> (string-bytes string) len)) 2140 (multibyte-string-p string)
2141 (let (translated match-data) 2141 ;; Minor optimization.
2142 (dotimes (i len) 2142 (string-match-p "[^[:ascii:]]" string))
2143 (let ((x (aref translation-table-for-input (aref string i)))) 2143 (let ((translated
2144 (when x 2144 (apply 'string
2145 (or translated (setq translated (copy-sequence string))) 2145 (mapcar (lambda (c)
2146 (aset translated i x)))) 2146 (or (aref translation-table-for-input c) c))
2147 string)))
2148 match-data)
2147 (when translated 2149 (when translated
2148 (save-match-data 2150 (save-match-data
2149 (save-excursion 2151 (save-excursion
2150 (if (setq pos2 (funcall func translated bound noerror)) 2152 (if (setq pos2 (funcall func translated bound noerror))
2151 (setq match-data (match-data t))))) 2153 (setq match-data (match-data t)))))