diff options
author | Yuchen Pei <id@ypei.org> | 2025-02-07 09:52:11 +1100 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2025-02-07 09:52:11 +1100 |
commit | 1302f96df75f4f93247beaafee0b0a780829be18 (patch) | |
tree | 7ae569f3ce8d16d386bd02882491b0e02ff8f2af /emacs/.emacs.d/lisp/my/infobox.el | |
parent | 2f880075e7adc9c8070e5b0e606af7fbf78eaa0a (diff) |
Add follow mode. Display book cover in infobox. Render html
description in infobox.
Diffstat (limited to 'emacs/.emacs.d/lisp/my/infobox.el')
-rw-r--r-- | emacs/.emacs.d/lisp/my/infobox.el | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/emacs/.emacs.d/lisp/my/infobox.el b/emacs/.emacs.d/lisp/my/infobox.el index 9c5c7b1..2a17dc9 100644 --- a/emacs/.emacs.d/lisp/my/infobox.el +++ b/emacs/.emacs.d/lisp/my/infobox.el @@ -31,7 +31,11 @@ (cond ((stringp v) v) ((eq v t) "YES") ((eq v :json-false) "NO") - ((seqp v) (mapconcat #'identity v ", ")) + ((seqp v) + (mapconcat + (lambda (x) (if (stringp x) x (prin1-to-string x))) + v + ", ")) (t (format "%s" v)))) (defun infobox-default-specs (info) @@ -66,14 +70,15 @@ something like ;; 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) + (file-name (make-temp-name "/tmp/infobox-"))) + (url-copy-file thumb-url file-name t) (insert-image (create-image file-name nil nil - :max-width (window-width nil t))) + :max-width (window-pixel-width) + :max-height (/ (window-pixel-height) 2))) (insert "\n") - (setq n-rows (1+ n-rows))) + (setq n-rows (1+ n-rows)) + (setq info (assoc-delete-all "Thumbnail" info)) + ) (seq-do (lambda (pair) (when pair |