lid
: Querying an ID Database by TokenThe `lid' program accepts patterns on the command line which it matches against the tokens stored in an ID database. The interpretation of a pattern is determined by the makeup of the pattern string itself, or can be overridden by command-line options. If a pattern contains regular expression meta-characters, it is used to perform a regular-expression substring search. If no such meta-characters are present, pattern is used to perform a literal word search. (By default, all searches are sensitive to alphabetic case.) If no pattern is supplied on the command line, `lid' lists every entry in the ID database.
`lid' reads the ID database, therefore it accepts the `--file' option, and consults the `IDPATH' environment variable, as described in section Options for Programs that Read ID Databases. `lid' lists file names, therefore it accepts the `--separator' option, as described in section Options for Programs that List File Names.
In addition, lid
accepts the following command-line options:
$ lid --key=token '^dest.' destaddr libsys/memcpy.c destination libsys/regex.c destlst libsys/rx.c destpos libsys/rx.c destset libsys/rx.h libsys/rx.c $ lid --key=pattern '^dest.' ^dest. libsys/rx.h libsys/{memcpy,regex,rx}.c $ lid --key=none '^dest.' libsys/rx.h libsys/{memcpy,regex,rx}.cWhen `--key' is either `token' or `pattern', the first column of output is a token or pattern, respectively. When `--key' is `none', neither of these is printed, and the file name list begins immediately. The default is `token'.
eid
: Invoking an Editor on Query Results). When
style is `none', the file names are not processed in any way.
This can be useful if you wish to see what tokens match a pattern,
but don't care about where they reside.
..
m. Either limit of the range may be omitted (e.g.,
..
m, or n....
). If the lower limit n is
omitted, it defaults to 1
. If the upper limit is omitted, it
defaults in the present implementation to 65535
, the maximum
value of an unsigned 16-bit integer.
Particularly useful queries are `lid -F1', which helps locate
identifiers that are defined but never used, or are used but never
defined. Similarly, lid -F2
can help find functions that possess
a prototype declaration and a definition, but are never called.
Historically, the ID utilities have provided several query interfaces
which are specializations of lid
(see section lid
: Querying an ID Database by Token).
The id-utils
source distribution comes with a file `id-utils.el',
which defines a GNU Emacs interface to gid
. To install it, put
`id-utils.el' somewhere that Emacs will find it (i.e., in your
load-path
) and put
(autoload 'gid "gid" nil t)
in one of Emacs' initialization files, e.g., `~/.emacs'. You will then be able to use M-x gid to run the command.
The gid
function prompts you with the word around point. If you
want to search for something else, simply delete the line and type the
pattern of interest.
The function then runs the gid
program in a `*compilation*'
buffer, so the normal next-error
function can be used to visit
all the places the identifier is found (see section `Compilation' in The GNU Emacs Manual).
eid
: Invoking an Editor on Query Results
`lid -R edit' is an editing interface for the ID utilities that is
most commonly used with `vi'. Emacs users should use the interface
defined in id-utils.el
(see section GNU Emacs query interface). The ID
utilities include an alias called `eid', and for the sake of
brevity, we'll use this alias for the remainder of this section.
`eid' performs a `lid'-style, then asks if you wish to edit
the files. If your query yields more than one line of output, you will
be prompted after each line. This is the prompt you'll see:
Edit? [y1-9^S/nq]
You may respond with:
Here is an example:
prompt$ eid FILE \^print FILE {ansi2knr,fid,filenames,idfile,idx,lid,misc,...}.c Edit? [y1-9^S/nq] n ^print {ansi2knr,fid,getopt,getopt1,lid,mkid,regex,scanners}.c Edit? [y1-9^S/nq] 2
This will start editing at `getopt'.c.
eid
invokes the editor defined by the environment variable
`VISUAL'. If `VISUAL' is undefined, it uses the environment
variable `EDITOR' instead. If `EDITOR' is undefined, it
defaults to `vi'. It is possible for `eid' to pass the editor
an initial search pattern so that your cursor will immediately alight on
the token of interest. This feature is controlled by the following
environment variables:
vi
, this should be `+/%s/'.
eid
inserts this in
front of the matching token when a word-search is desired. For
`vi', this should be `\<'.
eid
inserts this in
end of the matching token when a word-search is desired. For
`vi', this should be `\>'.
Go to the first, previous, next, last section, table of contents.