diff options
| author | Kenichi Handa | 2006-09-20 06:13:43 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2006-09-20 06:13:43 +0000 |
| commit | 6cf157df1ffbbd5a43db1db8f6bb4e9f84a54d1a (patch) | |
| tree | 593d5a3a05b261b8c8b71b5cb5c66744f8d6b752 | |
| parent | 0327a4644bffc9570fe50dbb7a13a54726c4ff8b (diff) | |
| download | emacs-6cf157df1ffbbd5a43db1db8f6bb4e9f84a54d1a.tar.gz emacs-6cf157df1ffbbd5a43db1db8f6bb4e9f84a54d1a.zip | |
(isearch-process-search-char): Cancel the previous
change.
(isearch-search-string): New function.
(isearch-search): Use isearch-search-string.
(isearch-lazy-highlight-search): Likewise.
| -rw-r--r-- | lisp/isearch.el | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 4dbb29d99dc..ef712b64654 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -1807,8 +1807,6 @@ Isearch mode." | |||
| 1807 | ((eq char ?|) (isearch-fallback t nil t))) | 1807 | ((eq char ?|) (isearch-fallback t nil t))) |
| 1808 | 1808 | ||
| 1809 | ;; Append the char to the search string, update the message and re-search. | 1809 | ;; Append the char to the search string, update the message and re-search. |
| 1810 | (if (char-table-p translation-table-for-input) | ||
| 1811 | (setq char (or (aref translation-table-for-input char) char))) | ||
| 1812 | (isearch-process-search-string | 1810 | (isearch-process-search-string |
| 1813 | (char-to-string char) | 1811 | (char-to-string char) |
| 1814 | (if (>= char ?\200) | 1812 | (if (>= char ?\200) |
| @@ -1993,6 +1991,36 @@ Can be changed via `isearch-search-fun-function' for special needs." | |||
| 1993 | (t | 1991 | (t |
| 1994 | (if isearch-forward 'search-forward 'search-backward))))) | 1992 | (if isearch-forward 'search-forward 'search-backward))))) |
| 1995 | 1993 | ||
| 1994 | (defun isearch-search-string (string bound noerror) | ||
| 1995 | ;; Search for the first occurance of STRING or its translation. If | ||
| 1996 | ;; found, move point to the end of the occurance, update | ||
| 1997 | ;; isearch-match-beg and isearch-match-end, and return point. | ||
| 1998 | (let ((func (isearch-search-fun)) | ||
| 1999 | (len (length string)) | ||
| 2000 | pos1 pos2) | ||
| 2001 | (setq pos1 (save-excursion (funcall func string bound noerror))) | ||
| 2002 | (if (and (char-table-p translation-table-for-input) | ||
| 2003 | (> (string-bytes string) len)) | ||
| 2004 | (let (translated match-data) | ||
| 2005 | (dotimes (i len) | ||
| 2006 | (let ((x (aref translation-table-for-input (aref string i)))) | ||
| 2007 | (when x | ||
| 2008 | (or translated (setq translated (copy-sequence string))) | ||
| 2009 | (aset translated i x)))) | ||
| 2010 | (when translated | ||
| 2011 | (save-match-data | ||
| 2012 | (save-excursion | ||
| 2013 | (if (setq pos2 (funcall func translated bound noerror)) | ||
| 2014 | (setq match-data (match-data t))))) | ||
| 2015 | (when (and pos2 | ||
| 2016 | (or (not pos1) | ||
| 2017 | (if isearch-forward (< pos2 pos1) (> pos2 pos1)))) | ||
| 2018 | (setq pos1 pos2) | ||
| 2019 | (set-match-data match-data))))) | ||
| 2020 | (if pos1 | ||
| 2021 | (goto-char pos1)) | ||
| 2022 | pos1)) | ||
| 2023 | |||
| 1996 | (defun isearch-search () | 2024 | (defun isearch-search () |
| 1997 | ;; Do the search with the current search string. | 2025 | ;; Do the search with the current search string. |
| 1998 | (isearch-message nil t) | 2026 | (isearch-message nil t) |
| @@ -2008,9 +2036,7 @@ Can be changed via `isearch-search-fun-function' for special needs." | |||
| 2008 | (setq isearch-error nil) | 2036 | (setq isearch-error nil) |
| 2009 | (while retry | 2037 | (while retry |
| 2010 | (setq isearch-success | 2038 | (setq isearch-success |
| 2011 | (funcall | 2039 | (isearch-search-string isearch-string nil t)) |
| 2012 | (isearch-search-fun) | ||
| 2013 | isearch-string nil t)) | ||
| 2014 | ;; Clear RETRY unless we matched some invisible text | 2040 | ;; Clear RETRY unless we matched some invisible text |
| 2015 | ;; and we aren't supposed to do that. | 2041 | ;; and we aren't supposed to do that. |
| 2016 | (if (or (eq search-invisible t) | 2042 | (if (or (eq search-invisible t) |
| @@ -2353,7 +2379,7 @@ Attempt to do the search exactly the way the pending isearch would." | |||
| 2353 | (isearch-regexp isearch-lazy-highlight-regexp) | 2379 | (isearch-regexp isearch-lazy-highlight-regexp) |
| 2354 | (search-spaces-regexp search-whitespace-regexp)) | 2380 | (search-spaces-regexp search-whitespace-regexp)) |
| 2355 | (condition-case nil | 2381 | (condition-case nil |
| 2356 | (funcall (isearch-search-fun) | 2382 | (isearch-search-string |
| 2357 | isearch-lazy-highlight-last-string | 2383 | isearch-lazy-highlight-last-string |
| 2358 | (if isearch-forward | 2384 | (if isearch-forward |
| 2359 | (min (or isearch-lazy-highlight-end-limit (point-max)) | 2385 | (min (or isearch-lazy-highlight-end-limit (point-max)) |