Add editorial context for mu4e

master
Jacopo De Simoi 1 year ago
parent 781dd8b9e8
commit 11e0175092
  1. 131
      global.org

@ -958,61 +958,82 @@
:key ?i)) :key ?i))
#+end_src #+end_src
Customize ~mu4e~ context Customize ~mu4e~ contexts
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq mu4e-contexts
(setq mu4e-contexts `( ,(make-mu4e-context
`( ,(make-mu4e-context :name "Work"
:name "Work" :enter-func (lambda () (mu4e-message "Switch to the Work context"))
:enter-func (lambda () (mu4e-message "Switch to the Work context")) ;; no leave-func
;; no leave-func ;; we match based on the maildir of the message
;; we match based on the maildir of the message :match-func (lambda (msg)
:match-func (lambda (msg) (when msg
(when msg (string-match-p "^/math/INBOX" (mu4e-message-field
(string-match-p "^/math" (mu4e-message-field msg :maildir))))
msg :maildir)))) :vars '( ( user-mail-address . "jacopods@math.utoronto.ca" )
:vars '( ( user-mail-address . "jacopods@math.utoronto.ca" ) ( user-full-name . "Jacopo De Simoi" )
( user-full-name . "Jacopo De Simoi" ) ( mu4e-sent-folder . "/math/Sent")
( mu4e-sent-folder . "/math/Sent") ( mu4e-drafts-folder . "/math/Drafts")
( mu4e-drafts-folder . "/math/Drafts") ( mu4e-trash-folder . "/math/Trash")
( mu4e-trash-folder . "/math/Trash") ( mu4e-refile-folder . "/math/Archive")
( mu4e-refile-folder . "/math/Archive") ( smtpmail-stream-type . starttls )
( smtpmail-stream-type . starttls ) ( smtpmail-smtp-service . 587 )
( smtpmail-smtp-service . 587 ) ( mu4e-compose-signature . (concat
( mu4e-compose-signature . (concat "Jacopo De Simoi (he · him)\n"
"Jacopo De Simoi (he · him)\n" "Professor · U Toronto\n"))))
"Professor · U Toronto\n"))))))
,(make-mu4e-context
;; set `mu4e-context-policy` and `mu4e-compose-policy` to tweak when mu4e should :name "CMP Editor"
;; guess or ask the correct context, e.g. :enter-func (lambda () (mu4e-message "Switch to the CMP Editor context"))
:leave-func (lambda () (mu4e-message "Leave the CMP Editor context"))
;; start with the first (default) context; ;; we match based on the maildir of the message
;; default is to ask-if-none (ask when there's no context yet, and none match) :match-func (lambda (msg)
(setq mu4e-context-policy 'pick-first) (when msg
(string-match-p "^/math/editorial.CMP" (mu4e-message-field
;; compose with the current context is no context matches; msg :maildir))))
;; default is to ask :vars '( ( user-mail-address . "jacopods@math.utoronto.ca" )
(setq mu4e-compose-context-policy 'pick-first) ( user-full-name . "Jacopo De Simoi" )
( mu4e-sent-folder . "/math/Sent")
( mu4e-drafts-folder . "/math/Drafts")
(add-hook 'mu4e-headers-mode-hook ( mu4e-trash-folder . "/math/Trash")
#'(lambda () (setq-local show-trailing-whitespace nil))) ( mu4e-refile-folder . "/math/editorial.CMP.Archive")
(add-hook 'mu4e-view-mode-hook ( smtpmail-stream-type . starttls )
#'(lambda () (setq-local show-trailing-whitespace nil))) ( smtpmail-smtp-service . 587 )
(add-hook 'mu4e-compose-mode-hook ( mu4e-compose-signature . (concat
#'(lambda () "Jacopo De Simoi (he · him)\n"
(auto-fill-mode -1) "Associate Editor for CMP\n"
(visual-line-mode) "Professor · U Toronto\n"))))))
;; flyspell does not want to work with buffers that
;; start with a "*", but this includes compose buffers ;; set `mu4e-context-policy` and `mu4e-compose-policy` to tweak when mu4e should
;; (that are called *draft*) ;; guess or ask the correct context, e.g.
(let ((flyspell-lazy-disallow-buffers nil))
(flyspell-mode)))) ;; start with the first (default) context;
;; default is to ask-if-none (ask when there's no context yet, and none match)
(define-key-alist message-mode-map (setq mu4e-context-policy 'pick-first)
'(("M-\"" . (lambda (r-begin r-end)
(interactive "r") ;; compose with the current context is no context matches;
(add-delimiter "“" "”" r-begin r-end))))) ;; default is to ask
(setq mu4e-compose-context-policy 'pick-first)
(add-hook 'mu4e-headers-mode-hook
#'(lambda () (setq-local show-trailing-whitespace nil)))
(add-hook 'mu4e-view-mode-hook
#'(lambda () (setq-local show-trailing-whitespace nil)))
(add-hook 'mu4e-compose-mode-hook
#'(lambda ()
(auto-fill-mode -1)
(visual-line-mode)
;; flyspell does not want to work with buffers that
;; start with a "*", but this includes compose buffers
;; (that are called *draft*)
(let ((flyspell-lazy-disallow-buffers nil))
(flyspell-mode))))
(define-key-alist message-mode-map
'(("M-\"" . (lambda (r-begin r-end)
(interactive "r")
(add-delimiter "“" "”" r-begin r-end)))))
#+end_src #+end_src

Loading…
Cancel
Save