From 0cca6146dc8dc2dff648dfeb7b68b56c423d90ec Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 5 Oct 2024 00:17:58 +0200 Subject: [PATCH] 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