changeset 97129:f48704406cca

(isearch-mode-map): Bind `M-s r' to `isearch-toggle-regexp' and `M-s w' to `isearch-toggle-word'. (search-map): Bind `M-s w' to `isearch-forward-word' globally in the global map `search-map'. (isearch-forward): Doc fix. (isearch-forward-word, isearch-toggle-case-fold): New commands.
author Juri Linkov <juri@jurta.org>
date Wed, 30 Jul 2008 16:40:23 +0000
parents 716070916653
children afe461418852
files lisp/isearch.el
diffstat 1 files changed, 31 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/isearch.el	Wed Jul 30 16:38:29 2008 +0000
+++ b/lisp/isearch.el	Wed Jul 30 16:40:23 2008 +0000
@@ -491,6 +491,9 @@
     (define-key map "\M-r" 'isearch-toggle-regexp)
     (define-key map "\M-e" 'isearch-edit-string)
 
+    (define-key map "\M-sr" 'isearch-toggle-regexp)
+    (define-key map "\M-sw" 'isearch-toggle-word)
+
     (define-key map [?\M-%] 'isearch-query-replace)
     (define-key map [?\C-\M-%] 'isearch-query-replace-regexp)
     (define-key map "\M-so" 'isearch-occur)
@@ -596,6 +599,7 @@
 (define-key esc-map "\C-s" 'isearch-forward-regexp)
 (define-key global-map "\C-r" 'isearch-backward)
 (define-key esc-map "\C-r" 'isearch-backward-regexp)
+(define-key search-map "w" 'isearch-forward-word)
 
 ;; Entry points to isearch-mode.
 
@@ -630,13 +634,9 @@
 If you try to exit with the search string still empty, it invokes
  nonincremental search.
 
-Type \\[isearch-query-replace] to start `query-replace' with string to\
- replace from last search string.
-Type \\[isearch-query-replace-regexp] to start `query-replace-regexp'\
- with string to replace from last search string.
-
 Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity.
 Type \\[isearch-toggle-regexp] to toggle regular-expression mode.
+Type \\[isearch-toggle-word] to toggle word mode.
 Type \\[isearch-edit-string] to edit the search string in the minibuffer.
 
 Also supported is a search ring of the previous 16 search strings.
@@ -645,6 +645,15 @@
  ring.
 Type \\[isearch-complete] to complete the search string using the search ring.
 
+Type \\[isearch-query-replace] to run `query-replace' with string to\
+ replace from last search string.
+Type \\[isearch-query-replace-regexp] to run `query-replace-regexp'\
+ with the last search string.
+Type \\[isearch-occur] to run `occur' that shows\
+ the last search string.
+Type \\[isearch-highlight-regexp] to run `highlight-regexp'\
+ that highlights the last search string.
+
 Type \\[isearch-describe-bindings] to display all isearch key bindings.
 Type \\[isearch-describe-key] to display documentation of isearch key.
 Type \\[isearch-describe-mode] to display documentation of isearch mode.
@@ -684,6 +693,16 @@
   (interactive "P\np")
   (isearch-mode t (null not-regexp) nil (not no-recursive-edit)))
 
+(defun isearch-forward-word (&optional not-word no-recursive-edit)
+  "\
+Do incremental search forward for a sequence of words.
+With a prefix argument, do a regular string search instead.
+Like ordinary incremental search except that your input
+is treated as a sequence of words without regard to how the
+words are separated.  See \\[isearch-forward] for more info."
+  (interactive "P\np")
+  (isearch-mode t nil nil (not no-recursive-edit) (null not-word)))
+
 (defun isearch-backward (&optional regexp-p no-recursive-edit)
   "\
 Do incremental search backward.
@@ -1303,6 +1322,13 @@
   (setq isearch-success t isearch-adjusted t)
   (isearch-update))
 
+(defun isearch-toggle-word ()
+  "Toggle word searching on or off."
+  (interactive)
+  (setq isearch-word (not isearch-word))
+  (setq isearch-success t isearch-adjusted t)
+  (isearch-update))
+
 (defun isearch-toggle-case-fold ()
   "Toggle case folding in searching on or off."
   (interactive)