]> git.eshelyaron.com Git - emacs.git/commitdiff
Future-proof searching for Python info manual
authorStefan Kangas <stefankangas@gmail.com>
Fri, 4 Oct 2024 22:17:58 +0000 (00:17 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 6 Oct 2024 06:48:54 +0000 (08:48 +0200)
* lisp/info-look.el (:mode): Python is released annually (PEP 602), so
search for minor version based on the current year.

(cherry picked from commit 0cca6146dc8dc2dff648dfeb7b68b56c423d90ec)

lisp/info-look.el

index f1f730529cb7a9471c095a5fe083ff5184bab37c..9834c6d19ba93f2ca3acf4df4b5e5ecf46b86453 100644 (file)
@@ -974,14 +974,17 @@ Return nil if there is nothing appropriate in the buffer near point."
  :mode 'python-mode
  ;; Debian includes Python info files, but they're version-named
  ;; instead of having a symlink.
- :doc-spec-function (lambda ()
-                      (list
-                       (list
-                        (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")))))
+ :doc-spec-function
+ (lambda ()
+   ;; Python is released annually (PEP 602).
+   (let ((yy (- (decoded-time-year (decode-time (current-time))) 2000)))
+     (list
+      (list
+       (cl-loop for version from yy 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 'perl-mode