Mu4e: Tidy up org-msg use-package statement

reduce unnecessary nesting
This commit is contained in:
TEC 2020-10-01 01:56:45 +08:00
parent a974db04c4
commit d4c5c6245f
No known key found for this signature in database
GPG key ID: 779591AFDB81F06C

View file

@ -170,154 +170,154 @@
(advice-add #'mu4e~main-action-str :override #'mu4e~main-action-prettier-str)) (advice-add #'mu4e~main-action-str :override #'mu4e~main-action-prettier-str))
(when (featurep! :lang org) (use-package! org-msg
(use-package! org-msg :after (mu4e org)
:after (mu4e 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"
org-msg-startup "hidestars indent inlineimages" org-msg-startup "hidestars indent inlineimages"
org-msg-greeting-fmt "\nHi %s,\n\n" org-msg-greeting-fmt "\nHi %s,\n\n"
org-msg-greeting-name-limit 3 org-msg-greeting-name-limit 3
org-msg-text-plain-alternative t) org-msg-text-plain-alternative t)
(defvar org-msg-currently-exporting nil (defvar org-msg-currently-exporting nil
"Helper variable to indicate whether org-msg is currently exporting the org buffer to HTML. "Helper variable to indicate whether org-msg is currently exporting the org buffer to HTML.
Usefull for affecting HTML export config.") Usefull for affecting HTML export config.")
(defadvice! org-msg--now-exporting (&rest _) (defadvice! org-msg--now-exporting (&rest _)
:before #'org-msg-org-to-xml :before #'org-msg-org-to-xml
(setq org-msg-currently-exporting t)) (setq org-msg-currently-exporting t))
(defadvice! org-msg--not-exporting (&rest _) (defadvice! org-msg--not-exporting (&rest _)
:after #'org-msg-org-to-xml :after #'org-msg-org-to-xml
(setq org-msg-currently-exporting nil)) (setq org-msg-currently-exporting nil))
(advice-add #'org-html-latex-fragment :override #'org-html-latex-fragment-scaled) (advice-add #'org-html-latex-fragment :override #'org-html-latex-fragment-scaled)
(advice-add #'org-html-latex-environment :override #'org-html-latex-environment-scaled) (advice-add #'org-html-latex-environment :override #'org-html-latex-environment-scaled)
(defvar mu4e-compose--org-msg-toggle-next t ; t to initialise org-msg (defvar mu4e-compose--org-msg-toggle-next t ; t to initialise org-msg
"Whether to toggle ") "Whether to toggle ")
(defun mu4e-compose-org-msg-handle-toggle (toggle-p) (defun mu4e-compose-org-msg-handle-toggle (toggle-p)
(when (xor toggle-p mu4e-compose--org-msg-toggle-next) (when (xor toggle-p mu4e-compose--org-msg-toggle-next)
(org-msg-mode (if org-msg-mode -1 1)) (org-msg-mode (if org-msg-mode -1 1))
(setq mu4e-compose--org-msg-toggle-next (setq mu4e-compose--org-msg-toggle-next
(not mu4e-compose--org-msg-toggle-next)))) (not mu4e-compose--org-msg-toggle-next))))
(defadvice! mu4e-maybe-toggle-org-msg (orig-fn toggle-p) (defadvice! mu4e-maybe-toggle-org-msg (orig-fn toggle-p)
:around #'mu4e-compose-new :around #'mu4e-compose-new
:around #'mu4e-compose-reply :around #'mu4e-compose-reply
(interactive "p") (interactive "p")
(mu4e-compose-org-msg-handle-toggle (/= 1 toggle-p)) (mu4e-compose-org-msg-handle-toggle (/= 1 toggle-p))
(funcall orig-fn)) (funcall orig-fn))
(defvar +org-msg-accent-color "#c01c28" (defvar +org-msg-accent-color "#c01c28"
"Accent color to use in org-msg's generated CSS. "Accent color to use in org-msg's generated CSS.
Must be set before org-msg is loaded to take effect.") Must be set before org-msg is loaded to take effect.")
(setq org-msg-enforce-css (setq org-msg-enforce-css
(let* ((font-family '(font-family . "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell,\ (let* ((font-family '(font-family . "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell,\
\"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";")) \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";"))
(monospace-font '(font-family . "SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;")) (monospace-font '(font-family . "SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;"))
(font-size '(font-size . "11pt")) (font-size '(font-size . "11pt"))
(font `(,font-family ,font-size)) (font `(,font-family ,font-size))
(line-height '(line-height . "1.2")) (line-height '(line-height . "1.2"))
(theme-color +org-msg-accent-color) (theme-color +org-msg-accent-color)
(bold '(font-weight . "bold")) (bold '(font-weight . "bold"))
(color `(color . ,theme-color)) (color `(color . ,theme-color))
(table `((margin-top . "6px") (margin-bottom . "6px") (table `((margin-top . "6px") (margin-bottom . "6px")
(border-left . "none") (border-right . "none") (border-left . "none") (border-right . "none")
(border-top . "2px solid #222222") (border-top . "2px solid #222222")
(border-bottom . "2px solid #222222") (border-bottom . "2px solid #222222")
)) ))
(ftl-number `(,color ,bold (text-align . "left"))) (ftl-number `(,color ,bold (text-align . "left")))
(inline-modes '(asl c c++ conf cpp csv diff ditaa emacs-lisp (inline-modes '(asl c c++ conf cpp csv diff ditaa emacs-lisp
fundamental ini json makefile man org plantuml fundamental ini json makefile man org plantuml
python sh xml)) python sh xml))
(inline-src `((background-color . "rgba(27,31,35,.05)") (inline-src `((background-color . "rgba(27,31,35,.05)")
(border-radius . "3px") (border-radius . "3px")
(padding . ".2em .4em") (padding . ".2em .4em")
(font-size . "90%") ,monospace-font (font-size . "90%") ,monospace-font
(margin . 0))) (margin . 0)))
(code-src (code-src
(mapcar (lambda (mode) (mapcar (lambda (mode)
`(code ,(intern (concat "src src-" (symbol-name mode))) `(code ,(intern (concat "src src-" (symbol-name mode)))
,inline-src)) ,inline-src))
inline-modes))) inline-modes)))
`((del nil ((color . "grey") (border-left . "none") `((del nil ((color . "grey") (border-left . "none")
(text-decoration . "line-through") (margin-bottom . "0px") (text-decoration . "line-through") (margin-bottom . "0px")
(margin-top . "10px") (line-height . "11pt"))) (margin-top . "10px") (line-height . "11pt")))
(a nil (,color)) (a nil (,color))
(a reply-header ((color . "black") (text-decoration . "none"))) (a reply-header ((color . "black") (text-decoration . "none")))
(div reply-header ((padding . "3.0pt 0in 0in 0in") (div reply-header ((padding . "3.0pt 0in 0in 0in")
(border-top . "solid #e1e1e1 1.0pt") (border-top . "solid #e1e1e1 1.0pt")
(margin-bottom . "20px"))) (margin-bottom . "20px")))
(span underline ((text-decoration . "underline"))) (span underline ((text-decoration . "underline")))
(li nil (,line-height (margin-bottom . "0px") (li nil (,line-height (margin-bottom . "0px")
(margin-top . "2px"))) (margin-top . "2px")))
(nil org-ul ((list-style-type . "square"))) (nil org-ul ((list-style-type . "square")))
(nil org-ol (,@font ,line-height (margin-bottom . "0px") (nil org-ol (,@font ,line-height (margin-bottom . "0px")
(margin-top . "0px") (margin-left . "30px") (margin-top . "0px") (margin-left . "30px")
(padding-top . "0px") (padding-left . "5px"))) (padding-top . "0px") (padding-left . "5px")))
(nil signature (,@font (margin-bottom . "20px"))) (nil signature (,@font (margin-bottom . "20px")))
(blockquote nil ((padding . "2px 12px") (margin-left . "10px") (blockquote nil ((padding . "2px 12px") (margin-left . "10px")
(margin-top . "10px") (margin-bottom . "0") (margin-top . "10px") (margin-bottom . "0")
(border-left . "3px solid #ccc") (border-left . "3px solid #ccc")
(font-style . "italic") (font-style . "italic")
(background . "#f9f9f9"))) (background . "#f9f9f9")))
(p blockquote ((margin . "0") (padding . "4px 0"))) (p blockquote ((margin . "0") (padding . "4px 0")))
(code nil (,font-size ,monospace-font (background . "#f9f9f9"))) (code nil (,font-size ,monospace-font (background . "#f9f9f9")))
,@code-src ,@code-src
(nil linenr ((padding-right . "1em") (nil linenr ((padding-right . "1em")
(color . "black") (color . "black")
(background-color . "#aaaaaa"))) (background-color . "#aaaaaa")))
(pre nil ((line-height . "1.2") (pre nil ((line-height . "1.2")
(color . ,(doom-color 'fg)) (color . ,(doom-color 'fg))
(background-color . ,(doom-color 'bg)) (background-color . ,(doom-color 'bg))
(margin . "4px 0px 8px 0px") (margin . "4px 0px 8px 0px")
(padding . "8px 12px") (padding . "8px 12px")
(width . "95%") (width . "95%")
(border-radius . "5px") (border-radius . "5px")
(font-weight . "500") (font-weight . "500")
,monospace-font)) ,monospace-font))
(div org-src-container ((margin-top . "10px"))) (div org-src-container ((margin-top . "10px")))
(nil figure-number ,ftl-number) (nil figure-number ,ftl-number)
(nil table-number) (nil table-number)
(caption nil ((text-align . "left") (caption nil ((text-align . "left")
(background . ,theme-color) (background . ,theme-color)
(color . "white") (color . "white")
,bold)) ,bold))
(nil t-above ((caption-side . "top"))) (nil t-above ((caption-side . "top")))
(nil t-bottom ((caption-side . "bottom"))) (nil t-bottom ((caption-side . "bottom")))
(nil listing-number ,ftl-number) (nil listing-number ,ftl-number)
(nil figure ,ftl-number) (nil figure ,ftl-number)
(nil org-src-name ,ftl-number) (nil org-src-name ,ftl-number)
(img nil ((vertical-align . "middle") (img nil ((vertical-align . "middle")
(max-width . "100%"))) (max-width . "100%")))
(img latex-fragment-inline ((margin . "0 0.1em"))) (img latex-fragment-inline ((margin . "0 0.1em")))
(table nil (,@table ,line-height (border-collapse . "collapse"))) (table nil (,@table ,line-height (border-collapse . "collapse")))
(th nil ((border . "none") (border-bottom . "1px solid #222222") (th nil ((border . "none") (border-bottom . "1px solid #222222")
(background-color . "#EDEDED") (font-weight . "500") (background-color . "#EDEDED") (font-weight . "500")
(padding . "3px 10px"))) (padding . "3px 10px")))
(td nil (,@table (padding . "1px 10px") (td nil (,@table (padding . "1px 10px")
(background-color . "#f9f9f9") (border . "none"))) (background-color . "#f9f9f9") (border . "none")))
(td org-left ((text-align . "left"))) (td org-left ((text-align . "left")))
(td org-right ((text-align . "right"))) (td org-right ((text-align . "right")))
(td org-center ((text-align . "center"))) (td org-center ((text-align . "center")))
(kbd nil ((border . "1px solid #d1d5da") (border-radius . "3px") (kbd nil ((border . "1px solid #d1d5da") (border-radius . "3px")
(box-shadow . "inset 0 -1px 0 #d1d5da") (box-shadow . "inset 0 -1px 0 #d1d5da")
(background-color . "#fafbfc") (color . "#444d56") (background-color . "#fafbfc") (color . "#444d56")
(padding . "3px 5px") (display . "inline-block"))) (padding . "3px 5px") (display . "inline-block")))
(div outline-text-4 ((margin-left . "15px"))) (div outline-text-4 ((margin-left . "15px")))
(div outline-4 ((margin-left . "10px"))) (div outline-4 ((margin-left . "10px")))
(h4 nil ((margin-bottom . "0px") (font-size . "11pt"))) (h4 nil ((margin-bottom . "0px") (font-size . "11pt")))
(h3 nil ((margin-bottom . "0px") (h3 nil ((margin-bottom . "0px")
,color (font-size . "14pt"))) ,color (font-size . "14pt")))
(h2 nil ((margin-top . "20px") (margin-bottom . "20px") (h2 nil ((margin-top . "20px") (margin-bottom . "20px")
,color (font-size . "18pt"))) ,color (font-size . "18pt")))
(h1 nil ((margin-top . "20px") (margin-bottom . "0px") (h1 nil ((margin-top . "20px") (margin-bottom . "0px")
,color (font-size . "24pt"))) ,color (font-size . "24pt")))
(p nil ((text-decoration . "none") (line-height . "11pt") (p nil ((text-decoration . "none") (line-height . "11pt")
(margin-top . "10px") (margin-bottom . "0px") (margin-top . "10px") (margin-bottom . "0px")
,font-size (max-width . "100ch"))) ,font-size (max-width . "100ch")))
(b nil ((font-weight . "500") (color . ,theme-color))) (b nil ((font-weight . "500") (color . ,theme-color)))
(div nil (,@font (line-height . "12pt")))))))) (div nil (,@font (line-height . "12pt")))))))
;; ;;