Mercurial > emacs
changeset 99756:abaa7407abf7
(isearch-search-string): Simplify and convert docstring.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 21 Nov 2008 05:32:07 +0000 |
parents | 8474e0f67804 |
children | 270d85d8daeb |
files | lisp/ChangeLog lisp/isearch.el |
diffstat | 2 files changed, 30 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Fri Nov 21 05:19:40 2008 +0000 +++ b/lisp/ChangeLog Fri Nov 21 05:32:07 2008 +0000 @@ -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>
--- a/lisp/isearch.el Fri Nov 21 05:19:40 2008 +0000 +++ b/lisp/isearch.el Fri Nov 21 05:32:07 2008 +0000 @@ -2212,41 +2212,40 @@ (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.