aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2008-11-21 05:32:07 +0000
committerStefan Monnier2008-11-21 05:32:07 +0000
commit3be5da9e6f1fc2be8f5834baaeca17095a265aae (patch)
treeee24a8ed6a1e88d64e0386f04c3f557ac3bfe259
parente1ff8dd08b3de283b9122afcc152fad4e7bfb26c (diff)
downloademacs-3be5da9e6f1fc2be8f5834baaeca17095a265aae.tar.gz
emacs-3be5da9e6f1fc2be8f5834baaeca17095a265aae.zip
(isearch-search-string): Simplify and convert docstring.
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/isearch.el57
2 files changed, 30 insertions, 29 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d6108e04f28..4bec5c71a04 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
12008-11-21 Stefan Monnier <monnier@iro.umontreal.ca> 12008-11-21 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * isearch.el (isearch-search-string): Simplify and convert docstring.
4
3 * buff-menu.el (Buffer-menu-short-ellipsis): Partly undo last change. 5 * buff-menu.el (Buffer-menu-short-ellipsis): Partly undo last change.
4 6
52008-11-20 Juanma Barranquero <lekktu@gmail.com> 72008-11-20 Juanma Barranquero <lekktu@gmail.com>
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 75839e9931c..0a86834ff12 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2212,41 +2212,40 @@ Can be changed via `isearch-search-fun-function' for special needs."
2212 (if isearch-forward 'search-forward 'search-backward))))) 2212 (if isearch-forward 'search-forward 'search-backward)))))
2213 2213
2214(defun isearch-search-string (string bound noerror) 2214(defun isearch-search-string (string bound noerror)
2215 ;; Search for the first occurance of STRING or its translation. If 2215 "Search for the first occurance of STRING or its translation. If
2216 ;; found, move point to the end of the occurance, update 2216found, move point to the end of the occurance, update
2217 ;; isearch-match-beg and isearch-match-end, and return point. 2217isearch-match-beg and isearch-match-end, and return point."
2218 (let ((func (isearch-search-fun)) 2218 (let* ((func (isearch-search-fun))
2219 (len (length string)) 2219 (pos1 (save-excursion (funcall func string bound noerror)))
2220 pos1 pos2) 2220 pos2)
2221 (setq pos1 (save-excursion (funcall func string bound noerror))) 2221 (when (and (char-table-p translation-table-for-input)
2222 (if (and (char-table-p translation-table-for-input) 2222 (multibyte-string-p string)
2223 (multibyte-string-p string) 2223 ;; Minor optimization.
2224 ;; Minor optimization. 2224 (string-match-p "[^[:ascii:]]" string))
2225 (string-match-p "[^[:ascii:]]" string)) 2225 (let ((translated
2226 (let ((translated 2226 (apply 'string
2227 (apply 'string 2227 (mapcar (lambda (c)
2228 (mapcar (lambda (c) 2228 (or (aref translation-table-for-input c) c))
2229 (or (aref translation-table-for-input c) c)) 2229 string)))
2230 string))) 2230 match-data)
2231 match-data) 2231 (when translated
2232 (when translated 2232 (save-match-data
2233 (save-match-data 2233 (save-excursion
2234 (save-excursion 2234 (if (setq pos2 (funcall func translated bound noerror))
2235 (if (setq pos2 (funcall func translated bound noerror)) 2235 (setq match-data (match-data t)))))
2236 (setq match-data (match-data t))))) 2236 (when (and pos2
2237 (when (and pos2 2237 (or (not pos1)
2238 (or (not pos1) 2238 (if isearch-forward (< pos2 pos1) (> pos2 pos1))))
2239 (if isearch-forward (< pos2 pos1) (> pos2 pos1)))) 2239 (setq pos1 pos2)
2240 (setq pos1 pos2) 2240 (set-match-data match-data)))))
2241 (set-match-data match-data)))))
2242 (when pos1 2241 (when pos1
2243 ;; When using multiple buffers isearch, switch to the new buffer here, 2242 ;; When using multiple buffers isearch, switch to the new buffer here,
2244 ;; because `save-excursion' above doesn't allow doing it inside funcall. 2243 ;; because `save-excursion' above doesn't allow doing it inside funcall.
2245 (if (and multi-isearch-next-buffer-current-function 2244 (if (and multi-isearch-next-buffer-current-function
2246 (buffer-live-p multi-isearch-current-buffer)) 2245 (buffer-live-p multi-isearch-current-buffer))
2247 (switch-to-buffer multi-isearch-current-buffer)) 2246 (switch-to-buffer multi-isearch-current-buffer))
2248 (goto-char pos1)) 2247 (goto-char pos1)
2249 pos1)) 2248 pos1)))
2250 2249
2251(defun isearch-search () 2250(defun isearch-search ()
2252 ;; Do the search with the current search string. 2251 ;; Do the search with the current search string.