diff options
author | Juri Linkov <juri@jurta.org> | 2012-05-29 12:09:38 +0300 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2012-05-29 12:09:38 +0300 |
commit | 8cbd80f7138bcf61518ecaab76d1b762b2510c21 (patch) | |
tree | c16f740545d0a9fcb473f7f4b3726cbd5c37f245 /lisp/isearch.el | |
parent | c846da43835e99fa53c772814aa43c9ae7ac571b (diff) | |
download | emacs-8cbd80f7138bcf61518ecaab76d1b762b2510c21.tar.gz emacs-8cbd80f7138bcf61518ecaab76d1b762b2510c21.tar.bz2 emacs-8cbd80f7138bcf61518ecaab76d1b762b2510c21.zip |
* lisp/isearch.el (isearch-search-fun-default): New function.
(isearch-search-fun): Move default part to the new function
`isearch-search-fun-default'.
(isearch-search-fun-function): Set the default value to
`isearch-search-fun-default'.
* lisp/comint.el (comint-history-isearch-end):
Use `isearch-search-fun-default'.
(comint-history-isearch-search): Use `isearch-search-fun-default'
and remove spacial case for `isearch-word'.
(comint-history-isearch-wrap): Remove spacial case for
`isearch-word'.
* lisp/hexl.el (hexl-isearch-search-function):
Use `isearch-search-fun-default'.
* lisp/info.el (Info-isearch-search): Use `isearch-search-fun-default'.
Use `word-search-regexp' for `isearch-word'.
* lisp/misearch.el (multi-isearch-search-fun):
Use `isearch-search-fun-default'.
* lisp/simple.el (minibuffer-history-isearch-search):
Use `isearch-search-fun-default' and remove spacial case for
`isearch-word'.
(minibuffer-history-isearch-wrap): Remove spacial case for
`isearch-word'.
* lisp/textmodes/reftex-global.el (reftex-isearch-wrap-function):
Remove spacial case for `isearch-word'.
(reftex-isearch-isearch-search): Use `isearch-search-fun-default'.
Fixes: debbugs:11381
Diffstat (limited to 'lisp/isearch.el')
-rw-r--r-- | lisp/isearch.el | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 7f68fb4ad32..2fcd2d53251 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -2356,8 +2356,8 @@ If there is no completion possible, say so and continue searching." ;; Searching -(defvar isearch-search-fun-function nil - "Overrides the default `isearch-search-fun' behavior. +(defvar isearch-search-fun-function 'isearch-search-fun-default + "Non-default value overrides the behavior of `isearch-search-fun-default'. This variable's value should be a function, which will be called with no arguments, and should return a function that takes three arguments: STRING, BOUND, and NOERROR. @@ -2368,22 +2368,24 @@ search for the first occurrence of STRING or its translation.") (defun isearch-search-fun () "Return the function to use for the search. Can be changed via `isearch-search-fun-function' for special needs." - (if isearch-search-fun-function - (funcall isearch-search-fun-function) - (cond - (isearch-word - ;; Use lax versions to not fail at the end of the word while - ;; the user adds and removes characters in the search string - ;; (or when using nonincremental word isearch) - (if (or isearch-nonincremental - (eq (length isearch-string) - (length (isearch-string-state (car isearch-cmds))))) - (if isearch-forward 'word-search-forward 'word-search-backward) - (if isearch-forward 'word-search-forward-lax 'word-search-backward-lax))) - (isearch-regexp - (if isearch-forward 're-search-forward 're-search-backward)) - (t - (if isearch-forward 'search-forward 'search-backward))))) + (funcall (or isearch-search-fun-function 'isearch-search-fun-default))) + +(defun isearch-search-fun-default () + "Return default functions to use for the search." + (cond + (isearch-word + ;; Use lax versions to not fail at the end of the word while + ;; the user adds and removes characters in the search string + ;; (or when using nonincremental word isearch) + (if (or isearch-nonincremental + (eq (length isearch-string) + (length (isearch-string-state (car isearch-cmds))))) + (if isearch-forward 'word-search-forward 'word-search-backward) + (if isearch-forward 'word-search-forward-lax 'word-search-backward-lax))) + (isearch-regexp + (if isearch-forward 're-search-forward 're-search-backward)) + (t + (if isearch-forward 'search-forward 'search-backward)))) (defun isearch-search-string (string bound noerror) "Search for the first occurrence of STRING or its translation. |