/[emacs]/emacs/lisp/isearch.el
ViewVC logotype

Diff of /emacs/lisp/isearch.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.221.2.9 by miles, Thu Oct 14 08:49:58 2004 UTC revision 1.221.2.10 by miles, Wed Dec 8 05:02:12 2004 UTC
# Line 109  string, and RET terminates editing and d Line 109  string, and RET terminates editing and d
109    :type 'boolean    :type 'boolean
110    :group 'isearch)    :group 'isearch)
111    
112  (defcustom search-whitespace-regexp "\\(?:\\s-+\\)"  (defcustom search-whitespace-regexp "\\s-+"
113    "*If non-nil, regular expression to match a sequence of whitespace chars.    "*If non-nil, regular expression to match a sequence of whitespace chars.
114  This applies to regular expression incremental search.  This applies to regular expression incremental search.
115  You might want to use something like \"\\\\(?:[ \\t\\r\\n]+\\\\)\" instead.  When you put a space or spaces in the incremental regexp, it stands for
116  In the Customization buffer, that is `\\(?:[' followed by a space,  this, unless it is inside of a regexp construct such as [...] or *, + or ?.
117  a tab, a carriage return (control-M), a newline, and `]+\\)'."  You might want to use something like \"[ \\t\\r\\n]+\" instead.
118    In the Customization buffer, that is `[' followed by a space,
119    a tab, a carriage return (control-M), a newline, and `]+'."
120    :type 'regexp    :type 'regexp
121    :group 'isearch)    :group 'isearch)
122    
# Line 256  Default value, nil, means edit the strin Line 258  Default value, nil, means edit the strin
258      (define-key map "\r" 'isearch-exit)      (define-key map "\r" 'isearch-exit)
259      (define-key map "\C-j" 'isearch-printing-char)      (define-key map "\C-j" 'isearch-printing-char)
260      (define-key map "\t" 'isearch-printing-char)      (define-key map "\t" 'isearch-printing-char)
     (define-key map " " 'isearch-whitespace-chars)  
     (define-key map [?\S-\ ] 'isearch-whitespace-chars)  
261    
262      (define-key map    "\C-w" 'isearch-yank-word-or-char)      (define-key map    "\C-w" 'isearch-yank-word-or-char)
263      (define-key map "\M-\C-w" 'isearch-del-char)      (define-key map "\M-\C-w" 'isearch-del-char)
# Line 481  the calling function until the search is Line 481  the calling function until the search is
481  Do incremental search forward for regular expression.  Do incremental search forward for regular expression.
482  With a prefix argument, do a regular string search instead.  With a prefix argument, do a regular string search instead.
483  Like ordinary incremental search except that your input  Like ordinary incremental search except that your input
484  is treated as a regexp.  See \\[isearch-forward] for more info."  is treated as a regexp.  See \\[isearch-forward] for more info.
485    
486    In regexp incremental searches, a space or spaces normally matches
487    any whitespace (the variable `search-whitespace-regexp' controls
488    precisely what that means).  If you want to search for a literal space
489    and nothing else, enter `[ ]'."
490    (interactive "P\np")    (interactive "P\np")
491    (isearch-mode t (null not-regexp) nil (not no-recursive-edit)))    (isearch-mode t (null not-regexp) nil (not no-recursive-edit)))
492    
# Line 1672  Isearch mode." Line 1677  Isearch mode."
1677      ;; Assume character codes 0200 - 0377 stand for characters in some      ;; Assume character codes 0200 - 0377 stand for characters in some
1678      ;; single-byte character set, and convert them to Emacs      ;; single-byte character set, and convert them to Emacs
1679      ;; characters.      ;; characters.
1680      (and enable-multibyte-characters      (if (and isearch-regexp (= char ?\ ))
1681           (>= char ?\200)          (if (subregexp-context-p isearch-string pos)
1682           (<= char ?\377)              (isearch-process-search-string "[ ]" " ")
1683           (setq char (unibyte-char-to-multibyte char)))            (isearch-process-search-char char))
1684      (isearch-process-search-char char)))        (and enable-multibyte-characters
1685               (>= char ?\200)
1686               (<= char ?\377)
1687               (setq char (unibyte-char-to-multibyte char)))
1688          (isearch-process-search-char char))))
1689    
1690  (defun isearch-return-char ()  (defun isearch-return-char ()
1691    "Convert return into newline for incremental search.    "Convert return into newline for incremental search.
# Line 1700  Obsolete." Line 1709  Obsolete."
1709            (isearch-process-search-multibyte-characters char)            (isearch-process-search-multibyte-characters char)
1710          (isearch-process-search-char char)))))          (isearch-process-search-char char)))))
1711    
 (defun isearch-whitespace-chars ()  
   "Match all whitespace chars, if in regexp mode.  
 If you want to search for just a space, type \\<isearch-mode-map>\\[isearch-quote-char] SPC."  
   (interactive)  
   (if isearch-regexp  
       (if (and search-whitespace-regexp (not isearch-within-brackets)  
                (not isearch-invalid-regexp))  
           (isearch-process-search-string search-whitespace-regexp " ")  
         (isearch-printing-char))  
     (progn  
       ;; This way of doing word search doesn't correctly extend current search.  
       ;;      (setq isearch-word t)  
       ;;      (setq isearch-adjusted t)  
       ;;      (goto-char isearch-barrier)  
       (isearch-printing-char))))  
   
1712  (defun isearch-process-search-char (char)  (defun isearch-process-search-char (char)
1713    ;; Append the char to the search string, update the message and re-search.    ;; Append the char to the search string, update the message and re-search.
1714    (isearch-process-search-string    (isearch-process-search-string
# Line 1956  Can be changed via `isearch-search-fun-f Line 1949  Can be changed via `isearch-search-fun-f
1949        (let ((inhibit-point-motion-hooks search-invisible)        (let ((inhibit-point-motion-hooks search-invisible)
1950              (inhibit-quit nil)              (inhibit-quit nil)
1951              (case-fold-search isearch-case-fold-search)              (case-fold-search isearch-case-fold-search)
1952                (search-spaces-regexp search-whitespace-regexp)
1953              (retry t))              (retry t))
1954          (if isearch-regexp (setq isearch-invalid-regexp nil))          (if isearch-regexp (setq isearch-invalid-regexp nil))
1955          (setq isearch-within-brackets nil)          (setq isearch-within-brackets nil)
# Line 2369  search string to change or the window to Line 2363  search string to change or the window to
2363  (defun isearch-lazy-highlight-search ()  (defun isearch-lazy-highlight-search ()
2364    "Search ahead for the next or previous match, for lazy highlighting.    "Search ahead for the next or previous match, for lazy highlighting.
2365  Attempt to do the search exactly the way the pending isearch would."  Attempt to do the search exactly the way the pending isearch would."
2366    (let ((case-fold-search isearch-case-fold-search))    (let ((case-fold-search isearch-case-fold-search)
2367            (search-spaces-regexp search-whitespace-regexp))
2368      (funcall (isearch-search-fun)      (funcall (isearch-search-fun)
2369               isearch-string               isearch-string
2370               (if isearch-forward               (if isearch-forward

Legend:
Removed from v.1.221.2.9  
changed lines
  Added in v.1.221.2.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26