From f68c3712db729bd0a58a9cfe6097eefff32f06c7 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. (cherry picked from commit 0cca6146dc8dc2dff648dfeb7b68b56c423d90ec) --- 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 f1f730529cb..9834c6d19ba 100644 --- a/lisp/info-look.el +++ b/lisp/info-look.el @@ -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 -- 2.39.2