NextPrevUpTopContentsIndex

3.21.1 Searching

Most of the search commands perform straightforward searches, but there are two useful commands (Incremental Search and Reverse Incremental Search) which perform incremental searches. This means that the search is started as soon as the first character is typed.

Incremental Search

Editor Command

Arguments: string
Key sequence: Ctrl+S string

Searches forward, starting from the current point, for the search string that is input, beginning the search as soon as each character is typed in. When a match is found for the search string, the current point is moved to the end of the matched string. If the search string is not found between the current point and the end of the buffer, an error is signalled.

The search can be controlled by entering one of the following key sequences at any time during the search.

Ctrl+S

If the search string is empty, repeats the last incremental search, otherwise repeats a forward search for the current search string.

If the search string cannot be found, starts the search from the beginning of the buffer (wrap-around search).

Ctrl+R

Changes to a backward (reverse) search.

Delete

Cancels the last character typed.

Ctrl+Q

Quotes the next character typed.

Ctrl+W

Adds the next word under the cursor to the search string.

Meta+Ctrl+Y

Adds the next form under the cursor to the search string.

Ctrl+Y

Adds the remainder of the line under the cursor to the search string.

Meta+Y

Adds the current kill string to the search string.

Esc

If the search string is empty, invokes a non-incremental search, otherwise exits the search, leaving the current point at the last find.

Ctrl+G

Aborts the search, returning the current point to its original location.

If the search string cannot be found, cancels the last character typed (equivalent to Delete ).

Return

Exits the search, leaving the current point at the last find.

Reverse Incremental Search

Editor Command

Arguments: string
Key sequence: Ctrl+R string

Searches backward, starting from the current point, for the search string that is input, beginning the search as soon as each character is provided. When a match is found for the search string, the current point is moved to the start of the matched string. If the search string is not found between the current point and the beginning of the buffer, an error is signalled.

The search can be controlled by entering one of the following key sequences at any time during the search.

Ctrl+R

If the search string is empty, repeats the last incremental search, otherwise repeats a backward search for the current search string.

If the search string cannot be found, starts the search from the end of the buffer (wrap-around search).

Ctrl+S

Changes to a forward search.

Delete

Cancels the last character typed.

Esc

If the search string is empty, invokes a non-incremental search, otherwise exits the search, leaving the current point at the last find.

Ctrl+G

Aborts the search, returning the current point to its original location.

If the search string cannot be found, cancels the last character typed (equivalent to Delete ).

Ctrl+Q

Quotes the next character typed.

Forward Search

Editor Command

Arguments: string
Key sequence: Ctrl+S Esc string

editor:forward-search-command p &optional string the-point

The default for the-point is the current point.

Searches forwards from the-point for string . When a match is found, the-point is moved to the end of the matched string. In contrast with Incremental Search, the search string must be terminated with a carriage return before any searching is done. If an empty string is provided, the last search is repeated.

Backward Search

Editor Command

Arguments: string
Key sequence: None

editor:reverse-search-command p &optional string the-point

The default for the-point is the current point.

Searches backwards from the-point for string . When a match is found, the-point is moved to the start of the matched string. In contrast with Reverse Incremental Search, the search string must be terminated with a carriage return before any searching is done. If an empty string is provided, the last search is repeated.

Reverse Search is a synonym for Backward Search .

List Matching Lines

Editor Command

Arguments: string
Key sequence: None

editor:list-matching-lines-command p &optional string

Lists all lines after the current point that contain string , in a Matches window.

A prefix argument causes the appropriate number of lines before and after each matching line to be listed also.

Delete Matching Lines

Editor Command

Arguments: string
Key sequence: None

editor:delete-matching-lines-command p &optional string

Deletes all lines after the current point that match string .

Delete Non-Matching Lines

Editor Command

Arguments: string
Key sequence: None

editor:delete-non-matching-lines-command p &optional string

Deletes all lines after the current point that do not match string .

Search All Buffers

Editor Command

Arguments: string
Key sequence: None

Searches all the buffers for string . If only one buffer contains string, it becomes the current one, with the cursor positioned at the start of the string. If more than one buffer contains the string, a popup window displays a list of those buffers. A buffer may then be selected from this list.

Directory Search

Editor Command

Arguments: directory string
Key sequence: None

Searches files in directory for string . The current working directory is offered as a default for directory .

By default only files with suffix .lisp , .lsp , .c or .h are searched. A non- nil prefix argument causes all files to be searched, except for those ending with one of the strings in the list system:*ignorable-file-suffices* .

Use the key sequence Meta+, to find subsequent definitions of the search string.

Search Files

Editor Command

Arguments: search-string directory
Key sequence: Ctrl+X *

Searches for a string in a directory using a Search Files tool.

The command prompts for search-string and directory and then raises a Search Files tool. The configuration of the Search Files tool controls which files in the directory are searched. If the search string is not empty, it starts searching automatically, unless a prefix argument is given.

See the Common LispWorks User Guide for a description of the Search Files tool.

Search Files Matching Patterns

Editor Command

Arguments: search-string directory patterns
Key sequence: Ctrl+X &

Searches for a string in files under a directory with names matching given patterns, using a Search Files tool.

The command prompts for search-string , directory and patterns, and raises a Search Files tool in Roots and Patterns mode. If the search string is not empty, it starts searching automatically, unless a prefix argument is given.

patterns should be a comma-separated set of filename patterns delimited by braces. A pattern where the last component does not contain * is assumed to be a directory onto which the Search Files tool adds its own filename pattern. patterns defaults to {*.lisp,*.lsp,*.c,*.h} .

See the Common LispWorks User Guide for a description of the Search Files tool.

System Search

Editor Command

Arguments: system string
Key sequence: None

Searches the files of system for string .

Matches are shown in editor buffers consecutively. Use the key sequence Meta+, to find subsequent definitions of the search string.

Search System

Editor Command

Arguments: search-string system
Key sequence: None

Prompts for search-string and system and then raises a Search Files tool in System Search mode, which displays the search results and allows you to visit the files.

See the Common LispWorks User Guide for a description of the Search Files tool.

Default-Search-Kind

Editor Variable

Default value: :string-insensitive

Defines the default method of searching. By default, all searching (including regexp searching) ignores case. If you want searching to be case-sensitive, the value of this variable should be set to :string-sensitive using Set Variable.

It is also possible to search a set of files programatically using the search-files function:


LispWorks Editor User Guide (Unix version) - 14 Mar 2008

NextPrevUpTopContentsIndex