unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#71314: [PATCH] info-lookup-symbol does not work in python-mode
@ 2024-06-02  0:45 James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-02  4:41 ` Eli Zaretskii
  2024-06-08 12:24 ` Eli Zaretskii
  0 siblings, 2 replies; 4+ messages in thread
From: James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-02  0:45 UTC (permalink / raw)
  To: 71314; +Cc: larsi

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

- Make sure python info docs are installed (in Debian-derivatives, 'sudo
  apt install python3-doc')
- emacs -Q
- Open a buffer test.py and type: print
- C-h S fails, even after typing RET, but...

- Then do info-lookup-reset, and the previous step works.

Here's a possible patch, which hasn't been tested as much as needed:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] Check for doc-spec-function early, in interactive --]
[-- Type: text/x-patch, Size: 1782 bytes --]

From 81b3a7b0c2be3c974729d1a4ffc44351d5393a45 Mon Sep 17 00:00:00 2001
From: James Thomas <jimjoe@gmx.net>
Date: Sun, 2 Jun 2024 05:59:35 +0530
Subject: [PATCH] Check for doc-spec-function early, in interactive

* lisp/info-look.el (info-lookup-interactive-arguments):
Move here.
(info-lookup): From here.
---
 lisp/info-look.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lisp/info-look.el b/lisp/info-look.el
index cd59fdf17d7..2baf133c7d3 100644
--- a/lisp/info-look.el
+++ b/lisp/info-look.el
@@ -327,8 +327,11 @@ info-lookup-interactive-arguments
 If optional argument QUERY is non-nil, query for the help mode."
   (let* ((mode (cond (query
 		      (info-lookup-change-mode topic))
-		     ((info-lookup->mode-value topic (info-lookup-select-mode))
-		      info-lookup-mode)
+		     ((when-let
+                          ((info (info-lookup->mode-value
+                                  topic (info-lookup-select-mode))))
+                        (info-lookup--expand-info info))
+                      info-lookup-mode)
 		     ((info-lookup-change-mode topic))))
 	 (completions (info-lookup->completions topic mode))
 	 (default (info-lookup-guess-default topic mode))
@@ -404,9 +407,6 @@ info-lookup
 different window."
   (or mode (setq mode (info-lookup-select-mode)))
   (setq mode (info-lookup--item-to-mode item mode))
-  (if-let ((info (info-lookup->mode-value topic mode)))
-      (info-lookup--expand-info info)
-    (error "No %s help available for `%s'" topic mode))
   (let* ((completions (info-lookup->completions topic mode))
          (ignore-case (info-lookup->ignore-case topic mode))
          (entry (or (assoc (if ignore-case (downcase item) item) completions)
--
2.40.1


[-- Attachment #3: Type: text/plain, Size: 4 bytes --]


--

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

* bug#71314: [PATCH] info-lookup-symbol does not work in python-mode
  2024-06-02  0:45 bug#71314: [PATCH] info-lookup-symbol does not work in python-mode James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-02  4:41 ` Eli Zaretskii
  2024-06-02 11:10   ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-08 12:24 ` Eli Zaretskii
  1 sibling, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2024-06-02  4:41 UTC (permalink / raw)
  To: James Thomas; +Cc: larsi, 71314

> Cc: larsi@gnus.org
> Date: Sun, 02 Jun 2024 06:15:48 +0530
> From:  James Thomas via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> - Make sure python info docs are installed (in Debian-derivatives, 'sudo
>   apt install python3-doc')
> - emacs -Q
> - Open a buffer test.py and type: print
> - C-h S fails, even after typing RET, but...
> 
> - Then do info-lookup-reset, and the previous step works.
> 
> Here's a possible patch, which hasn't been tested as much as needed:

Thanks, but can you also explain why the original recipe fails, and
the main idea of the fix?





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

* bug#71314: [PATCH] info-lookup-symbol does not work in python-mode
  2024-06-02  4:41 ` Eli Zaretskii
@ 2024-06-02 11:10   ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 4+ messages in thread
From: James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-02 11:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, 71314

Eli Zaretskii wrote:

>> Cc: larsi@gnus.org
>> Date: Sun, 02 Jun 2024 06:15:48 +0530
>> From:  James Thomas via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>> - Make sure python info docs are installed (in Debian-derivatives, 'sudo
>>   apt install python3-doc')
>> - emacs -Q
>> - Open a buffer test.py and type: print
>> - C-h S fails, even after typing RET, but...
>>
>> - Then do info-lookup-reset, and the previous step works.
>>
>> Here's a possible patch, which hasn't been tested as much as needed:
>
> Thanks, but can you also explain why the original recipe fails, and
> the main idea of the fix?

The problem seems to be that info-lookup-interactive-arguments sets the
cache as 'initialized' for the mode (python-mode, in this case) without
accounting for the new case of :doc-spec-function (which needs
info-lookup--expand-info to be run), so that subsequent calls don't
bother running info-lookup-setup-mode again. It could later work, for
e.g., when the initialization was marked 'undone' by calling
info-lookup-reset as I'd said above, because by that time the --expand
had been already run.

(I didn't include this explanation earlier as I'd considered the fix a
kind of POC)

--





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

* bug#71314: [PATCH] info-lookup-symbol does not work in python-mode
  2024-06-02  0:45 bug#71314: [PATCH] info-lookup-symbol does not work in python-mode James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-02  4:41 ` Eli Zaretskii
@ 2024-06-08 12:24 ` Eli Zaretskii
  1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-06-08 12:24 UTC (permalink / raw)
  To: James Thomas; +Cc: 71314-done, larsi

> Cc: larsi@gnus.org
> Date: Sun, 02 Jun 2024 06:15:48 +0530
> From:  James Thomas via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> - Make sure python info docs are installed (in Debian-derivatives, 'sudo
>   apt install python3-doc')
> - emacs -Q
> - Open a buffer test.py and type: print
> - C-h S fails, even after typing RET, but...
> 
> - Then do info-lookup-reset, and the previous step works.
> 
> Here's a possible patch, which hasn't been tested as much as needed:

Thanks, installed on master, and closing the bug.





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

end of thread, other threads:[~2024-06-08 12:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-02  0:45 bug#71314: [PATCH] info-lookup-symbol does not work in python-mode James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-02  4:41 ` Eli Zaretskii
2024-06-02 11:10   ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-08 12:24 ` Eli Zaretskii

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