]> git.eshelyaron.com Git - emacs.git/commitdiff
Make info-look search harder for the Python info file
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 13 Aug 2021 11:38:38 +0000 (13:38 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 13 Aug 2021 11:38:38 +0000 (13:38 +0200)
* lisp/info-look.el (python-mode): Try harder to find the correct
info file (bug#31405).

lisp/info-look.el

index 19c5537e74fbe34d91756eef4d8b0b8cd7cc3251..33f15a34e997f57ac09e6fdc4a4116e1c14caf16 100644 (file)
@@ -43,6 +43,7 @@
 
 (require 'info)
 (eval-when-compile (require 'subr-x))
+(eval-when-compile (require 'cl-lib))
 
 (defgroup info-lookup nil
   "Major mode sensitive help agent."
@@ -902,9 +903,13 @@ Return nil if there is nothing appropriate in the buffer near point."
 
 (info-lookup-maybe-add-help
  :mode 'python-mode
- :doc-spec `((,(if (Info-find-file "python3.9" t)
-                   "(python3.9)Index"
-                 "(python)Index"))))
+ ;; Debian includes Python info files, but they're version-named
+ ;; instead of having a symlink.
+ :doc-spec `((,(cl-loop for version from 20 downto 7
+                        for name = (format "python3.%d" version)
+                        if (Info-find-file name t)
+                        return (format "(%s)Index" name)
+                        finally return "(python)Index"))))
 
 (info-lookup-maybe-add-help
  :mode 'cperl-mode