aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my/infobox.el
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/.emacs.d/lisp/my/infobox.el')
-rw-r--r--emacs/.emacs.d/lisp/my/infobox.el23
1 files changed, 14 insertions, 9 deletions
diff --git a/emacs/.emacs.d/lisp/my/infobox.el b/emacs/.emacs.d/lisp/my/infobox.el
index 5698042..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
@@ -113,8 +118,8 @@ something like
(end-of-line)
(insert " -- " (buttonize
"xdg-open"
- (lambda (_)
- (call-process "xdg-open" nil 0 nil filename))))
+ (lambda (_) (call-process "xdg-open" nil 0 nil filename)))
+ " " (buttonize "find-file" (lambda (_) (find-file filename))))
(buffer-string))
`(infobox-exiftool ,filename)
(called-interactively-p 'interactive)