emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master cfd9ef5 3/6: * lisp/isearch.el (search-default-rege


From: Artur Malabarba
Subject: [Emacs-diffs] master cfd9ef5 3/6: * lisp/isearch.el (search-default-regexp-mode): New variable
Date: Sun, 25 Oct 2015 01:16:23 +0000

branch: master
commit cfd9ef52b2adbb38d9ca84d2088a735e9e69dc40
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    * lisp/isearch.el (search-default-regexp-mode): New variable
    
    (isearch-mode): Use it.
---
 lisp/isearch.el |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 159c992..1386473 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -220,6 +220,25 @@ It is nil if none yet.")
 Default value, nil, means edit the string instead."
   :type 'boolean)
 
+(defcustom search-default-regexp-mode nil
+  "Default mode to use when starting isearch.
+Value is nil, t, or a function.
+
+If nil, default to literal searches (note that `case-fold-search'
+and `isearch-lax-whitespace' may still be applied).\\<isearch-mode-map>
+If t, default to regexp searches (as if typing `\\[isearch-toggle-regexp]' 
during
+isearch).
+
+If a function, use that function as an `isearch-regexp-function'.
+Example functions are `word-search-regexp' \(`\\[isearch-toggle-word]'),
+`isearch-symbol-regexp' \(`\\[isearch-toggle-symbol]'), and
+`character-fold-to-regexp' \(`\\[isearch-toggle-character-fold]')."
+  ;; :type is set below by `isearch-specify-regexp-function'.
+  :type '(choice (const :tag "Literal search" nil)
+                 (const :tag "Regexp search" t)
+                 (function :tag "Other"))
+  :version "25.1")
+
 ;;; isearch highlight customization.
 
 (defcustom search-highlight t
@@ -827,7 +846,6 @@ See the command `isearch-forward-symbol' for more 
information."
 
 (autoload 'character-fold-to-regexp "character-fold")
 (put 'character-fold-to-regexp 'isearch-message-prefix "char-fold ")
-(defvar character-fold-search)
 
 (defun isearch-mode (forward &optional regexp op-fun recursive-edit 
regexp-function)
   "Start Isearch minor mode.
@@ -850,11 +868,13 @@ used to set the value of `isearch-regexp-function'."
 
   ;; Initialize global vars.
   (setq isearch-forward forward
-       isearch-regexp regexp
+       isearch-regexp (or regexp
+                           (and (not regexp-function)
+                                (eq search-default-regexp-mode t)))
        isearch-regexp-function (or regexp-function
-                                    (and character-fold-search
+                                    (and (functionp search-default-regexp-mode)
                                          (not regexp)
-                                         'character-fold-to-regexp))
+                                         search-default-regexp-mode))
        isearch-op-fun op-fun
        isearch-last-case-fold-search isearch-case-fold-search
        isearch-case-fold-search case-fold-search



reply via email to

[Prev in Thread] Current Thread [Next in Thread]