aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2015-11-30 19:30:29 +0200
committerEli Zaretskii2015-11-30 19:30:29 +0200
commit3e9ac80e015a377016d113633ddc5f928cff883c (patch)
treea16446895ed3a97186f8b08cefb7bee2be0c39f0
parent10870c85445a48641b4f9cea91f8fbc7587eecde (diff)
downloademacs-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.texi17
-rw-r--r--lisp/isearch.el32
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
549backward-searching command. 549backward-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
607additional laxity does not apply to the lazy highlight 610additional 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
614support 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
663the search string are required to match the beginning and end of a 669the search string are required to match the beginning and end of a
664symbol, respectively. 670symbol, respectively.
665 671
672 The symbol search commands don't perform character folding and
673cannot 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
712do not use lax space matching by default. To toggle this feature 721does not use lax space matching by default. To toggle this feature
713use @kbd{M-s @key{SPC}} (@code{isearch-toggle-lax-whitespace}). 722use @kbd{M-s @key{SPC}} (@code{isearch-toggle-lax-whitespace}).
714Then any @key{SPC} typed in incremental regexp search will match 723Then any @key{SPC} typed in incremental regexp search will match
715any sequence of one or more whitespace characters. The variable 724any 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
717space matching. @xref{Special Isearch}. 726space matching. @xref{Special Isearch}.
718 727
728 Also unlike ordinary incremental search, incremental regexp search
729cannot use character folding (@pxref{Lax Search}). (If you toggle
730character folding during incremental regexp search with @kbd{M-s '},
731the search becomes a non-regexp search and the search pattern you
732typed 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
720regexp search can make the cursor move back and start again. For 735regexp search can make the cursor move back and start again. For
721example, if you have searched for @samp{foo} and you add @samp{\|bar}, 736example, 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.
774In incremental searches, a space or spaces normally matches any 774In incremental searches, a space or spaces normally matches any
775whitespace defined by the variable `search-whitespace-regexp'. 775whitespace defined by the variable `search-whitespace-regexp'.
776To search for a literal space and nothing else, enter C-q SPC. 776To search for a literal space and nothing else, enter C-q SPC.
777To toggle whitespace matching, use `isearch-toggle-lax-whitespace'." 777To toggle whitespace matching, use `isearch-toggle-lax-whitespace'.
778This 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'."
783With a prefix argument, do a regular string search instead. 784With a prefix argument, do a regular string search instead.
784Like ordinary incremental search except that your input is treated 785Like ordinary incremental search except that your input is treated
785as a sequence of words without regard to how the words are separated. 786as a sequence of words without regard to how the words are separated.
786See the command `isearch-forward' for more information." 787See the command `isearch-forward' for more information.
788This 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."
792The prefix argument is currently unused. 794The prefix argument is currently unused.
793Like ordinary incremental search except that your input is treated 795Like ordinary incremental search except that your input is treated
794as a symbol surrounded by symbol boundary constructs \\_< and \\_>. 796as a symbol surrounded by symbol boundary constructs \\_< and \\_>.
795See the command `isearch-forward' for more information." 797See the command `isearch-forward' for more information.
798This 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.
808With a prefix argument, do a regular string search instead. 811With a prefix argument, do a regular string search instead.
809Like ordinary incremental search except that your input is treated 812Like ordinary incremental search except that your input is treated
810as a regexp. See the command `isearch-forward' for more information." 813as 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) 1540Turning 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 "\
1542Turning on symbol search turns off regexp mode.")
1543(isearch-define-mode-toggle character-fold "'" character-fold-to-regexp "\
1544Turning 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
1619Relies on the function `word-search-regexp' to convert a sequence 1625Relies on the function `word-search-regexp' to convert a sequence
1620of words in STRING to a regexp used to search words without regard 1626of words in STRING to a regexp used to search words without regard
1621to punctuation." 1627to punctuation.
1628This 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
1634Relies on the function `word-search-regexp' to convert a sequence 1641Relies on the function `word-search-regexp' to convert a sequence
1635of words in STRING to a regexp used to search words without regard 1642of words in STRING to a regexp used to search words without regard
1636to punctuation." 1643to punctuation.
1644This 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
1653Relies on the function `word-search-regexp' to convert a sequence 1661Relies on the function `word-search-regexp' to convert a sequence
1654of words in STRING to a regexp used to search words without regard 1662of words in STRING to a regexp used to search words without regard
1655to punctuation." 1663to punctuation.
1664This 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
1672Relies on the function `word-search-regexp' to convert a sequence 1681Relies on the function `word-search-regexp' to convert a sequence
1673of words in STRING to a regexp used to search words without regard 1682of words in STRING to a regexp used to search words without regard
1674to punctuation." 1683to punctuation.
1684This 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