emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 4e4b76b: Make info-look try to use more recent Python manual


From: Stefan Monnier
Subject: Re: master 4e4b76b: Make info-look try to use more recent Python manual
Date: Sat, 21 Aug 2021 10:02:53 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Lars Ingebrigtsen [2021-08-13 13:46:36] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> That's what I mean by "could": provide some way for python.el to give
>> the needed info to `info-look` but without eagerly loading `info-look`.
>> E.g. by adding the info to a buffer-local var later consulted by `info-look`.
>
> Yup; that'd work.  The stuff that info-look requires, though, is
> pretty...  er...  convoluted.  Example:
>
> (info-lookup-maybe-add-help
>  :mode 'perl-mode
>  :regexp "[$@%][^a-zA-Z]\\|\\$\\^[A-Z]\\|[$@%]?[a-zA-Z][_a-zA-Z0-9]*"
>  :doc-spec '(("(perl5)Function Index"
>             (lambda (item)
>               (if (string-match "^\\([a-zA-Z0-9]+\\)" item)
>                   (match-string 1 item)))
>             "^" "\\b")
>            ("(perl5)Variable Index"
>             (lambda (item)
>               ;; Work around bad formatted array variables.
>               (let ((sym (cond ((or (string-match "^\\$\\(.\\|@@\\)$" item)
>                                     (string-match "^\\$\\^[A-Z]$" item))
>                                 item)
>                                ((string-match
>                                  "^\\([$%@]\\|@@\\)?[_a-zA-Z0-9]+" item)
>                                 (match-string 0 item))
>                                (t ""))))
>                 (if (string-match "@@" sym)
>                     (setq sym (concat (substring sym 0 (match-beginning 0))
>                                       (substring sym (1- (match-end 0))))))
>                 (if (string-equal sym "") nil sym)))
>             "^" "\\b"))
>  :parse-rule "[$@%]?\\([_a-zA-Z0-9]+\\|[^a-zA-Z]\\)")
>
> I'm not sure the maintainer for foo-mode can be expected to understand
> any of this stuff (so it's an info-look.el internal thing), but on the
> other hand, these days that doesn't make much difference.

AFAIU the maintainer of info-look is the one that's not supposed to
understand any of this, because it's supposed to encodes some lexical
conventions about Perl identifiers in Perl's info pages.

Of course it requires understanding the calling convention of
`info-lookup-maybe-add-help`.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]