emacs-diffs
[Top][All Lists]
Advanced

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

master 0cca6146dc8 1/2: Future-proof searching for Python info manual


From: Stefan Kangas
Subject: master 0cca6146dc8 1/2: Future-proof searching for Python info manual
Date: Fri, 4 Oct 2024 18:43:18 -0400 (EDT)

branch: master
commit 0cca6146dc8dc2dff648dfeb7b68b56c423d90ec
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Future-proof searching for Python info manual
    
    * lisp/info-look.el (:mode): Python is released annually (PEP 602), so
    search for minor version based on the current year.
---
 lisp/info-look.el | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/lisp/info-look.el b/lisp/info-look.el
index 2f36e598dcd..12c017fa4fd 100644
--- a/lisp/info-look.el
+++ b/lisp/info-look.el
@@ -973,14 +973,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



reply via email to

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