diff options
| author | Stefan Kangas | 2024-10-05 00:17:58 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2024-10-05 00:21:42 +0200 |
| commit | 0cca6146dc8dc2dff648dfeb7b68b56c423d90ec (patch) | |
| tree | 1d347c8e26eafadd2f19ca43bb2689f94a7674a3 | |
| parent | 776ca54e8debe035786a14a560eac27df8d1643c (diff) | |
| download | emacs-0cca6146dc8dc2dff648dfeb7b68b56c423d90ec.tar.gz emacs-0cca6146dc8dc2dff648dfeb7b68b56c423d90ec.zip | |
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.
| -rw-r--r-- | lisp/info-look.el | 19 |
1 files 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." | |||
| 973 | :mode 'python-mode | 973 | :mode 'python-mode |
| 974 | ;; Debian includes Python info files, but they're version-named | 974 | ;; Debian includes Python info files, but they're version-named |
| 975 | ;; instead of having a symlink. | 975 | ;; instead of having a symlink. |
| 976 | :doc-spec-function (lambda () | 976 | :doc-spec-function |
| 977 | (list | 977 | (lambda () |
| 978 | (list | 978 | ;; Python is released annually (PEP 602). |
| 979 | (cl-loop for version from 20 downto 7 | 979 | (let ((yy (- (decoded-time-year (decode-time (current-time))) 2000))) |
| 980 | for name = (format "python3.%d" version) | 980 | (list |
| 981 | if (Info-find-file name t) | 981 | (list |
| 982 | return (format "(%s)Index" name) | 982 | (cl-loop for version from yy downto 7 |
| 983 | finally return "(python)Index"))))) | 983 | for name = (format "python3.%d" version) |
| 984 | if (Info-find-file name t) | ||
| 985 | return (format "(%s)Index" name) | ||
| 986 | finally return "(python)Index")))))) | ||
| 984 | 987 | ||
| 985 | (info-lookup-maybe-add-help | 988 | (info-lookup-maybe-add-help |
| 986 | :mode 'perl-mode | 989 | :mode 'perl-mode |