diff options
| author | Eli Zaretskii | 2015-11-30 19:30:29 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-11-30 19:30:29 +0200 |
| commit | 3e9ac80e015a377016d113633ddc5f928cff883c (patch) | |
| tree | a16446895ed3a97186f8b08cefb7bee2be0c39f0 | |
| parent | 10870c85445a48641b4f9cea91f8fbc7587eecde (diff) | |
| download | emacs-3e9ac80e015a377016d113633ddc5f928cff883c.tar.gz emacs-3e9ac80e015a377016d113633ddc5f928cff883c.zip | |
Yet another doc improvement for search commands
* doc/emacs/search.texi (Word Search, Symbol Search)
(Regexp Search): Document commands that don't support lax
whitespace matching or character folding.
(Nonincremental Search): Mention the search commands that can be
invoked from the menu bar.
* lisp/isearch.el (isearch-define-mode-toggle-word)
(isearch-define-mode-toggle-symbol)
(isearch-define-mode-toggle-character-fold): Note in the doc
string that turning these on exits the regexp mode.
(isearch-forward-regexp, isearch-forward-word)
(isearch-forward-symbol, isearch-backward-regexp)
(word-search-backward, word-search-forward)
(word-search-backward-lax, word-search-forward-lax): State in the
doc string which commands don't support character folding and/or
lax-whitespace matching.
| -rw-r--r-- | doc/emacs/search.texi | 17 | ||||
| -rw-r--r-- | lisp/isearch.el | 32 |
2 files changed, 37 insertions, 12 deletions
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 88ec68c43ec..81b4f87462e 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi | |||
| @@ -548,6 +548,9 @@ command for nonincremental search, if the string you specify is empty. | |||
| 548 | @key{RET}} does likewise, invoking the nonincremental | 548 | @key{RET}} does likewise, invoking the nonincremental |
| 549 | backward-searching command. | 549 | backward-searching command. |
| 550 | 550 | ||
| 551 | Nonincremental search can also be invoked form the menu bar's | ||
| 552 | @samp{Edit->Search} menu. | ||
| 553 | |||
| 551 | @findex search-forward | 554 | @findex search-forward |
| 552 | @findex search-backward | 555 | @findex search-backward |
| 553 | You can also use two simpler commands, @kbd{M-x search-forward} and | 556 | You can also use two simpler commands, @kbd{M-x search-forward} and |
| @@ -607,6 +610,9 @@ so that the matching can proceed incrementally as you type. This | |||
| 607 | additional laxity does not apply to the lazy highlight | 610 | additional laxity does not apply to the lazy highlight |
| 608 | (@pxref{Incremental Search}), which always matches whole words. | 611 | (@pxref{Incremental Search}), which always matches whole words. |
| 609 | 612 | ||
| 613 | The word search commands don't perform character folding and cannot | ||
| 614 | support lax whitespace matching (@pxref{Lax Search}). | ||
| 615 | |||
| 610 | @kindex M-s M-w | 616 | @kindex M-s M-w |
| 611 | @findex eww-search-word | 617 | @findex eww-search-word |
| 612 | @vindex eww-search-prefix | 618 | @vindex eww-search-prefix |
| @@ -663,6 +669,9 @@ search. In nonincremental symbol searches, the beginning and end of | |||
| 663 | the search string are required to match the beginning and end of a | 669 | the search string are required to match the beginning and end of a |
| 664 | symbol, respectively. | 670 | symbol, respectively. |
| 665 | 671 | ||
| 672 | The symbol search commands don't perform character folding and | ||
| 673 | cannot support lax whitespace matching (@pxref{Lax Search}). | ||
| 674 | |||
| 666 | @node Regexp Search | 675 | @node Regexp Search |
| 667 | @section Regular Expression Search | 676 | @section Regular Expression Search |
| 668 | @cindex regexp search | 677 | @cindex regexp search |
| @@ -709,13 +718,19 @@ regexps saved in the search ring is determined by the value of | |||
| 709 | @code{regexp-search-ring-max}, 16 by default. | 718 | @code{regexp-search-ring-max}, 16 by default. |
| 710 | 719 | ||
| 711 | Unlike ordinary incremental search, incremental regexp search | 720 | Unlike ordinary incremental search, incremental regexp search |
| 712 | do not use lax space matching by default. To toggle this feature | 721 | does not use lax space matching by default. To toggle this feature |
| 713 | use @kbd{M-s @key{SPC}} (@code{isearch-toggle-lax-whitespace}). | 722 | use @kbd{M-s @key{SPC}} (@code{isearch-toggle-lax-whitespace}). |
| 714 | Then any @key{SPC} typed in incremental regexp search will match | 723 | Then any @key{SPC} typed in incremental regexp search will match |
| 715 | any sequence of one or more whitespace characters. The variable | 724 | any sequence of one or more whitespace characters. The variable |
| 716 | @code{search-whitespace-regexp} specifies the regexp for the lax | 725 | @code{search-whitespace-regexp} specifies the regexp for the lax |
| 717 | space matching. @xref{Special Isearch}. | 726 | space matching. @xref{Special Isearch}. |
| 718 | 727 | ||
| 728 | Also unlike ordinary incremental search, incremental regexp search | ||
| 729 | cannot use character folding (@pxref{Lax Search}). (If you toggle | ||
| 730 | character folding during incremental regexp search with @kbd{M-s '}, | ||
| 731 | the search becomes a non-regexp search and the search pattern you | ||
| 732 | typed is interpreted as a literal string.) | ||
| 733 | |||
| 719 | In some cases, adding characters to the regexp in an incremental | 734 | In some cases, adding characters to the regexp in an incremental |
| 720 | regexp search can make the cursor move back and start again. For | 735 | regexp search can make the cursor move back and start again. For |
| 721 | example, if you have searched for @samp{foo} and you add @samp{\|bar}, | 736 | example, if you have searched for @samp{foo} and you add @samp{\|bar}, |
diff --git a/lisp/isearch.el b/lisp/isearch.el index 6cbe612d72e..229121d55b1 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -774,7 +774,8 @@ as a regexp. See the command `isearch-forward' for more information. | |||
| 774 | In incremental searches, a space or spaces normally matches any | 774 | In incremental searches, a space or spaces normally matches any |
| 775 | whitespace defined by the variable `search-whitespace-regexp'. | 775 | whitespace defined by the variable `search-whitespace-regexp'. |
| 776 | To search for a literal space and nothing else, enter C-q SPC. | 776 | To search for a literal space and nothing else, enter C-q SPC. |
| 777 | To toggle whitespace matching, use `isearch-toggle-lax-whitespace'." | 777 | To toggle whitespace matching, use `isearch-toggle-lax-whitespace'. |
| 778 | This command does not support character folding." | ||
| 778 | (interactive "P\np") | 779 | (interactive "P\np") |
| 779 | (isearch-mode t (null not-regexp) nil (not no-recursive-edit))) | 780 | (isearch-mode t (null not-regexp) nil (not no-recursive-edit))) |
| 780 | 781 | ||
| @@ -783,7 +784,8 @@ To toggle whitespace matching, use `isearch-toggle-lax-whitespace'." | |||
| 783 | With a prefix argument, do a regular string search instead. | 784 | With a prefix argument, do a regular string search instead. |
| 784 | Like ordinary incremental search except that your input is treated | 785 | Like ordinary incremental search except that your input is treated |
| 785 | as a sequence of words without regard to how the words are separated. | 786 | as a sequence of words without regard to how the words are separated. |
| 786 | See the command `isearch-forward' for more information." | 787 | See the command `isearch-forward' for more information. |
| 788 | This command does not support character folding or lax space matching." | ||
| 787 | (interactive "P\np") | 789 | (interactive "P\np") |
| 788 | (isearch-mode t nil nil (not no-recursive-edit) (null not-word))) | 790 | (isearch-mode t nil nil (not no-recursive-edit) (null not-word))) |
| 789 | 791 | ||
| @@ -792,7 +794,8 @@ See the command `isearch-forward' for more information." | |||
| 792 | The prefix argument is currently unused. | 794 | The prefix argument is currently unused. |
| 793 | Like ordinary incremental search except that your input is treated | 795 | Like ordinary incremental search except that your input is treated |
| 794 | as a symbol surrounded by symbol boundary constructs \\_< and \\_>. | 796 | as a symbol surrounded by symbol boundary constructs \\_< and \\_>. |
| 795 | See the command `isearch-forward' for more information." | 797 | See the command `isearch-forward' for more information. |
| 798 | This command does not support character folding or lax space matching." | ||
| 796 | (interactive "P\np") | 799 | (interactive "P\np") |
| 797 | (isearch-mode t nil nil (not no-recursive-edit) 'isearch-symbol-regexp)) | 800 | (isearch-mode t nil nil (not no-recursive-edit) 'isearch-symbol-regexp)) |
| 798 | 801 | ||
| @@ -807,7 +810,7 @@ See the command `isearch-forward' for more information." | |||
| 807 | "Do incremental search backward for regular expression. | 810 | "Do incremental search backward for regular expression. |
| 808 | With a prefix argument, do a regular string search instead. | 811 | With a prefix argument, do a regular string search instead. |
| 809 | Like ordinary incremental search except that your input is treated | 812 | Like ordinary incremental search except that your input is treated |
| 810 | as a regexp. See the command `isearch-forward' for more information." | 813 | as a regexp. See the command `isearch-forward-regexp' for more information." |
| 811 | (interactive "P\np") | 814 | (interactive "P\np") |
| 812 | (isearch-mode nil (null not-regexp) nil (not no-recursive-edit))) | 815 | (isearch-mode nil (null not-regexp) nil (not no-recursive-edit))) |
| 813 | 816 | ||
| @@ -1533,9 +1536,12 @@ The command then executes BODY and updates the isearch prompt." | |||
| 1533 | (cdr types)))) | 1536 | (cdr types)))) |
| 1534 | (get 'search-default-regexp-mode 'custom-type))))))) | 1537 | (get 'search-default-regexp-mode 'custom-type))))))) |
| 1535 | 1538 | ||
| 1536 | (isearch-define-mode-toggle word "w" word-search-regexp) | 1539 | (isearch-define-mode-toggle word "w" word-search-regexp "\ |
| 1537 | (isearch-define-mode-toggle symbol "_" isearch-symbol-regexp) | 1540 | Turning on word search turns off regexp mode.") |
| 1538 | (isearch-define-mode-toggle character-fold "'" character-fold-to-regexp) | 1541 | (isearch-define-mode-toggle symbol "_" isearch-symbol-regexp "\ |
| 1542 | Turning on symbol search turns off regexp mode.") | ||
| 1543 | (isearch-define-mode-toggle character-fold "'" character-fold-to-regexp "\ | ||
| 1544 | Turning on character-folding turns off regexp mode.") | ||
| 1539 | (put 'character-fold-to-regexp 'isearch-message-prefix "char-fold ") | 1545 | (put 'character-fold-to-regexp 'isearch-message-prefix "char-fold ") |
| 1540 | 1546 | ||
| 1541 | (isearch-define-mode-toggle regexp "r" nil nil | 1547 | (isearch-define-mode-toggle regexp "r" nil nil |
| @@ -1618,7 +1624,8 @@ Optional fourth argument is repeat count--search for successive occurrences. | |||
| 1618 | 1624 | ||
| 1619 | Relies on the function `word-search-regexp' to convert a sequence | 1625 | Relies on the function `word-search-regexp' to convert a sequence |
| 1620 | of words in STRING to a regexp used to search words without regard | 1626 | of words in STRING to a regexp used to search words without regard |
| 1621 | to punctuation." | 1627 | to punctuation. |
| 1628 | This command does not support character folding or lax space matching." | ||
| 1622 | (interactive "sWord search backward: ") | 1629 | (interactive "sWord search backward: ") |
| 1623 | (re-search-backward (word-search-regexp string nil) bound noerror count)) | 1630 | (re-search-backward (word-search-regexp string nil) bound noerror count)) |
| 1624 | 1631 | ||
| @@ -1633,7 +1640,8 @@ Optional fourth argument is repeat count--search for successive occurrences. | |||
| 1633 | 1640 | ||
| 1634 | Relies on the function `word-search-regexp' to convert a sequence | 1641 | Relies on the function `word-search-regexp' to convert a sequence |
| 1635 | of words in STRING to a regexp used to search words without regard | 1642 | of words in STRING to a regexp used to search words without regard |
| 1636 | to punctuation." | 1643 | to punctuation. |
| 1644 | This command does not support character folding or lax space matching." | ||
| 1637 | (interactive "sWord search: ") | 1645 | (interactive "sWord search: ") |
| 1638 | (re-search-forward (word-search-regexp string nil) bound noerror count)) | 1646 | (re-search-forward (word-search-regexp string nil) bound noerror count)) |
| 1639 | 1647 | ||
| @@ -1652,7 +1660,8 @@ Optional fourth argument is repeat count--search for successive occurrences. | |||
| 1652 | 1660 | ||
| 1653 | Relies on the function `word-search-regexp' to convert a sequence | 1661 | Relies on the function `word-search-regexp' to convert a sequence |
| 1654 | of words in STRING to a regexp used to search words without regard | 1662 | of words in STRING to a regexp used to search words without regard |
| 1655 | to punctuation." | 1663 | to punctuation. |
| 1664 | This command does not support character folding or lax space matching." | ||
| 1656 | (interactive "sWord search backward: ") | 1665 | (interactive "sWord search backward: ") |
| 1657 | (re-search-backward (word-search-regexp string t) bound noerror count)) | 1666 | (re-search-backward (word-search-regexp string t) bound noerror count)) |
| 1658 | 1667 | ||
| @@ -1671,7 +1680,8 @@ Optional fourth argument is repeat count--search for successive occurrences. | |||
| 1671 | 1680 | ||
| 1672 | Relies on the function `word-search-regexp' to convert a sequence | 1681 | Relies on the function `word-search-regexp' to convert a sequence |
| 1673 | of words in STRING to a regexp used to search words without regard | 1682 | of words in STRING to a regexp used to search words without regard |
| 1674 | to punctuation." | 1683 | to punctuation. |
| 1684 | This command does not support character folding or lax space matching." | ||
| 1675 | (interactive "sWord search: ") | 1685 | (interactive "sWord search: ") |
| 1676 | (re-search-forward (word-search-regexp string t) bound noerror count)) | 1686 | (re-search-forward (word-search-regexp string t) bound noerror count)) |
| 1677 | 1687 | ||