LispWorks Editor User Guide > 4 Editing Lisp Programs > 4.3 Functions and definitions

NextPrevUpTopContentsIndex

4.3.2 Definition searching

Definition searching involves taking a name for a function (or a macro, variable, editor command,.and so on), and finding the actual definition of that function. This is particularly useful in large systems, where code may exist in a large number of source files.

Function definitions are found by using information provided either by LispWorks source recording or by a Tags file. If source records or Tags information have not been made available to LispWorks, then the following commands do not work. To make the information available to LispWorks, set the variable dspec:*active-finders* appropriately. See the LispWorks User Guide and Reference Manual for details.

Source records are created if the variable *record-source-files* is true when definitions are compiled, evaluated or loaded. See the LispWorks User Guide and Reference Manual for details.

Tag information is set up by the editor itself, and can be saved to a file for future use. For each file in a defined system, the tag file contains a relevant file name entry, followed by names and positions of each defining form in that file. Before tag searching can take place, there must exist a buffer containing the required tag information. You can specify a previously saved tag file as the current tag buffer, or you can create a new one using Create Tags Buffer. GNU Emacs tag files are fully compatible with LispWorks editor tag files.

Find Source

Editor Command

Argument: name
Key sequence: Alt+. name

Tries to find the source code for name . The symbol under the current point is offered as a default value for name . A prefix argument automatically causes this default value to be used.

If the source code for name is found, the file in which it is contained is displayed in a buffer. When there is more than one definition for name , Find Source finds the first definition, and Alt+, ( Continue Tags Search ) finds subsequent definitions.

Find Source searches for definitions according to the value of dspec:*active-finders* . You can control which source record information is searched, and the order in which these are searched, by setting this variable appropriately. See the LispWorks User Guide and Reference Manual for details. There is an example setting for this variable in the configuration files supplied.

If dspec:*active-finders* contains the value :tags , Find Source prompts for the name of a tags file, and this is used for the current and subsequent searches.

The found source is displayed according to the value of editor:*source-found-action*. This depends on the buffer with the found definition being in Lisp mode. For information on how to ensure this for particular file types, see Automatic entry into lisp mode.

Find Source for Dspec

Editor Command

Argument: dspec
Key sequence: None

This command is similar to Find Source , but takes a definition spec dspec instead of a name as its argument.

For example, given a generic function foo of one argument, with methods specializing on classes bar and baz ,

Find Source for Dspec foo

will find each method definition in turn (with the continuation via Alt+ ,) whereas

Find Source for Dspec (method foo (bar))

finds only the definition of the method on bar .

Find Command Definition

Editor Command

Argument: command
Key sequence: None

This command is similar to Find Source, but takes the name of an editor command, and tries to find its source code.

Except in the Personal Edition, you can use this command to find the definitions of the predefined editor commands. See the LispWorks User Guide and Reference Manual chapter "Customization of LispWorks" for details.

Edit Editor Command

Editor Command

Argument: command
Key sequence: None

This is a synonym for Find Command Definition.

View Source Search

Editor Command

Argument: function
Key sequence: None

Shows the results of the latest source search (initiated by Find Source or Find Source for Dspec or Find Command Definition) in the Find Definitions view of the Editor. See the chapter on the Editor tool in the LispWorks IDE User Guide for more information about the Find Definitions view.

List Definitions

Editor Command

Argument: name
Key sequence: None

List the definitions for name . The symbol under the current point is offered as a default value for name . A prefix argument automatically causes this default value to be used.

This command searches for definitions and shows the results in the Find Definitions view of the Editor tool instead of finding the first definition. It does not set up the Alt+, action.

See the chapter on the Editor tool in the LispWorks IDE User Guide for more information about the Find Definitions view.

List Definitions For Dspec

Editor Command

Argument: dspec
Key sequence: None

This command is similar to List Definitions, but takes a definition spec dspec instead of a name as its argument.

This command searches for definitions and shows the results in the Find Definitions view of the Editor tool instead of finding the first definition. This command does not set up the Alt+, action.

See the chapter on the Editor tool in the LispWorks IDE User Guide for more information about the Find Definitions view.

