Mu4e: improve LaTeX fragment size check

We also don't need to tell org-msg to wait for Org apparently
This commit is contained in:
TEC 2020-10-01 16:38:55 +08:00
parent d4c5c6245f
commit a80ef01b88
No known key found for this signature in database
GPG key ID: 779591AFDB81F06C
2 changed files with 8 additions and 3 deletions

View file

@ -256,6 +256,7 @@ clicked."
(format "%.1fpx" (format "%.1fpx"
(/ (string-to-number (/ (string-to-number
(shell-command-to-string (shell-command-to-string
;; TODO change to use 'file'
(format "identify -format %%w %s" (format "identify -format %%w %s"
(substring img-uri 7)))) ; 7=(length "file://") (substring img-uri 7)))) ; 7=(length "file://")
(plist-get org-format-latex-options :scale)))) (plist-get org-format-latex-options :scale))))
@ -286,7 +287,9 @@ account for the value of :scale in `org-format-latex-options'."
:class (concat "latex-fragment-" :class (concat "latex-fragment-"
(if (equal "\\(" (substring latex-frag 0 2)) (if (equal "\\(" (substring latex-frag 0 2))
"inline" "block"))))) "inline" "block")))))
(when (and (memq processing-type '(dvipng convert)) IS-LINUX) (when (and (memq processing-type '(dvipng convert))
(not IS-WINDOWS) ; relies on posix path
(executable-find "identify"))
(apply #'plist-put attributes (+org-msg-img-scale-css source))) (apply #'plist-put attributes (+org-msg-img-scale-css source)))
(org-html--format-image source attributes info))))) (org-html--format-image source attributes info)))))
(t latex-frag)))) (t latex-frag))))
@ -327,7 +330,9 @@ scales the image to account for the value of :scale in `org-format-latex-options
processing-type info))) processing-type info)))
(when (and formula-link (string-match "file:\\([^]]*\\)" formula-link)) (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link))
(let ((source (org-export-file-uri (match-string 1 formula-link)))) (let ((source (org-export-file-uri (match-string 1 formula-link))))
(when (and (memq processing-type '(dvipng convert)) IS-LINUX) (when (and (memq processing-type '(dvipng convert))
(not IS-WINDOWS) ; relies on posix path
(executable-find "identify"))
(apply #'plist-put attributes (+org-msg-img-scale-css source))) (apply #'plist-put attributes (+org-msg-img-scale-css source)))
(org-html--wrap-latex-environment (org-html--wrap-latex-environment
(org-html--format-image source attributes info) (org-html--format-image source attributes info)

View file

@ -171,7 +171,7 @@
(advice-add #'mu4e~main-action-str :override #'mu4e~main-action-prettier-str)) (advice-add #'mu4e~main-action-str :override #'mu4e~main-action-prettier-str))
(use-package! org-msg (use-package! org-msg
:after (mu4e org) :after mu4e
:when (featurep! :lang org) :when (featurep! :lang org)
:config :config
(setq org-msg-options "html-postamble:nil H:5 num:nil ^:{} toc:nil author:nil email:nil \\n:t tex:dvipng" (setq org-msg-options "html-postamble:nil H:5 num:nil ^:{} toc:nil author:nil email:nil \\n:t tex:dvipng"