1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-14 15:30:29 -08:00

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.
This commit is contained in:
Stefan Kangas 2024-10-05 00:17:58 +02:00
parent 776ca54e8d
commit 0cca6146dc

View file

@ -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