* 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
This commit is contained in:
Juri Linkov 2012-05-29 12:09:38 +03:00
parent c846da4383
commit 8cbd80f713
8 changed files with 187 additions and 187 deletions

View file

@ -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.