From: Stefan Monnier Date: Thu, 24 Apr 2008 17:59:51 +0000 (+0000) Subject: (isearch-search-string): Avoid string-bytes and aset. X-Git-Tag: emacs-pretest-23.0.90~6062 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4f3b3482ee9d5a61e9b7ecd68304a24db0beb579;p=emacs.git (isearch-search-string): Avoid string-bytes and aset. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c9f57f0aae3..ddb6b68e9e4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2008-04-24 Stefan Monnier + * isearch.el (isearch-search-string): Avoid string-bytes and aset. + * international/quail.el (quail-build-decode-map): Avoid string-bytes. * textmodes/ispell.el (ispell-dictionary-alist-1) diff --git a/lisp/isearch.el b/lisp/isearch.el index ef6321be02c..920b999c185 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -2137,13 +2137,15 @@ Can be changed via `isearch-search-fun-function' for special needs." pos1 pos2) (setq pos1 (save-excursion (funcall func string bound noerror))) (if (and (char-table-p translation-table-for-input) - (> (string-bytes string) len)) - (let (translated match-data) - (dotimes (i len) - (let ((x (aref translation-table-for-input (aref string i)))) - (when x - (or translated (setq translated (copy-sequence string))) - (aset translated i x)))) + (multibyte-string-p string) + ;; Minor optimization. + (string-match-p "[^[:ascii:]]" string)) + (let ((translated + (apply 'string + (mapcar (lambda (c) + (or (aref translation-table-for-input c) c)) + string))) + match-data) (when translated (save-match-data (save-excursion