Definition searching involves taking a function name 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 the LispWorks cross-referencer or by a Tags buffer. If cross-referencing or Tags information has not been produced, then the following commands do not work.
Cross-referencing information is produced by turning source debugging on while compiling and loading the relevant definitions (see toggle-source-debugging
in the LispWorks Reference Manual ).
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.
Argument: function [ tags-file ]
Key sequence: +.
function [ tags-file ]
Tries to find the source code for function . The symbol under the current point is offered as a default value for function . A prefix argument automatically causes this default value to be used.
If the source code for function is found, the file in which it is contained is displayed in a new buffer. When there is more than one definition, Find Source
finds the first definition, and +,
( Continue Tags Search
) finds subsequent definitions.
The found source is displayed according to the value of editor:*source-found-action*.
Find Source
first looks for definitions that have been loaded or evaluated (i.e. using cross-referencing information). If it cannot find the definition here, it looks at the current tags file by issuing the command Find Tag
(for this reason, Find Source
is recommended rather than Find Tag
).
If there is no current tags buffer, Find Source
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 documentation on Tags commands given below).
See the chapter on the DSPEC
package in the LispWorks Reference Manual for information on how to use the dpsec:*active-finders*
variable to control how this command operates. There is an example setting for this variable in the configuration files supplied.
Argument: function [ tags-file ]
Key sequence: None
Similar to Find Source
, but takes a dspec instead of a name as its argument.
For example, given a generic function foo
of one argument, with methods specializing on bar
and baz
,
Find Source foo
will find each method definition in turn (with the continuation via Meta+
), whereas
Find Source for Dspec (method foo (bar))
immediately finds the definition of the method on bar
.
Argument: function
Key sequence: None
Shows the results of the latest source search (initiated by Find Source or Find Source for Dspec) in the Find Definitions view of the Editor.
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.
Argument: string [ tags-file ]
Key sequence: +?
Tries to find the source code for a name containing a partial or complete match with string by examining the tags contained in the current tags buffer and opening the correct file when a match is found. The text under the current point is offered as a default value for string .
If the source code for a match with string is found, the file in which it is contained is displayed in a new buffer. When there is more than one definition, Find Tag
finds the first definition, and +,
( Continue Tags Search
) finds subsequent definitions.
The found source is displayed according to the value of editor:*source-found-action*.
If there is no current tags buffer, 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 Reference Manual for information on how to use the dpsec:*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 and Find Source for Dspec.
Argument: string [ tags-file ]
Key sequence: None
Exhaustively searches each file mentioned in the current tags buffer for string . If string is found, it is displayed in a new buffer containing the relevant file. When there is more than one definition, Tags Search
finds the first definition, and +,
( Continue Tags Search
) finds subsequent definitions.
If there is no current tags buffer, 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.
Argument: None
Key sequence: +,
Searches for the next match for the last tag-based search. This command is only applicable if issued immediately after a Find Source
, Find Tag
or Tags Search
command.
Argument: target replacement [ tags-file ]
Key sequence: None
Replaces occurrences of target string by replacement string, for each file mentioned in the current tags buffer, but only after querying the user. Each time target is found, an action must be indicated from the keyboard. For details of possible actions see Query Replace
on Query Replace.
If there is no current tags file, 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
.
Argument: file
Key sequence: None
Creates a new tags buffer containing the tag information provided by file . The default is a file called TAGS
in the current directory. The tag information contained in the new buffer is subsequently used for tag searches.