From 589d5daea2910facb5cde4a23f139a9db76dbcfb Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 22 Jan 2025 09:50:49 +1100 Subject: [emacs] infobox add thumbnail --- emacs/.emacs.d/init/ycp-help.el | 3 ++- emacs/.emacs.d/lisp/my/infobox.el | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init/ycp-help.el b/emacs/.emacs.d/init/ycp-help.el index 5cbbed0..98fa58c 100644 --- a/emacs/.emacs.d/init/ycp-help.el +++ b/emacs/.emacs.d/init/ycp-help.el @@ -44,7 +44,8 @@ ) (my-package info - ;; TODO consider using `Info-additional-directory-list' instead + ;; Can't `Info-additional-directory-list' - won't be used in + ;; `info-display-manual' somehow (add-to-list 'Info-directory-list (locate-user-emacs-file "info"))) (my-keybind global-map diff --git a/emacs/.emacs.d/lisp/my/infobox.el b/emacs/.emacs.d/lisp/my/infobox.el index 036cee8..5698042 100644 --- a/emacs/.emacs.d/lisp/my/infobox.el +++ b/emacs/.emacs.d/lisp/my/infobox.el @@ -63,6 +63,17 @@ something like (with-help-window "*infobox*" (with-current-buffer standard-output (let ((n-rows 0)) + ;; TODO: use a more standard function than + ;; `my-make-filename-from-url' + (when-let* ((thumb-url (alist-get "Thumbnail" info nil nil 'equal)) + (file-name (file-name-concat + "/tmp" + (my-make-filename-from-url thumb-url)))) + (url-copy-file (message thumb-url) file-name t) + (insert-image (create-image file-name nil nil + :max-width (window-width nil t))) + (insert "\n") + (setq n-rows (1+ n-rows))) (seq-do (lambda (pair) (when pair -- cgit v1.2.3