unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 4e4b76b: Make info-look try to use more recent Python manual
       [not found] ` <20210812152044.4811020997@vcs0.savannah.gnu.org>
@ 2021-08-12 16:20   ` Stefan Monnier
  2021-08-12 16:24     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2021-08-12 16:20 UTC (permalink / raw)
  To: emacs-devel; +Cc: Lars Ingebrigtsen

Lars Ingebrigtsen [2021-08-12 11:20:43] wrote:

> branch: master
> commit 4e4b76b094105d704933a94c95c2d4c0af6549b9
> Author: Lars Ingebrigtsen <larsi@gnus.org>
> Commit: Lars Ingebrigtsen <larsi@gnus.org>
>
>     Make info-look try to use more recent Python manual
>     
>     * lisp/info-look.el: Use the Debian-installed python3.9 manual if
>     it exists (bug#31405).
> ---
>  lisp/info-look.el | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/info-look.el b/lisp/info-look.el
> index 72de0a4..72db4f0 100644
> --- a/lisp/info-look.el
> +++ b/lisp/info-look.el
> @@ -902,7 +902,9 @@ Return nil if there is nothing appropriate in the buffer near point."
>  
>  (info-lookup-maybe-add-help
>   :mode 'python-mode
> - :doc-spec '(("(python)Index")))
> + :doc-spec `((,(if (Info-find-file "(python3.9)Index" t)
> +                   "(python3.9)Index"
> +                 "(python)Index"))))

WIBNI we could move this setting to python.el?


        Stefan




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: master 4e4b76b: Make info-look try to use more recent Python manual
  2021-08-12 16:20   ` master 4e4b76b: Make info-look try to use more recent Python manual Stefan Monnier
@ 2021-08-12 16:24     ` Lars Ingebrigtsen
  2021-08-12 16:56       ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-12 16:24 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> WIBNI we could move this setting to python.el?

It would indeed, but all the other `info-lookup-maybe-add-help' are in
info-look.el.  We could move all of them to their modes, but then all
modes would be loading info-look.el, and (I'm guessing) not that many
people use it, so they'd be taking a performance impact.

(Unless we reimplement `info-lookup-maybe-add-help' to be trivial, and
not actually parse anything until we actually use info-lookup.)

So there we are, as we often are when integrating two packages...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: master 4e4b76b: Make info-look try to use more recent Python manual
  2021-08-12 16:24     ` Lars Ingebrigtsen
@ 2021-08-12 16:56       ` Stefan Monnier
  2021-08-13 11:46         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2021-08-12 16:56 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Lars Ingebrigtsen [2021-08-12 18:24:58] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> WIBNI we could move this setting to python.el?
> It would indeed, but all the other `info-lookup-maybe-add-help' are in
> info-look.el.  We could move all of them to their modes, but then all
> modes would be loading info-look.el, and (I'm guessing) not that many
> people use it, so they'd be taking a performance impact.

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`.


        Stefan




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: master 4e4b76b: Make info-look try to use more recent Python manual
  2021-08-12 16:56       ` Stefan Monnier
@ 2021-08-13 11:46         ` Lars Ingebrigtsen
  2021-08-21 14:02           ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-13 11:46 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

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.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: master 4e4b76b: Make info-look try to use more recent Python manual
  2021-08-13 11:46         ` Lars Ingebrigtsen
@ 2021-08-21 14:02           ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2021-08-21 14:02 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

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




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-21 14:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210812152043.24248.62809@vcs0.savannah.gnu.org>
     [not found] ` <20210812152044.4811020997@vcs0.savannah.gnu.org>
2021-08-12 16:20   ` master 4e4b76b: Make info-look try to use more recent Python manual Stefan Monnier
2021-08-12 16:24     ` Lars Ingebrigtsen
2021-08-12 16:56       ` Stefan Monnier
2021-08-13 11:46         ` Lars Ingebrigtsen
2021-08-21 14:02           ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).