From a72d533a24f8a17a187ddb9044658e41826675e0 Mon Sep 17 00:00:00 2001 From: TEC Date: Thu, 24 Jun 2021 12:23:52 +0800 Subject: [PATCH] Mu4e: Fix inline LaTeX image scaling The structure of doom-call-process's return had changed. --- modules/email/mu4e/autoload/advice.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/email/mu4e/autoload/advice.el b/modules/email/mu4e/autoload/advice.el index 191e8e921..c5ed2fddb 100644 --- a/modules/email/mu4e/autoload/advice.el +++ b/modules/email/mu4e/autoload/advice.el @@ -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))))))