2.2 Navigation
Sepia provides several commands for navigating program source. All of
them rely on information from the inferior Perl process, so it is
important both that it be running, and that its internal representation
of the program match the program source. The commands marked (Xref)
below also rely on a cross-reference database, which must be explicitly
rebuilt by calling xref-rebuild
when the program changes.
There are two basic kinds of navigation commands. The first kind jumps
directly to the first matching location when possible, prompting only if
no such location is found. These commands find only a single location.
- M-. M-.
- M-x sepia-dwim
- Guess what kind of identifier is at point, and try to do the right
thing: for a function, find its definition(s); for a variable, find its
uses; for a module, view its documentation; otherwise, prompt for the
name of a function to visit.
sepia-dwim
automatically goes to
the first function definition or variable use found.
- M-. l
- M-x sepia-location
- Jump directly to the definition of the function at point, prompting if
point is not on a known function. If multiple definitions are found,
choose one arbitrarily. This function is similar to
sepia-defs
,
and the two should probably be merged.
- M-. j
- M-x sepia-jump-to-symbol
- Navigate to a function using “ido” interactive completion. Within
interactive completion, press <:> to descend into a package,
<DEL> to ascend to a parent package, and <RET> to go to the
currently-selected function.
The second kind of navigation commands always prompts the user – though
usually with a sensible default value – and finds multiple locations.
When called with a prefix argument, these commands present their results
in a grep-mode
buffer. When called without a prefix
argument, they place all results on the found-location ring and jump
directly to the first. The remaining locations can be cycled through by
calls to sepia-next
.
- M-. f name <RET>
- M-x sepia-defs
- Find definition(s) of function name.
- M-. m name <RET>
- M-x sepia-module-find name <RET>
- Find the source of module name.
- M-. a regexp <RET>
- M-x sepia-apropos regexp <RET>
- Find definitions of all functions whose names match regexp.
- M-. c name <RET>
- M-x sepia-callers name <RET>
- (Xref) Find calls to function name.
- M-. C name <RET>
- M-x sepia-callees name <RET>
- (Xref) Find the definitions of functions called by name.
- M-. v name <RET>
- M-x sepia-var-uses name <RET>
- (Xref) Find uses of the global variable name.
- M-. V name <RET>
- M-x sepia-var-defs name <RET>
- (Xref) Find definitions of global variable name. Since Perl's
global variables are not declared, this is rarely useful
Finally, there are several other navigation-related commands that do not
fit into either of the above categories.
- M-,
- M-x sepia-next
- Cycle through the definitions found by the previous <M-.> search.
- M-. r
- M-x sepia-rebuild
- Rebuild the cross-reference database by walking the op-tree and
stashes.
- M-. t
- M-x find-tag
- Execute the
find-tag
command typically bound to <M-.>.