(isearch-search-string): Simplify and convert docstring.
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 21 Nov 2008 05:32:07 +0000 (05:32 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 21 Nov 2008 05:32:07 +0000 (05:32 +0000)
lisp/ChangeLog
lisp/isearch.el

index d6108e0..4bec5c7 100644 (file)
@@ -1,5 +1,7 @@
 2008-11-21  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * isearch.el (isearch-search-string): Simplify and convert docstring.
+
        * buff-menu.el (Buffer-menu-short-ellipsis): Partly undo last change.
 
 2008-11-20  Juanma Barranquero  <lekktu@gmail.com>
index 75839e9..0a86834 100644 (file)
@@ -2212,41 +2212,40 @@ Can be changed via `isearch-search-fun-function' for special needs."
       (if isearch-forward 'search-forward 'search-backward)))))
 
 (defun isearch-search-string (string bound noerror)
-  ;; Search for the first occurance of STRING or its translation.  If
-  ;; found, move point to the end of the occurance, update
-  ;; isearch-match-beg and isearch-match-end, and return point.
-  (let ((func (isearch-search-fun))
-       (len (length string))
-       pos1 pos2)
-    (setq pos1 (save-excursion (funcall func string bound noerror)))
-    (if (and (char-table-p translation-table-for-input)
-             (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
-               (if (setq pos2 (funcall func translated bound noerror))
-                   (setq match-data (match-data t)))))
-           (when (and pos2
-                      (or (not pos1)
-                          (if isearch-forward (< pos2 pos1) (> pos2 pos1))))
-             (setq pos1 pos2)
-             (set-match-data match-data)))))
+  "Search for the first occurance of STRING or its translation.  If
+found, move point to the end of the occurance, update
+isearch-match-beg and isearch-match-end, and return point."
+  (let* ((func (isearch-search-fun))
+         (pos1 (save-excursion (funcall func string bound noerror)))
+         pos2)
+    (when (and (char-table-p translation-table-for-input)
+               (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
+              (if (setq pos2 (funcall func translated bound noerror))
+                  (setq match-data (match-data t)))))
+          (when (and pos2
+                     (or (not pos1)
+                         (if isearch-forward (< pos2 pos1) (> pos2 pos1))))
+            (setq pos1 pos2)
+            (set-match-data match-data)))))
     (when pos1
       ;; When using multiple buffers isearch, switch to the new buffer here,
       ;; because `save-excursion' above doesn't allow doing it inside funcall.
       (if (and multi-isearch-next-buffer-current-function
               (buffer-live-p multi-isearch-current-buffer))
          (switch-to-buffer multi-isearch-current-buffer))
-      (goto-char pos1))
-    pos1))
+      (goto-char pos1)
+      pos1)))
 
 (defun isearch-search ()
   ;; Do the search with the current search string.