+\def\desc@end{\endlist\after@desc\global\let\after@desc\saved@after@desc}
+
+%% \begin{describe}[MOD]{CAT}{...}...[NAME]{SYNOPSIS}
+%% ...
+%% \end{describe}
+%%
+%% Describe some kind of program object. The CAT names the category of thing
+%% being described -- this will be shown in the header, and index. The
+%% SYNOPSIS is an implicit `prog' environment in which invoking the thing can
+%% be summarized.
+%%
+%% The {...}... are any additional arguments required by the category's kind
+%% (e.g., method specializers).
+%%
+%% The NAME is the name of the thing, which ends up in the index and
+%% cross-reference label. If omitted, it defaults to the first word of the
+%% SYNOPSIS, except that there are some special cases.
+%%
+%% The MOD is the modifier to apply. If omitted, it will usually default to
+%% `plain', but in the absence of a NAME, some kinds of synopses are
+%% recognized specially:
+%%
+%% * `setf (NAME ...) ...': selects NAME, and defaults MOD to `setf'.
+%%
+%% * `*NAME*': selects NAME, without the earmuffs, and defaults MOD to
+%% `muffs'.
+%%
+%% * `:NAME': selects NAME, withtout the colon, and defaults MOD to `kwd'.
+\def\describe{\parse@dhd\desc@}
+\def\desc@#1#2#3#4#5{\desc@begin{\dhead@{#1}{#2}{#3}{#4}{#5}}}
+\let\enddescribe\desc@end
+
+%% \begin{describe*}
+%% {\dhead[MOD]{CAT}{...}...[NAME]{SYNOPSIS}
+%% ...}
+%% ...
+%% \end{describe*}
+%%
+%% This is the fancy form of `describe' for describing several different
+%% things at once.
+\@namedef{describe*}#1{\desc@begin{#1}}
+\expandafter\let\csname enddescribe*\endcsname\desc@end
+
+%% \descref{CAT}{...}...{LABEL}[TEXT]
+%% \descref*{CAT}{...}...{LABEL}
+%%
+%% Typesets a cross-reference to a described thing. The CAT names the
+%% category of thing being described, and the LABEL names the specific thing.
+%%
+%% The {...}... are any additional arguments required by the category's kind
+%% (e.g., method specializers).
+%%
+%% The precise rules for how the LABEL matches the name in the description
+%% depend on the description's modifier:
+%%
+%% * `plain': the LABEL is the same as the NAME.
+%% * `setf': the LABEL should be `setf/NAME'.
+%% * `muffs': the LABEL should be `*NAME*', i.e., with the earmuffs
+%% restored.
+%% * `kwd: the LABEL should be `:NAME', i.e., with the colon restored.
+%%
+%% Usually a page-number cross-reference is included, so as to help readers
+%% of a dead-tree copy; this is suppressed by the `*' version.
+\def\descref{\@ifstar%
+ {\descref@i{}\@gobble{}}%
+ {\descref@i{ (}{\noexpand\autopageref}{)}}}
+\def\descref@i#1#2#3#4#5{\@ifnextchar@preserve[%
+ {\descref@ii{#1}{#2}{#3}{#4}{#5}}%
+ {\descref@iii{#1}{#2}{#3}{#4}{#5}{}}}
+\def\descref@ii#1#2#3#4#5[#6]{\descref@iii{#1}{#2}{#3}{#4}{#5}{ #6}}
+\def\descref@iii#1#2#3#4#5#6{%
+ \begingroup%
+ \let\protect\@empty%
+ \def\@uscore{-\@gobble}%
+ \edef\@tempa##1{%
+ \endgroup%
+ \noexpand\hyperref[#4:#5]%
+ ##1%
+ #2{#4:#5}%
+ }%
+ \@tempa{{\code{#5}}#6#1}#3%
+}
+
+%% Description categories.
+\definedescribecategory{sym}{symbol}
+\definedescribecategory{fun}{#1{function}}
+\definedescribecategory{gf}{generic #1{function}}
+\definedescribecategory{msg}{message}
+\definedescribecategory{var}{variable}
+\definedescribecategory{modvar}{module variable}
+\definedescribecategory{const}{constant}
+\definedescribecategory{meth}[method]{primary #1{method}}
+\definedescribecategory{ar-meth}[method]{\code{:around} #1{method}}
+\definedescribecategory{be-meth}[method]{\code{:before} #1{method}}
+\definedescribecategory{af-meth}[method]{\code{:after} #1{method}}
+\definedescribecategory{cls}{class}
+\definedescribecategory{rst}{restart}
+\definedescribecategory{ty}{type}
+\definedescribecategory{mac}{#1{macro}}
+\definedescribecategory{feat}{feature macro}
+\definedescribecategory{lmac}{local #1{macro}}
+\definedescribecategory{parse}{parser spec}
+\definedescribecategory{parseform}{parser form}
+\definedescribecategory{opt}{option handler}
+\definedescribecategory{optmac}{option macro}
+\definedescribecategory{plug}{pluggable parser}