Mercurial > emacs
comparison man/search.texi @ 52968:f785910734e8
(Scrolling During Incremental Search): Document a
new scrolling facility in isearch mode.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 01 Nov 2003 17:06:00 +0000 |
parents | 695cf19ef79e |
children | 3649390c0f91 |
comparison
equal
deleted
inserted
replaced
52967:9cd8b1bd5ecc | 52968:f785910734e8 |
---|---|
17 occurrences of one string and replaces them with another, Emacs has a | 17 occurrences of one string and replaces them with another, Emacs has a |
18 more flexible replacement command called @code{query-replace}, which | 18 more flexible replacement command called @code{query-replace}, which |
19 asks interactively which occurrences to replace. | 19 asks interactively which occurrences to replace. |
20 | 20 |
21 @menu | 21 @menu |
22 * Incremental Search:: Search happens as you type the string. | 22 * Incremental Search:: Search happens as you type the string. |
23 * Nonincremental Search:: Specify entire string and then search. | 23 * Nonincremental Search:: Specify entire string and then search. |
24 * Word Search:: Search for sequence of words. | 24 * Word Search:: Search for sequence of words. |
25 * Regexp Search:: Search for match for a regexp. | 25 * Regexp Search:: Search for match for a regexp. |
26 * Regexps:: Syntax of regular expressions. | 26 * Regexps:: Syntax of regular expressions. |
27 * Search Case:: To ignore case while searching, or not. | 27 * Search Case:: To ignore case while searching, or not. |
28 * Replace:: Search, and replace some or all matches. | 28 * Configuring Scrolling:: Scrolling within incremental search. |
29 * Other Repeating Search:: Operating on all matches for some regexp. | 29 * Replace:: Search, and replace some or all matches. |
30 * Other Repeating Search:: Operating on all matches for some regexp. | |
30 @end menu | 31 @end menu |
31 | 32 |
32 @node Incremental Search, Nonincremental Search, Search, Search | 33 @node Incremental Search, Nonincremental Search, Search, Search |
33 @section Incremental Search | 34 @section Incremental Search |
34 | 35 |
223 @vindex isearch-mode-map | 224 @vindex isearch-mode-map |
224 To customize the special characters that incremental search understands, | 225 To customize the special characters that incremental search understands, |
225 alter their bindings in the keymap @code{isearch-mode-map}. For a list | 226 alter their bindings in the keymap @code{isearch-mode-map}. For a list |
226 of bindings, look at the documentation of @code{isearch-mode} with | 227 of bindings, look at the documentation of @code{isearch-mode} with |
227 @kbd{C-h f isearch-mode @key{RET}}. | 228 @kbd{C-h f isearch-mode @key{RET}}. |
229 | |
230 @subsection Scrolling During Incremental Search | |
231 | |
232 Vertical scrolling during incremental search can be enabled by | |
233 setting the customizable variable @code{isearch-allow-scroll} to a | |
234 non-nil value. | |
235 | |
236 You can then use the vertical scroll-bar or certain keyboard | |
237 commands such as @kbd{@key{PRIOR}} (@code{scroll-down}), | |
238 @kbd{@key{NEXT}} (@code{scroll-up}) and @kbd{C-l} (@code{recenter}) | |
239 within the search, thus letting you see more of the text near the | |
240 current match. You must run these commands via their key sequences to | |
241 stay in the search - typing M-x @var{comand-name} will always | |
242 terminate a search. | |
243 | |
244 You can give prefix arguments to these commands in the usual way. | |
245 The current match cannot be scrolled out of the window - this is | |
246 intentional. | |
247 | |
248 Several other commands, such as @kbd{C-x 2} | |
249 (@code{split-window-vertically}) and @kbd{C-x ^} | |
250 (@code{enlarge-window}) which don't scroll the window, are | |
251 nevertheless made available under this rubric, since they are likewise | |
252 handy during a search. | |
253 | |
254 For a list of commands which are configured as scrolling commands by | |
255 default and instructions on how thus to configure other commands, see | |
256 @ref{Configuring Scrolling}. | |
228 | 257 |
229 @subsection Slow Terminal Incremental Search | 258 @subsection Slow Terminal Incremental Search |
230 | 259 |
231 Incremental search on a slow terminal uses a modified style of display | 260 Incremental search on a slow terminal uses a modified style of display |
232 that is designed to take less time. Instead of redisplaying the buffer at | 261 that is designed to take less time. Instead of redisplaying the buffer at |
760 verify even very complex regexps. (On displays that don't support | 789 verify even very complex regexps. (On displays that don't support |
761 colors, Emacs blinks the cursor around the matched text, as it does | 790 colors, Emacs blinks the cursor around the matched text, as it does |
762 for matching parens.) | 791 for matching parens.) |
763 @end ignore | 792 @end ignore |
764 | 793 |
765 @node Search Case, Replace, Regexps, Search | 794 @node Search Case, Configuring Scrolling, Regexps, Search |
766 @section Searching and Case | 795 @section Searching and Case |
767 | 796 |
768 Incremental searches in Emacs normally ignore the case of the text | 797 Incremental searches in Emacs normally ignore the case of the text |
769 they are searching through, if you specify the text in lower case. | 798 they are searching through, if you specify the text in lower case. |
770 Thus, if you specify searching for @samp{foo}, then @samp{Foo} and | 799 Thus, if you specify searching for @samp{foo}, then @samp{Foo} and |
790 there is a default value which you can change as well. @xref{Locals}. | 819 there is a default value which you can change as well. @xref{Locals}. |
791 This variable applies to nonincremental searches also, including those | 820 This variable applies to nonincremental searches also, including those |
792 performed by the replace commands (@pxref{Replace}) and the minibuffer | 821 performed by the replace commands (@pxref{Replace}) and the minibuffer |
793 history matching commands (@pxref{Minibuffer History}). | 822 history matching commands (@pxref{Minibuffer History}). |
794 | 823 |
795 @node Replace, Other Repeating Search, Search Case, Search | 824 @node Configuring Scrolling, Replace, Search Case, Search |
825 @section Configuring Scrolling | |
826 @cindex scrolling in incremental search | |
827 @vindex isearch-allow-scroll | |
828 | |
829 Scrolling, etc., during incremental search is enabled by setting the | |
830 customizable variable @code{isearch-allow-scroll} to a non-nil value. | |
831 | |
832 @c See Subject: Info file: How do I get an itemized list without blank lines? | |
833 @c Date: Sat, 12 Apr 2003 09:45:31 +0000 in gnu.emacs.help | |
834 @subsection Standard scrolling commands | |
835 Here is the list of commands which are configured by default to be | |
836 ``scrolling'' commands in an incremental search, together with their | |
837 usual bindings: | |
838 @subsubsection Commands which scroll the window: | |
839 @table @asis | |
840 @item @code{scroll-bar-toolkit-scroll} (@kbd{@key{vertical-scroll-bar}@key{mouse-1}} in X-Windows) | |
841 @itemx @code{mac-handle-scroll-bar-event} (@kbd{@key{vertical-scroll-bar}@key{mouse-1}} on a Mac) | |
842 @itemx @code{w32-handle-scroll-bar-event} (@kbd{@key{vertical-scroll-bar}@key{mouse-1}} in MS-Windows) | |
843 @item @code{recenter} (@kbd{C-l}) @xref{Scrolling}. | |
844 @itemx @code{reposition-window} (@kbd{C-M-l}) @xref{Scrolling}. | |
845 @itemx @code{scroll-up} (@kbd{@key{NEXT}}) @xref{Scrolling}. | |
846 @itemx @code{scroll-down} (@kbd{@key{PRIOR}}) @xref{Scrolling}. | |
847 @end table | |
848 | |
849 @subsubsection Commands which act on the other window: | |
850 @table @asis | |
851 @item @code{list-buffers} (@kbd{C-x C-b}) @xref{List Buffers}. | |
852 @itemx @code{scroll-other-window} (@kbd{C-M-v}) @xref{Other Window}. | |
853 @itemx @code{scroll-other-window-down} (@kbd{C-M-S-v}) @xref{Other Window}. | |
854 @itemx @code{beginning-of-buffer-other-window} (@kbd{M-@key{home}}) | |
855 @itemx @code{end-of-buffer-other-window} (@kbd{M-@key{end}}) | |
856 @end table | |
857 | |
858 @subsubsection Commands which change the window layout: | |
859 @table @asis | |
860 @item @code{delete-other-windows} (@kbd{C-x 1}) @xref{Change Window}. | |
861 @itemx @code{balance-windows} (@kbd{C-x +}) @xref{Change Window}. | |
862 @itemx @code{split-window-vertically} (@kbd{C-x 2}) @xref{Split Window}. | |
863 @itemx @code{enlarge-window} (@kbd{C-x ^}) @xref{Change Window}. | |
864 @end table | |
865 | |
866 @subsection Configuring other commands as scrolling commands | |
867 To do this, set a command's isearch-scroll property to the value t. | |
868 For example: | |
869 | |
870 @example | |
871 @code{(put 'my-command 'isearch-scroll t)} | |
872 @end example | |
873 | |
874 You should only thus configure commands which are ``safe'': i.e., they | |
875 won't leave emacs in an inconsistent state when executed within a | |
876 search - that is to say, the following things may be changed by a | |
877 command only temporarily, and must be restored before the command | |
878 finishes: | |
879 | |
880 @enumerate | |
881 @item | |
882 Point. | |
883 @item | |
884 The buffer contents. | |
885 @item | |
886 The selected window and selected frame. | |
887 @item | |
888 The current match-data @xref{Match Data,,,elisp}. | |
889 @end enumerate | |
890 | |
891 Additionally, the command must not delete the current window and must | |
892 not itself attempt an incremental search. It may, however, change the | |
893 window's size, or create or delete other windows and frames. | |
894 | |
895 Note that an attempt by a command to scroll the text | |
896 @emph{horizontally} won't work, although it will do no harm - any such | |
897 scrolling will be overriden and nullified by the display code. | |
898 | |
899 @node Replace, Other Repeating Search, Configuring Scrolling, Search | |
796 @section Replacement Commands | 900 @section Replacement Commands |
797 @cindex replacement | 901 @cindex replacement |
798 @cindex search-and-replace commands | 902 @cindex search-and-replace commands |
799 @cindex string substitution | 903 @cindex string substitution |
800 @cindex global substitution | 904 @cindex global substitution |
812 replacement string. It is possible to perform several replacements in | 916 replacement string. It is possible to perform several replacements in |
813 parallel using the command @code{expand-region-abbrevs} | 917 parallel using the command @code{expand-region-abbrevs} |
814 (@pxref{Expanding Abbrevs}). | 918 (@pxref{Expanding Abbrevs}). |
815 | 919 |
816 @menu | 920 @menu |
817 * Unconditional Replace:: Replacing all matches for a string. | 921 * Unconditional Replace:: Replacing all matches for a string. |
818 * Regexp Replace:: Replacing all matches for a regexp. | 922 * Regexp Replace:: Replacing all matches for a regexp. |
819 * Replacement and Case:: How replacements preserve case of letters. | 923 * Replacement and Case:: How replacements preserve case of letters. |
820 * Query Replace:: How to use querying. | 924 * Query Replace:: How to use querying. |
821 @end menu | 925 @end menu |
822 | 926 |
823 @node Unconditional Replace, Regexp Replace, Replace, Replace | 927 @node Unconditional Replace, Regexp Replace, Replace, Replace |
824 @subsection Unconditional Replacement | 928 @subsection Unconditional Replacement |
825 @findex replace-string | 929 @findex replace-string |