Create Tags Buffer

Editor Command

Argument: None
Key sequence: None

Creates a buffer containing Tag search information, for all the .lisp files in the current directory. If you want to use this information at a later date then save this buffer to a file (preferably a file called TAGS in the current directory).

The format of the information contained in this buffer is compatible with that of GNU Emacs tags files.

A prefix argument causes the user to be prompted for the name of a file containing a list of files, to be used for constructing the tags table.

Find Tag

Editor Command

Key sequence: Alt+?

Tries to find the source code for a name containing a partial or complete match a supplied string by examining the Tags information indicated by the value of dspec:*active-finders* .

The text under the current point is offered as a default value for the string .

If the source code for a match is found, the file in which it is contained is displayed. When there is more than one definition, Find Tag finds the first definition, and Alt+, ( Continue Tags Search ) finds subsequent definitions.

The found source is displayed according to the value of editor:*source-found-action*.

If there is no tags information indicated by the value of dspec:*active-finders* , Find Tag prompts for the name of a tags file. The default is a file called TAGS in the current directory. If there is no such file, you can create one using Create Tags Buffer. If you want to search a different directory, specify the name of a tags file in that directory.

See the chapter on the DSPEC package in the LispWorks User Guide and Reference Manual for information on how to use the dspec:*active-finders* variable to control how this command operates. There is an example setting for this variable in the configuration files supplied.

See also Find Source , Find Source for Dspec and Create Tags Buffer.

Tags Search

Editor Command

Key sequence: None

Exhaustively searches each file mentioned in the Tags files indicated by the value of dspec:*active-finders* for a supplied string string . Note that this does not merely search for definitions, but for any occurence of the string.

If string is found, it is displayed in a buffer containing the relevant file. When there is more than one definition, Tags Search finds the first definition, and Alt+, ( Continue Tags Search ) finds subsequent definitions.

If there is no Tags file on dspec:*active-finders* , Tags Search prompts for the name of a tags file. The default is a file called TAGS in the current directory. If there is no such file, you can create one using Create Tags Buffer. If you want to search a different directory, specify the name of a tags file in that directory.

Continue Tags Search

Editor Command

Argument: None
Key sequence: Alt+,

Searches for the next match in the current search. This command is only applicable if issued immediately after a Find Source, Find Source for Dspec, Find Command Definition , Edit Callers , Edit Callees , Find Tag or Tags Search command.

Tags Query Replace

Editor Command

Key sequence: None

Alows you to replace occurrences of a supplied string target by a second supplied string replacement in each Tags file indicated by the value of dspec:*active-finders*.

Each time target is found, an action must be specified from the keyboard. For details of the possible actions see Query Replace .

If there is no Tags file indicated by dspec:*active-finders* , Tags Query Replace prompts for the name of a tags file. The default is a file called TAGS in the current directory. If there is no such file, you can create one using Create Tags Buffer.

Visit Tags File

Editor Command

Key sequence: None

Prompts for a Tags file file and makes the source finding commands use it. This is done by modifying, if necessary, the value of dspec:*active-finders* .

If file is already in dspec:*active-finders* , this command does nothing.

If there are other Tags files indicated then Visit Tags File prompts for whether to add simply add file as the last element of dspec:*active-finders* , or to save the current value of dspec:*active-finders* and start a new list of active finders, setting dspec:*active-finders* to the new value ( :internal file ). In this case, the previous active finders list can be restored by the command Rotate Active Finders.

If the value :tags appears on the list dspec:*active-finders* then file replaces this value in the list.

If there is no tags information indicated then Visit Tags File simply adds file as the last element of dspec:*active-finders* .

Rotate Active Finders

Editor Command

Key sequence: Alt+Ctrl+.

Rotates the active finders history, activating the least recent one. This modifies the value of dspec:*active-finders* .

The active finders history can have length greater than 1 if Visit Tags File started a new list of active finders, or if a buffer associated with a TAGS file on dspec:*active-finders* was killed.

Visit Other Tags File is a synonym for Rotate Active Finders .


LispWorks Editor User Guide (Windows version) - 22 Dec 2009

NextPrevUpTopContentsIndex