From 6ee71e1525271d60c8f577bbdd9d91bb0ae14389 Mon Sep 17 00:00:00 2001 From: Peng Li Date: Thu, 15 Sep 2016 00:19:09 +0800 Subject: [PATCH] emacs - mu4e basic config --- emacs.d/config.org | 120 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 81 insertions(+), 39 deletions(-) diff --git a/emacs.d/config.org b/emacs.d/config.org index 4512ea7..9150bb0 100644 --- a/emacs.d/config.org +++ b/emacs.d/config.org @@ -2417,55 +2417,97 @@ See [[https://www.emacswiki.org/emacs/GnusWindowLayout][GnusWindowLayout]] #+END_SRC * Mu4e -** install +Refer [[http://www.kirang.in/2014/11/13/emacs-as-email-client-with-offlineimap-and-mu4e-on-osx][emacs-as-email-client-with-offlineimap-and-mu4e-on-osx]] + +** OfflineImap - download all mails from IMAP into local directory, and keep in sync #+BEGIN_SRC sh :results output replace + # offline-imap brew install offline-imap cp /usr/local/etc/offlineimap.conf ~/.offlineimapr -#+END_SRC - -* Gnu Plot -Install =gnuplot= on Mac -#+BEGIN_SRC sh - brew install gnuplot --with-qt -#+END_SRC -To fix some issue that =toolbar-make-button-list= is void, see the [[https://github.com/bruceravel/gnuplot-mode/issues/31][issue]], here I set some variable as =nil= -#+BEGIN_SRC emacs-lisp :tangle yes :results silent - (use-package gnuplot - :ensure - :init - (setq gnuplot-help-xpm nil) - (setq gnuplot-line-xpm nil) - (setq gnuplot-region-xpm nil) - (setq gnuplot-buffer-xpm nil) - (setq gnuplot-doc-xpm nil)) + #For the =offlineimap= config on mac, using =sslcacertfile= instead of =cert_fingerpring=. On Mac + sslcacertfile = /usr/local/etc/openssl/cert.pem #+END_SRC -Use =gnuplot= on =Org-mode= file, see [[http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-gnuplot.html][ob-doc-gnuplot]] -#+BEGIN_SRC gnuplot :exports code :file ./temp/file.png - reset +Then, run =offlineimap= to sync the mail - set title "Putting it All Together" - - set xlabel "X" - set xrange [-8:8] - set xtics -8,2,8 - - - set ylabel "Y" - set yrange [-20:70] - set ytics -20,10,70 - - f(x) = x**2 - g(x) = x**3 - h(x) = 10*sqrt(abs(x)) - - plot f(x) w lp lw 1, g(x) w p lw 2, h(x) w l lw 3 +** Mu - fast search, view mails and extract attachments. +#+BEGIN_SRC sh + EMACS=/usr/local/bin/emacs brew install mu --with-emacs +#+END_SRC + +Then, run =mu index --maildir=~/.Mail= + +** Mu4e - Emacs frontend of Mu +config from [[http://www.kirang.in/2014/11/13/emacs-as-email-client-with-offlineimap-and-mu4e-on-osx/][emacs-as-email-client-with-offlineimap-and-mu4e-on-osx]] +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (require 'mu4e) + (setq mu4e-maildir "~/.Mail") + (setq mu4e-drafts-folder "/[Gmail].Drafts") + (setq mu4e-sent-folder "/[Gmail].Sent Mail") + ;; don't save message to Sent Messages, Gmail/IMAP takes care of this + (setq mu4e-sent-messages-behavior 'delete) + ;; allow for updating mail using 'U' in the main view: + (setq mu4e-get-mail-command "offlineimap") + + ;; shortcuts + (setq mu4e-maildir-shortcuts + '( ("/INBOX" . ?i) + ("/[Gmail].Sent Mail" . ?s))) + + ;; something about ourselves + (setq + user-mail-address "seudut@gmail.com" + user-full-name "Peng Li" + mu4e-compose-signature + (concat + "Thanks,\n" + "Peng\n")) + + ;; show images + (setq mu4e-show-images t) + + ;; use imagemagick, if available + (when (fboundp 'imagemagick-register-types) + (imagemagick-register-types)) + + ;; convert html emails properly + ;; Possible options: + ;; - html2text -utf8 -width 72 + ;; - textutil -stdin -format html -convert txt -stdout + ;; - html2markdown | grep -v ' _place_holder;' (Requires html2text pypi) + ;; - w3m -dump -cols 80 -T text/html + ;; - view in browser (provided below) + (setq mu4e-html2text-command "textutil -stdin -format html -convert txt -stdout") + + ;; spell check + (add-hook 'mu4e-compose-mode-hook + (defun my-do-compose-stuff () + "My settings for message composition." + (set-fill-column 72) + (flyspell-mode))) + + ;; add option to view html message in a browser + ;; `aV` in view to activate + (add-to-list 'mu4e-view-actions + '("ViewInBrowser" . mu4e-action-view-in-browser) t) + + ;; fetch mail every 10 mins + (setq mu4e-update-interval 600) +#+END_SRC + +** Smtp - send mail +- =gnutls=, depends on =gnutls=, first confirm this is installed, otherwise, =brew install gnutls= +- =~/.authinfo= +#+BEGIN_SRC fundamental + machine smtp.gmail.com login password +#+END_SRC +- OPTIONAL, encrypt the =~/.authinfo= file +#+BEGIN_SRC sh :results output replace + gpg --output ~/.authinfo.gpg --symmetric ~/.authinfo #+END_SRC -#+RESULTS: -[[file:./temp/file.png]] * Ediff #+BEGIN_SRC emacs-lisp :tangle yes :results silent (with-eval-after-load 'ediff -- 2.11.0