diff options
| author | Artur Malabarba | 2015-10-25 00:42:29 +0100 |
|---|---|---|
| committer | Artur Malabarba | 2015-10-25 01:11:21 +0000 |
| commit | cfd9ef52b2adbb38d9ca84d2088a735e9e69dc40 (patch) | |
| tree | 0e1365d784fa09456f9c4a5145a490a0f525d86a | |
| parent | fa647ecdf293c77b65cbf357d9e8c036185d43ed (diff) | |
| download | emacs-cfd9ef52b2adbb38d9ca84d2088a735e9e69dc40.tar.gz emacs-cfd9ef52b2adbb38d9ca84d2088a735e9e69dc40.zip | |
* lisp/isearch.el (search-default-regexp-mode): New variable
(isearch-mode): Use it.
| -rw-r--r-- | lisp/isearch.el | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 159c9925ba3..13864733804 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -220,6 +220,25 @@ It is nil if none yet.") | |||
| 220 | Default value, nil, means edit the string instead." | 220 | Default value, nil, means edit the string instead." |
| 221 | :type 'boolean) | 221 | :type 'boolean) |
| 222 | 222 | ||
| 223 | (defcustom search-default-regexp-mode nil | ||
| 224 | "Default mode to use when starting isearch. | ||
| 225 | Value is nil, t, or a function. | ||
| 226 | |||
| 227 | If nil, default to literal searches (note that `case-fold-search' | ||
| 228 | and `isearch-lax-whitespace' may still be applied).\\<isearch-mode-map> | ||
| 229 | If t, default to regexp searches (as if typing `\\[isearch-toggle-regexp]' during | ||
| 230 | isearch). | ||
| 231 | |||
| 232 | If a function, use that function as an `isearch-regexp-function'. | ||
| 233 | Example functions are `word-search-regexp' \(`\\[isearch-toggle-word]'), | ||
| 234 | `isearch-symbol-regexp' \(`\\[isearch-toggle-symbol]'), and | ||
| 235 | `character-fold-to-regexp' \(`\\[isearch-toggle-character-fold]')." | ||
| 236 | ;; :type is set below by `isearch-specify-regexp-function'. | ||
| 237 | :type '(choice (const :tag "Literal search" nil) | ||
| 238 | (const :tag "Regexp search" t) | ||
| 239 | (function :tag "Other")) | ||
| 240 | :version "25.1") | ||
| 241 | |||
| 223 | ;;; isearch highlight customization. | 242 | ;;; isearch highlight customization. |
| 224 | 243 | ||
| 225 | (defcustom search-highlight t | 244 | (defcustom search-highlight t |
| @@ -827,7 +846,6 @@ See the command `isearch-forward-symbol' for more information." | |||
| 827 | 846 | ||
| 828 | (autoload 'character-fold-to-regexp "character-fold") | 847 | (autoload 'character-fold-to-regexp "character-fold") |
| 829 | (put 'character-fold-to-regexp 'isearch-message-prefix "char-fold ") | 848 | (put 'character-fold-to-regexp 'isearch-message-prefix "char-fold ") |
| 830 | (defvar character-fold-search) | ||
| 831 | 849 | ||
| 832 | (defun isearch-mode (forward &optional regexp op-fun recursive-edit regexp-function) | 850 | (defun isearch-mode (forward &optional regexp op-fun recursive-edit regexp-function) |
| 833 | "Start Isearch minor mode. | 851 | "Start Isearch minor mode. |
| @@ -850,11 +868,13 @@ used to set the value of `isearch-regexp-function'." | |||
| 850 | 868 | ||
| 851 | ;; Initialize global vars. | 869 | ;; Initialize global vars. |
| 852 | (setq isearch-forward forward | 870 | (setq isearch-forward forward |
| 853 | isearch-regexp regexp | 871 | isearch-regexp (or regexp |
| 872 | (and (not regexp-function) | ||
| 873 | (eq search-default-regexp-mode t))) | ||
| 854 | isearch-regexp-function (or regexp-function | 874 | isearch-regexp-function (or regexp-function |
| 855 | (and character-fold-search | 875 | (and (functionp search-default-regexp-mode) |
| 856 | (not regexp) | 876 | (not regexp) |
| 857 | 'character-fold-to-regexp)) | 877 | search-default-regexp-mode)) |
| 858 | isearch-op-fun op-fun | 878 | isearch-op-fun op-fun |
| 859 | isearch-last-case-fold-search isearch-case-fold-search | 879 | isearch-last-case-fold-search isearch-case-fold-search |
| 860 | isearch-case-fold-search case-fold-search | 880 | isearch-case-fold-search case-fold-search |