2

我在cperl-mode+中使用 Emacs 27 进行开发PDE

我正在整合我的 Perl 包并尝试在方法/子标题上方添加内联文档条目。我使用inline POD schema,因为我同时拥有快速导航和通过Imenu-Tree.

通常方法/子在源代码中不是按字母顺序排列的。所以条目Imenu-Tree按照定义的顺序出现,它们按照源代码的进化顺序出现。现在我想按字母顺序排列,以便更快地找到/导航到方法/子。我知道如何在命令或链接到源代码行 ( grep -n) 的 shell 上生成这样的列表,但不知道如何在方向上采用此列表POD-ToolsEmacs + Imenu + PDE嵌入结果。

问题:

是否有POD特定的工具或Imenu插件或设置可以像在命令行中那样按字母顺序对问题进行排序?

$ grep '=head2 METHOD' AppTK.pm | sort
=head2 METHOD checkDiskSize($path, $formatted) -> ($error, $size, $used, $avail)
=head2 METHOD checkHelpUsage($runDict, $tool, $minArgs, $exit) -> BOOL
=head2 METHOD checkRuntimeSettings ( $self, $cmdDict ) ->  ( $output, $exitFun, $cmdFun )
=head2 METHOD getRuntime ($self) -> $runDict
=head2 METHOD getRuntimeValue ( $self, $key ) -> $value|undef
=head2 METHOD getRuntimeValues($self) -> ( $tool, $output, $response, $command, $exitFun, $param )
=head2 METHOD initApplication ( $self, $version, $date, $author, $contact ) -> BOOL
=head2 METHOD initRuntime ( $self, $magic, $tool, $ioType, $param ) -> BOOL
=head2 METHOD ioAddResult ( $self, $dict, $key, $value ) -> dict
=head2 METHOD ioCreateResult ( $self, $name, $type, $data = [] ) -> $dict
=head2 METHOD listPlainToStr ( $self, $list, $sort = 0, $sep=' ', $quote="'") -> Str
=head2 METHOD outEncodeResult ( $self, $indent, $dict )
=head2 METHOD outEofMagic($self) -> BOOL
=head2 METHOD outIoDsLine($self, $ascii = 1) -> 1
=head2 METHOD outIoHeader($self) -> 1
=head2 METHOD outIoHsLine($self, $ascii = 1) -> 1
=head2 METHOD outIoResult($self, $resList, $type, $handle = undef, $fname = undef ) -> 1
=head2 METHOD outIoVersion ( $self, $program, $exit ) -> BOOL
=head2 METHOD outResultDataRecord ( $self, $strIndent, $type, $ident, $values ) -> ($error, $text)
=head2 METHOD outRunEof ( $self, $what = '' ) -> 1
=head2 METHOD outRunHeader ( $self, $what) -> 1
=head2 METHOD outRunMessage ( $self, $what, $aspect, $with = '', $pfxLen = 12 ) -> 1
=head2 METHOD outRunStreamRate( $self, $show,...) -> $lastTime
=head2 METHOD outRunWarning ( $self, $what, $aspect, $with = '', $pfxLen = 12 ) -> 1
=head2 METHOD parseCommandline ( $self, @ ) -> BOOL
=head2 METHOD setRuntimeInteractive ( $self, $cmdDict, $command ) -> BOOL
=head2 METHOD setRuntime ( $self, $cmdDict, $command ) -> BOOL
=head2 METHOD strQuotePlain($self, $item, $quote ="'") -> Str

POD 代码的传真

...

# ==================================================================

=pod

=head2 METHOD ioCreateResult ( $self, $name, $type, $data = [] ) -> $dict

Create a new dictionary to write resulting datasets produced tool by
the tool.

=over 4

=item INPUT

      $name -- name of the result set,
      $type -- DATA.RECORD|DATA.TABLE,
      $data -- an optional array reference for
               existing data
               DEFAULT: []

=item RETURNS

      A reference to a dictionary with a well defined structure.

=item TODO

      Consider a OO implementation here to be more interaction safe.

=back

=cut

sub ioCreateResult ( $self, $name, $type, $data = [] ) {
    my $res = {
        NAME => $name,
        TYPE => $type,
        DATA => $data,
    };
    return $res;
}

# ==================================================================

=pod

=head2 METHOD ioAddResult ( $self, $dict, $key, $value ) -> dict

Add a key value pair to the existing result set. Internal a
array reference with the structure [ $key, $value ] is used, so
multiple keys with the same names can occur.

=over 4

=item INPUT

      $dict  -- A dictionary created with
                ioCreateResult(...)
      $key   -- Key of the entry
      $value -- of the entry

=item RETURNS

      $dict -- the resulting dictionary

=item EXAMPLE

      my $out = $tk->ioCreateResult('DEFAULT','DATA.RECORD');
         $tk->ioAddResult($out, 'DISK.PATH',    $path);
         $tk->ioAddResult($out, 'COUNT.FILES',  $fcnt);

=back

=cut

sub ioAddResult ( $self, $dict, $key, $value ) {
    my $list = $dict->{DATA};
    push( @$list, [ $key, $value ] );
    return $dict;
}

...

4

0 回答 0