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