diff options
| author | Juri Linkov | 2012-09-02 12:31:45 +0300 |
|---|---|---|
| committer | Juri Linkov | 2012-09-02 12:31:45 +0300 |
| commit | 63dd1c6fa45357d312e1d3076e15adacf5ed6291 (patch) | |
| tree | 8b2356ec3edd5498f0311417b50b14f5afb74b89 | |
| parent | a08d4ba773a70961d153bf213db68dfcc5a50b01 (diff) | |
| download | emacs-63dd1c6fa45357d312e1d3076e15adacf5ed6291.tar.gz emacs-63dd1c6fa45357d312e1d3076e15adacf5ed6291.zip | |
Toggle whitespace matching mode with M-s SPC.
http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00008.html
* lisp/isearch.el (search-whitespace-regexp): Doc fix.
Remove cons cell customization.
(isearch-mode-map): Bind "\M-s " to isearch-toggle-lax-whitespace.
(isearch-lax-whitespace, isearch-regexp-lax-whitespace):
New variables.
(isearch-forward, isearch-forward-regexp): Doc fix.
(isearch-toggle-lax-whitespace): New command.
(search-forward-lax-whitespace, search-backward-lax-whitespace)
(re-search-forward-lax-whitespace)
(re-search-backward-lax-whitespace): New functions.
(isearch-whitespace-regexp): Remove function.
(isearch-query-replace): Let-bind replace-search-function and
replace-re-search-function.
(isearch-occur): Let-bind search-spaces-regexp according to the
value of isearch-lax-whitespace and isearch-regexp-lax-whitespace.
(isearch-quote-char): Check isearch-regexp-lax-whitespace in the
condition for C-q SPC.
(isearch-search-fun-default): Use new functions mentioned above.
(isearch-search-forward, isearch-search-backward): Remove functions.
(isearch-search): Don't let-bind search-spaces-regexp.
(isearch-lazy-highlight-space-regexp): Remove variable.
(isearch-lazy-highlight-lax-whitespace)
(isearch-lazy-highlight-regexp-lax-whitespace): New variables.
(isearch-lazy-highlight-new-loop): Use them.
(isearch-lazy-highlight-search): Don't let-bind search-spaces-regexp.
| -rw-r--r-- | etc/NEWS | 14 | ||||
| -rw-r--r-- | lisp/ChangeLog | 31 | ||||
| -rw-r--r-- | lisp/isearch.el | 149 |
3 files changed, 147 insertions, 47 deletions
| @@ -183,12 +183,14 @@ end of the buffer. It defaults to t. | |||
| 183 | and `M-s _' in Isearch toggles symbol search mode. | 183 | and `M-s _' in Isearch toggles symbol search mode. |
| 184 | `M-s c' in Isearch toggles search case-sensitivity. | 184 | `M-s c' in Isearch toggles search case-sensitivity. |
| 185 | 185 | ||
| 186 | *** `search-whitespace-regexp' now acts on ordinary incremental search | 186 | *** `M-s SPC' in Isearch toggles whitespace matching mode |
| 187 | as well, so that each sequence of spaces in the search string matches | 187 | in both ordinary and regexp incremental search, so that each |
| 188 | any combination of one or more whitespace characters. To change this | 188 | sequence of spaces in the search string matches any combination |
| 189 | behavior, you can give `search-whitespace-regexp' a cons cell value, | 189 | of one or more whitespace characters defined by the variable |
| 190 | where the car and cdr specify values for ordinary and regular | 190 | `search-whitespace-regexp'. In ordinary incremental search, |
| 191 | expression incremental search respectively. | 191 | `isearch-toggle-lax-whitespace' toggles the value of the variable |
| 192 | `isearch-lax-whitespace'. In regexp incremental search, it toggles | ||
| 193 | the value of the variable `isearch-regexp-lax-whitespace'. | ||
| 192 | 194 | ||
| 193 | ** M-x move-to-column, if called interactively with no prefix arg, now | 195 | ** M-x move-to-column, if called interactively with no prefix arg, now |
| 194 | prompts for a column number. | 196 | prompts for a column number. |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d018e455357..b56672ac84f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,34 @@ | |||
| 1 | 2012-09-02 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | Toggle whitespace matching mode with M-s SPC. | ||
| 4 | http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00008.html | ||
| 5 | |||
| 6 | * isearch.el (search-whitespace-regexp): Doc fix. | ||
| 7 | Remove cons cell customization. | ||
| 8 | (isearch-mode-map): Bind "\M-s " to isearch-toggle-lax-whitespace. | ||
| 9 | (isearch-lax-whitespace, isearch-regexp-lax-whitespace): | ||
| 10 | New variables. | ||
| 11 | (isearch-forward, isearch-forward-regexp): Doc fix. | ||
| 12 | (isearch-toggle-lax-whitespace): New command. | ||
| 13 | (search-forward-lax-whitespace, search-backward-lax-whitespace) | ||
| 14 | (re-search-forward-lax-whitespace) | ||
| 15 | (re-search-backward-lax-whitespace): New functions. | ||
| 16 | (isearch-whitespace-regexp): Remove function. | ||
| 17 | (isearch-query-replace): Let-bind replace-search-function and | ||
| 18 | replace-re-search-function. | ||
| 19 | (isearch-occur): Let-bind search-spaces-regexp according to the | ||
| 20 | value of isearch-lax-whitespace and isearch-regexp-lax-whitespace. | ||
| 21 | (isearch-quote-char): Check isearch-regexp-lax-whitespace in the | ||
| 22 | condition for C-q SPC. | ||
| 23 | (isearch-search-fun-default): Use new functions mentioned above. | ||
| 24 | (isearch-search-forward, isearch-search-backward): Remove functions. | ||
| 25 | (isearch-search): Don't let-bind search-spaces-regexp. | ||
| 26 | (isearch-lazy-highlight-space-regexp): Remove variable. | ||
| 27 | (isearch-lazy-highlight-lax-whitespace) | ||
| 28 | (isearch-lazy-highlight-regexp-lax-whitespace): New variables. | ||
| 29 | (isearch-lazy-highlight-new-loop): Use them. | ||
| 30 | (isearch-lazy-highlight-search): Don't let-bind search-spaces-regexp. | ||
| 31 | |||
| 1 | 2012-09-02 Chong Yidong <cyd@gnu.org> | 32 | 2012-09-02 Chong Yidong <cyd@gnu.org> |
| 2 | 33 | ||
| 3 | * dired.el (dired-mode-map): Menu string fixes (Bug#11616). | 34 | * dired.el (dired-mode-map): Menu string fixes (Bug#11616). |
diff --git a/lisp/isearch.el b/lisp/isearch.el index 6ea8d86336a..e6e0a01566a 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -116,24 +116,16 @@ will match any sequence matched by this regexp. As an exception, | |||
| 116 | spaces are treated normally in regexp incremental search if they | 116 | spaces are treated normally in regexp incremental search if they |
| 117 | occur in a regexp construct like [...] or *, + or ?. | 117 | occur in a regexp construct like [...] or *, + or ?. |
| 118 | 118 | ||
| 119 | If the value is a string, it applies to both ordinary and regexp | 119 | If the value is a string, it applies to both ordinary and |
| 120 | incremental search. If the value is nil, each space you type | 120 | regexp incremental search. If the value is nil, or |
| 121 | matches literally, against one space. | 121 | `isearch-lax-whitespace' is nil for ordinary incremental search, or |
| 122 | 122 | `isearch-regexp-lax-whitespace' is nil for regexp incremental search, | |
| 123 | The value can also be a cons cell (REGEXP-1 . REGEXP-2). In that | 123 | then each space you type matches literally, against one space. |
| 124 | case, REGEXP-1 is used as the value for ordinary incremental | ||
| 125 | search, and REGEXP-2 is used for regexp incremental search. | ||
| 126 | 124 | ||
| 127 | You might want to use something like \"[ \\t\\r\\n]+\" instead. | 125 | You might want to use something like \"[ \\t\\r\\n]+\" instead. |
| 128 | In the Customization buffer, that is `[' followed by a space, | 126 | In the Customization buffer, that is `[' followed by a space, |
| 129 | a tab, a carriage return (control-M), a newline, and `]+'." | 127 | a tab, a carriage return (control-M), a newline, and `]+'." |
| 130 | :type '(choice (const :tag "Treat Spaces Literally" nil) | 128 | :type '(choice (const :tag "Match Spaces Literally" nil) |
| 131 | (cons (choice :tag "For Ordinary Isearch" | ||
| 132 | regexp | ||
| 133 | (const :tag "Treat Spaces Literally" nil)) | ||
| 134 | (choice :tag "For Regexp Isearch" | ||
| 135 | regexp | ||
| 136 | (const :tag "Treat Spaces Literally" nil))) | ||
| 137 | regexp) | 129 | regexp) |
| 138 | :group 'isearch | 130 | :group 'isearch |
| 139 | :version "24.3") | 131 | :version "24.3") |
| @@ -514,6 +506,7 @@ This is like `describe-bindings', but displays only Isearch keys." | |||
| 514 | (define-key map "\M-sr" 'isearch-toggle-regexp) | 506 | (define-key map "\M-sr" 'isearch-toggle-regexp) |
| 515 | (define-key map "\M-sw" 'isearch-toggle-word) | 507 | (define-key map "\M-sw" 'isearch-toggle-word) |
| 516 | (define-key map "\M-s_" 'isearch-toggle-symbol) | 508 | (define-key map "\M-s_" 'isearch-toggle-symbol) |
| 509 | (define-key map "\M-s " 'isearch-toggle-lax-whitespace) | ||
| 517 | 510 | ||
| 518 | (define-key map [?\M-%] 'isearch-query-replace) | 511 | (define-key map [?\M-%] 'isearch-query-replace) |
| 519 | (define-key map [?\C-\M-%] 'isearch-query-replace-regexp) | 512 | (define-key map [?\C-\M-%] 'isearch-query-replace-regexp) |
| @@ -556,6 +549,22 @@ convert the search string to a regexp used by regexp search functions. | |||
| 556 | The property `isearch-message-prefix' put on this function specifies the | 549 | The property `isearch-message-prefix' put on this function specifies the |
| 557 | prefix string displayed in the search message.") | 550 | prefix string displayed in the search message.") |
| 558 | 551 | ||
| 552 | (defvar isearch-lax-whitespace t | ||
| 553 | "If non-nil, a space will match a sequence of whitespace chars. | ||
| 554 | When you enter a space or spaces in ordinary incremental search, it | ||
| 555 | will match any sequence matched by the regexp defined by the variable | ||
| 556 | `search-whitespace-regexp'. If the value is nil, each space you type | ||
| 557 | matches literally, against one space. You can toggle the value of this | ||
| 558 | variable by the command `isearch-toggle-lax-whitespace'.") | ||
| 559 | |||
| 560 | (defvar isearch-regexp-lax-whitespace nil | ||
| 561 | "If non-nil, a space will match a sequence of whitespace chars. | ||
| 562 | When you enter a space or spaces in regexp incremental search, it | ||
| 563 | will match any sequence matched by the regexp defined by the variable | ||
| 564 | `search-whitespace-regexp'. If the value is nil, each space you type | ||
| 565 | matches literally, against one space. You can toggle the value of this | ||
| 566 | variable by the command `isearch-toggle-lax-whitespace'.") | ||
| 567 | |||
| 559 | (defvar isearch-cmds nil | 568 | (defvar isearch-cmds nil |
| 560 | "Stack of search status sets. | 569 | "Stack of search status sets. |
| 561 | Each set is a vector of the form: | 570 | Each set is a vector of the form: |
| @@ -681,6 +690,12 @@ Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity. | |||
| 681 | Type \\[isearch-toggle-regexp] to toggle regular-expression mode. | 690 | Type \\[isearch-toggle-regexp] to toggle regular-expression mode. |
| 682 | Type \\[isearch-toggle-word] to toggle word mode. | 691 | Type \\[isearch-toggle-word] to toggle word mode. |
| 683 | Type \\[isearch-toggle-symbol] to toggle symbol mode. | 692 | Type \\[isearch-toggle-symbol] to toggle symbol mode. |
| 693 | |||
| 694 | Type \\[isearch-toggle-lax-whitespace] to toggle whitespace matching. | ||
| 695 | In incremental searches, a space or spaces normally matches any whitespace | ||
| 696 | defined by the variable `search-whitespace-regexp'; see also the variables | ||
| 697 | `isearch-lax-whitespace' and `isearch-regexp-lax-whitespace'. | ||
| 698 | |||
| 684 | Type \\[isearch-edit-string] to edit the search string in the minibuffer. | 699 | Type \\[isearch-edit-string] to edit the search string in the minibuffer. |
| 685 | 700 | ||
| 686 | Also supported is a search ring of the previous 16 search strings. | 701 | Also supported is a search ring of the previous 16 search strings. |
| @@ -702,9 +717,6 @@ Type \\[isearch-describe-bindings] to display all Isearch key bindings. | |||
| 702 | Type \\[isearch-describe-key] to display documentation of Isearch key. | 717 | Type \\[isearch-describe-key] to display documentation of Isearch key. |
| 703 | Type \\[isearch-describe-mode] to display documentation of Isearch mode. | 718 | Type \\[isearch-describe-mode] to display documentation of Isearch mode. |
| 704 | 719 | ||
| 705 | In incremental searches, a space or spaces normally matches any | ||
| 706 | whitespace; see the variable `search-whitespace-regexp'. | ||
| 707 | |||
| 708 | If an input method is turned on in the current buffer, that input | 720 | If an input method is turned on in the current buffer, that input |
| 709 | method is also active while you are typing characters to search. | 721 | method is also active while you are typing characters to search. |
| 710 | To toggle the input method, type \\[isearch-toggle-input-method]. \ | 722 | To toggle the input method, type \\[isearch-toggle-input-method]. \ |
| @@ -734,8 +746,9 @@ Like ordinary incremental search except that your input is treated | |||
| 734 | as a regexp. See the command `isearch-forward' for more information. | 746 | as a regexp. See the command `isearch-forward' for more information. |
| 735 | 747 | ||
| 736 | In incremental searches, a space or spaces normally matches any | 748 | In incremental searches, a space or spaces normally matches any |
| 737 | whitespace; see the variable `search-whitespace-regexp'. To | 749 | whitespace defined by the variable `search-whitespace-regexp'. |
| 738 | search for a literal space and nothing else, enter C-q SPC." | 750 | To search for a literal space and nothing else, enter C-q SPC. |
| 751 | To toggle whitespace matching, use `isearch-toggle-lax-whitespace'." | ||
| 739 | (interactive "P\np") | 752 | (interactive "P\np") |
| 740 | (isearch-mode t (null not-regexp) nil (not no-recursive-edit))) | 753 | (isearch-mode t (null not-regexp) nil (not no-recursive-edit))) |
| 741 | 754 | ||
| @@ -1395,6 +1408,28 @@ Use `isearch-exit' to quit without signaling." | |||
| 1395 | (setq isearch-success t isearch-adjusted t) | 1408 | (setq isearch-success t isearch-adjusted t) |
| 1396 | (isearch-update)) | 1409 | (isearch-update)) |
| 1397 | 1410 | ||
| 1411 | (defun isearch-toggle-lax-whitespace () | ||
| 1412 | "Toggle whitespace matching in searching on or off. | ||
| 1413 | In ordinary search, toggles the value of the variable | ||
| 1414 | `isearch-lax-whitespace'. In regexp search, toggles the | ||
| 1415 | value of the variable `isearch-regexp-lax-whitespace'." | ||
| 1416 | (interactive) | ||
| 1417 | (if isearch-regexp | ||
| 1418 | (setq isearch-regexp-lax-whitespace (not isearch-regexp-lax-whitespace)) | ||
| 1419 | (setq isearch-lax-whitespace (not isearch-lax-whitespace))) | ||
| 1420 | (let ((message-log-max nil)) | ||
| 1421 | (message "%s%s [%s]" | ||
| 1422 | (isearch-message-prefix nil isearch-nonincremental) | ||
| 1423 | isearch-message | ||
| 1424 | (if (if isearch-regexp | ||
| 1425 | isearch-regexp-lax-whitespace | ||
| 1426 | isearch-lax-whitespace) | ||
| 1427 | "match spaces loosely" | ||
| 1428 | "match spaces literally"))) | ||
| 1429 | (setq isearch-success t isearch-adjusted t) | ||
| 1430 | (sit-for 1) | ||
| 1431 | (isearch-update)) | ||
| 1432 | |||
| 1398 | (defun isearch-toggle-case-fold () | 1433 | (defun isearch-toggle-case-fold () |
| 1399 | "Toggle case folding in searching on or off." | 1434 | "Toggle case folding in searching on or off." |
| 1400 | (interactive) | 1435 | (interactive) |
| @@ -1506,6 +1541,28 @@ If LAX is non-nil, the end of the string need not match a symbol boundary." | |||
| 1506 | 1541 | ||
| 1507 | (put 'isearch-symbol-regexp 'isearch-message-prefix "symbol ") | 1542 | (put 'isearch-symbol-regexp 'isearch-message-prefix "symbol ") |
| 1508 | 1543 | ||
| 1544 | ;; Search with lax whitespace | ||
| 1545 | |||
| 1546 | (defun search-forward-lax-whitespace (string &optional bound noerror count) | ||
| 1547 | "Search forward for STRING, matching a sequence of whitespace chars." | ||
| 1548 | (let ((search-spaces-regexp search-whitespace-regexp)) | ||
| 1549 | (re-search-forward (regexp-quote string) bound noerror count))) | ||
| 1550 | |||
| 1551 | (defun search-backward-lax-whitespace (string &optional bound noerror count) | ||
| 1552 | "Search backward for STRING, matching a sequence of whitespace chars." | ||
| 1553 | (let ((search-spaces-regexp search-whitespace-regexp)) | ||
| 1554 | (re-search-backward (regexp-quote string) bound noerror count))) | ||
| 1555 | |||
| 1556 | (defun re-search-forward-lax-whitespace (regexp &optional bound noerror count) | ||
| 1557 | "Search forward for REGEXP, matching a sequence of whitespace chars." | ||
| 1558 | (let ((search-spaces-regexp search-whitespace-regexp)) | ||
| 1559 | (re-search-forward regexp bound noerror count))) | ||
| 1560 | |||
| 1561 | (defun re-search-backward-lax-whitespace (regexp &optional bound noerror count) | ||
| 1562 | "Search backward for REGEXP, matching a sequence of whitespace chars." | ||
| 1563 | (let ((search-spaces-regexp search-whitespace-regexp)) | ||
| 1564 | (re-search-backward regexp bound noerror count))) | ||
| 1565 | |||
| 1509 | 1566 | ||
| 1510 | (defun isearch-query-replace (&optional delimited regexp-flag) | 1567 | (defun isearch-query-replace (&optional delimited regexp-flag) |
| 1511 | "Start `query-replace' with string to replace from last search string. | 1568 | "Start `query-replace' with string to replace from last search string. |
| @@ -1522,6 +1579,14 @@ way to run word replacements from Isearch is `M-s w ... M-%'." | |||
| 1522 | ;; set `search-upper-case' to nil to not call | 1579 | ;; set `search-upper-case' to nil to not call |
| 1523 | ;; `isearch-no-upper-case-p' in `perform-replace' | 1580 | ;; `isearch-no-upper-case-p' in `perform-replace' |
| 1524 | (search-upper-case nil) | 1581 | (search-upper-case nil) |
| 1582 | (replace-search-function | ||
| 1583 | (if (and isearch-lax-whitespace (not regexp-flag)) | ||
| 1584 | #'search-forward-lax-whitespace | ||
| 1585 | replace-search-function)) | ||
| 1586 | (replace-re-search-function | ||
| 1587 | (if (and isearch-regexp-lax-whitespace regexp-flag) | ||
| 1588 | #'re-search-forward-lax-whitespace | ||
| 1589 | replace-re-search-function)) | ||
| 1525 | ;; Set `isearch-recursive-edit' to nil to prevent calling | 1590 | ;; Set `isearch-recursive-edit' to nil to prevent calling |
| 1526 | ;; `exit-recursive-edit' in `isearch-done' that terminates | 1591 | ;; `exit-recursive-edit' in `isearch-done' that terminates |
| 1527 | ;; the execution of this command when it is non-nil. | 1592 | ;; the execution of this command when it is non-nil. |
| @@ -1558,15 +1623,6 @@ See `isearch-query-replace' for more information." | |||
| 1558 | (list current-prefix-arg)) | 1623 | (list current-prefix-arg)) |
| 1559 | (isearch-query-replace delimited t)) | 1624 | (isearch-query-replace delimited t)) |
| 1560 | 1625 | ||
| 1561 | (defun isearch-whitespace-regexp () | ||
| 1562 | "Return the value of `search-whitespace-regexp' for the current search." | ||
| 1563 | (cond ((not (consp search-whitespace-regexp)) | ||
| 1564 | search-whitespace-regexp) | ||
| 1565 | (isearch-regexp | ||
| 1566 | (cdr search-whitespace-regexp)) | ||
| 1567 | (t | ||
| 1568 | (car search-whitespace-regexp)))) | ||
| 1569 | |||
| 1570 | (defun isearch-occur (regexp &optional nlines) | 1626 | (defun isearch-occur (regexp &optional nlines) |
| 1571 | "Run `occur' using the last search string as the regexp. | 1627 | "Run `occur' using the last search string as the regexp. |
| 1572 | Interactively, REGEXP is constructed using the search string from the | 1628 | Interactively, REGEXP is constructed using the search string from the |
| @@ -1606,7 +1662,11 @@ characters in that string." | |||
| 1606 | ;; Set `search-upper-case' to nil to not call | 1662 | ;; Set `search-upper-case' to nil to not call |
| 1607 | ;; `isearch-no-upper-case-p' in `occur-1'. | 1663 | ;; `isearch-no-upper-case-p' in `occur-1'. |
| 1608 | (search-upper-case nil) | 1664 | (search-upper-case nil) |
| 1609 | (search-spaces-regexp (isearch-whitespace-regexp))) | 1665 | (search-spaces-regexp |
| 1666 | (if (if isearch-regexp | ||
| 1667 | isearch-regexp-lax-whitespace | ||
| 1668 | isearch-lax-whitespace) | ||
| 1669 | search-whitespace-regexp))) | ||
| 1610 | (occur regexp nlines))) | 1670 | (occur regexp nlines))) |
| 1611 | 1671 | ||
| 1612 | (declare-function hi-lock-read-face-name "hi-lock" ()) | 1672 | (declare-function hi-lock-read-face-name "hi-lock" ()) |
| @@ -2203,7 +2263,7 @@ Isearch mode." | |||
| 2203 | ;; Assume character codes 0200 - 0377 stand for characters in some | 2263 | ;; Assume character codes 0200 - 0377 stand for characters in some |
| 2204 | ;; single-byte character set, and convert them to Emacs | 2264 | ;; single-byte character set, and convert them to Emacs |
| 2205 | ;; characters. | 2265 | ;; characters. |
| 2206 | (if (and isearch-regexp (= char ?\s)) | 2266 | (if (and isearch-regexp isearch-regexp-lax-whitespace (= char ?\s)) |
| 2207 | (if (subregexp-context-p isearch-string (length isearch-string)) | 2267 | (if (subregexp-context-p isearch-string (length isearch-string)) |
| 2208 | (isearch-process-search-string "[ ]" " ") | 2268 | (isearch-process-search-string "[ ]" " ") |
| 2209 | (isearch-process-search-char char)) | 2269 | (isearch-process-search-char char)) |
| @@ -2443,16 +2503,19 @@ Can be changed via `isearch-search-fun-function' for special needs." | |||
| 2443 | (funcall isearch-word string lax) | 2503 | (funcall isearch-word string lax) |
| 2444 | (word-search-regexp string lax)) | 2504 | (word-search-regexp string lax)) |
| 2445 | bound noerror count)))) | 2505 | bound noerror count)))) |
| 2506 | ((and isearch-regexp isearch-regexp-lax-whitespace | ||
| 2507 | search-whitespace-regexp) | ||
| 2508 | (if isearch-forward | ||
| 2509 | 're-search-forward-lax-whitespace | ||
| 2510 | 're-search-backward-lax-whitespace)) | ||
| 2446 | (isearch-regexp | 2511 | (isearch-regexp |
| 2447 | (if isearch-forward 're-search-forward 're-search-backward)) | 2512 | (if isearch-forward 're-search-forward 're-search-backward)) |
| 2513 | ((and isearch-lax-whitespace search-whitespace-regexp) | ||
| 2514 | (if isearch-forward | ||
| 2515 | 'search-forward-lax-whitespace | ||
| 2516 | 'search-backward-lax-whitespace)) | ||
| 2448 | (t | 2517 | (t |
| 2449 | (if isearch-forward 'isearch-search-forward 'isearch-search-backward)))) | 2518 | (if isearch-forward 'search-forward 'search-backward)))) |
| 2450 | |||
| 2451 | (defun isearch-search-forward (string &optional bound noerror count) | ||
| 2452 | (re-search-forward (regexp-quote string) bound noerror count)) | ||
| 2453 | |||
| 2454 | (defun isearch-search-backward (string &optional bound noerror count) | ||
| 2455 | (re-search-backward (regexp-quote string) bound noerror count)) | ||
| 2456 | 2519 | ||
| 2457 | (defun isearch-search-string (string bound noerror) | 2520 | (defun isearch-search-string (string bound noerror) |
| 2458 | "Search for the first occurrence of STRING or its translation. | 2521 | "Search for the first occurrence of STRING or its translation. |
| @@ -2513,7 +2576,6 @@ update the match data, and return point." | |||
| 2513 | search-invisible)) | 2576 | search-invisible)) |
| 2514 | (inhibit-quit nil) | 2577 | (inhibit-quit nil) |
| 2515 | (case-fold-search isearch-case-fold-search) | 2578 | (case-fold-search isearch-case-fold-search) |
| 2516 | (search-spaces-regexp (isearch-whitespace-regexp)) | ||
| 2517 | (retry t)) | 2579 | (retry t)) |
| 2518 | (setq isearch-error nil) | 2580 | (setq isearch-error nil) |
| 2519 | (while retry | 2581 | (while retry |
| @@ -2805,7 +2867,8 @@ since they have special meaning in a regexp." | |||
| 2805 | (defvar isearch-lazy-highlight-window-end nil) | 2867 | (defvar isearch-lazy-highlight-window-end nil) |
| 2806 | (defvar isearch-lazy-highlight-case-fold-search nil) | 2868 | (defvar isearch-lazy-highlight-case-fold-search nil) |
| 2807 | (defvar isearch-lazy-highlight-regexp nil) | 2869 | (defvar isearch-lazy-highlight-regexp nil) |
| 2808 | (defvar isearch-lazy-highlight-space-regexp nil) | 2870 | (defvar isearch-lazy-highlight-lax-whitespace nil) |
| 2871 | (defvar isearch-lazy-highlight-regexp-lax-whitespace nil) | ||
| 2809 | (defvar isearch-lazy-highlight-word nil) | 2872 | (defvar isearch-lazy-highlight-word nil) |
| 2810 | (defvar isearch-lazy-highlight-forward nil) | 2873 | (defvar isearch-lazy-highlight-forward nil) |
| 2811 | (defvar isearch-lazy-highlight-error nil) | 2874 | (defvar isearch-lazy-highlight-error nil) |
| @@ -2847,6 +2910,10 @@ by other Emacs features." | |||
| 2847 | isearch-regexp)) | 2910 | isearch-regexp)) |
| 2848 | (not (eq isearch-lazy-highlight-word | 2911 | (not (eq isearch-lazy-highlight-word |
| 2849 | isearch-word)) | 2912 | isearch-word)) |
| 2913 | (not (eq isearch-lazy-highlight-lax-whitespace | ||
| 2914 | isearch-lax-whitespace)) | ||
| 2915 | (not (eq isearch-lazy-highlight-regexp-lax-whitespace | ||
| 2916 | isearch-regexp-lax-whitespace)) | ||
| 2850 | (not (= (window-start) | 2917 | (not (= (window-start) |
| 2851 | isearch-lazy-highlight-window-start)) | 2918 | isearch-lazy-highlight-window-start)) |
| 2852 | (not (= (window-end) ; Window may have been split/joined. | 2919 | (not (= (window-end) ; Window may have been split/joined. |
| @@ -2873,7 +2940,8 @@ by other Emacs features." | |||
| 2873 | isearch-lazy-highlight-last-string isearch-string | 2940 | isearch-lazy-highlight-last-string isearch-string |
| 2874 | isearch-lazy-highlight-case-fold-search isearch-case-fold-search | 2941 | isearch-lazy-highlight-case-fold-search isearch-case-fold-search |
| 2875 | isearch-lazy-highlight-regexp isearch-regexp | 2942 | isearch-lazy-highlight-regexp isearch-regexp |
| 2876 | isearch-lazy-highlight-space-regexp (isearch-whitespace-regexp) | 2943 | isearch-lazy-highlight-lax-whitespace isearch-lax-whitespace |
| 2944 | isearch-lazy-highlight-regexp-lax-whitespace isearch-regexp-lax-whitespace | ||
| 2877 | isearch-lazy-highlight-word isearch-word | 2945 | isearch-lazy-highlight-word isearch-word |
| 2878 | isearch-lazy-highlight-forward isearch-forward) | 2946 | isearch-lazy-highlight-forward isearch-forward) |
| 2879 | (unless (equal isearch-string "") | 2947 | (unless (equal isearch-string "") |
| @@ -2887,7 +2955,6 @@ Attempt to do the search exactly the way the pending Isearch would." | |||
| 2887 | (condition-case nil | 2955 | (condition-case nil |
| 2888 | (let ((case-fold-search isearch-lazy-highlight-case-fold-search) | 2956 | (let ((case-fold-search isearch-lazy-highlight-case-fold-search) |
| 2889 | (isearch-regexp isearch-lazy-highlight-regexp) | 2957 | (isearch-regexp isearch-lazy-highlight-regexp) |
| 2890 | (search-spaces-regexp isearch-lazy-highlight-space-regexp) | ||
| 2891 | (isearch-word isearch-lazy-highlight-word) | 2958 | (isearch-word isearch-lazy-highlight-word) |
| 2892 | (search-invisible nil) ; don't match invisible text | 2959 | (search-invisible nil) ; don't match invisible text |
| 2893 | (retry t) | 2960 | (retry t) |