Mu4e: Fix inline LaTeX image scaling

The structure of doom-call-process's return had changed.
This commit is contained in:
TEC 2021-06-24 12:23:52 +08:00
parent c9e816e995
commit a72d533a24
No known key found for this signature in database
GPG key ID: 779591AFDB81F06C

View file

@ -38,13 +38,14 @@ clicked."
(defun +org-msg-img-scale-css (img-uri) (defun +org-msg-img-scale-css (img-uri)
"For a given IMG-URI, use imagemagik to find its width." "For a given IMG-URI, use imagemagik to find its width."
(if +org-msg-currently-exporting (if +org-msg-currently-exporting
(list :width ;; TODO change to use 'file' (NB: would only work for PNG though, apparently)
(format "%.1fpx" (let ((width-call (doom-call-process "identify" "-format" "%w"
(/ (string-to-number (substring img-uri 7)))) ; 7=(length "file://")
;; TODO change to use 'file' (when (= (car width-call) 0)
(doom-call-process "identify" "-format" "%w" (list :width
(substring img-uri 7))) ; 7=(length "file://") (format "%.1fpx"
(plist-get org-format-latex-options :scale)))) (/ (string-to-number (cdr width-call))
(plist-get org-format-latex-options :scale))))))
(list :style (format "transform: scale(%.3f)" (list :style (format "transform: scale(%.3f)"
(/ 1.0 (plist-get org-format-latex-options :scale)))))) (/ 1.0 (plist-get org-format-latex-options :scale))))))