Add neomutt connection

This commit is contained in:
Thomas Dehaeze 2019-06-22 17:34:07 +02:00
parent efc91797d6
commit d62f7bad64

View File

@ -109,7 +109,6 @@
:PROPERTIES: :PROPERTIES:
:header-args:emacs-lisp+: :tangle ~/.spacemacs.d/user-config.el :header-args:emacs-lisp+: :tangle ~/.spacemacs.d/user-config.el
:END: :END:
** Others ** Others
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; Line Wrapping ;; Line Wrapping
@ -258,7 +257,8 @@
"#+LATEX_HEADER: \\newcommand{\\refUrl}{${url}}\n" "#+LATEX_HEADER: \\newcommand{\\refUrl}{${url}}\n"
"#+LATEX_HEADER: \\newcommand{\\refKeywords}{${keywords}}\n" "#+LATEX_HEADER: \\newcommand{\\refKeywords}{${keywords}}\n"
"#+LATEX_HEADER: \\input{config.tex}\n" "#+LATEX_HEADER: \\input{config.tex}\n"
":end:\n" "#+LATEX_HEADER: \\graphicspath{{./figs/${=key=}/}}\n"
":END:\n"
"\n" "\n"
"#+BEGIN_abstract\n" "#+BEGIN_abstract\n"
"\n" "\n"
@ -444,6 +444,7 @@ https://blog.aaronbieber.com/2016/09/24/an-agenda-for-life-with-org-mode.html
- Things reading (BOOKMARS) - Things reading (BOOKMARS)
- Things to read - Things to read
- etc... - etc...
*** Org Notification based on calendar event *** Org Notification based on calendar event
https://emacs.stackexchange.com/questions/3844/good-methods-for-setting-up-alarms-audio-visual-triggered-by-org-mode-events https://emacs.stackexchange.com/questions/3844/good-methods-for-setting-up-alarms-audio-visual-triggered-by-org-mode-events
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -1035,6 +1036,8 @@ Ressources:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(with-eval-after-load 'org (with-eval-after-load 'org
(setq org-noter-always-create-frame nil)
(setq org-noter-kill-frame-at-session-end nil)
;; Fraction of the frame that the document window will occupy when split ;; Fraction of the frame that the document window will occupy when split
(setq org-noter-doc-split-fraction '(0.6 . 0.6)) (setq org-noter-doc-split-fraction '(0.6 . 0.6))
;; Save the last visited location automatically; when starting a new session, go to that location ;; Save the last visited location automatically; when starting a new session, go to that location
@ -1102,9 +1105,9 @@ Disable automatic highlight of TODO keywords in orgmode buffers
*** Setup Matlab Mode *** Setup Matlab Mode
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq matlab-shell-command "/usr/local/bin/matlab") ;; (setq matlab-shell-command "/usr/local/bin/matlab")
(setq matlab-shell-command-switches (list "-nodesktop -nosplash")) ;; (setq matlab-shell-command-switches (list "-nodesktop -nosplash"))
(setq mlint-programs '("mlint" "/usr/local/MATLAB/R2018a/bin/glnxa64/mlint")) ;; (setq mlint-programs '("mlint" "/usr/local/matlab/r2018a/bin/glnxa64/mlint"))
#+END_SRC #+END_SRC
*** Setup Flycheck *** Setup Flycheck
@ -1125,10 +1128,10 @@ Disable automatic highlight of TODO keywords in orgmode buffers
#+END_SRC #+END_SRC
#+BEGIN_SRC emacs-lisp :tangle no #+BEGIN_SRC emacs-lisp :tangle no
(defadvice org-edit-src-code (around set-buffer-file-name activate compile) (defadvice org-edit-src-code (around set-buffer-file-name activate compile)
(let ((file-name (buffer-file-name))) ;; (1) (let ((file-name (buffer-file-name))) ;; (1)
ad-do-it ;; (2) ad-do-it ;; (2)
(setq buffer-file-name file-name))) ;; (3) (setq buffer-file-name file-name))) ;; (3)
#+END_SRC #+END_SRC
*** Setup Company - not working *** Setup Company - not working
@ -1406,3 +1409,36 @@ Org simply =C-c l= to store the link to the email and then =C-c C-l= and paste t
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(cancel-timer recentf-auto-save-timer) (cancel-timer recentf-auto-save-timer)
#+END_SRC #+END_SRC
** TODO [#C] Neomutt connection
https://mentat.za.net/blog/2018/10/31/using-org-mode-with-neomutt/
#+BEGIN_SRC emacs-lisp
(require 'org-protocol)
;; Call this function, which spawns neomutt, whenever org-mode
;; tries to open a link of the form mutt:message-id+goes_here@mail.gmail.com
(defun tdehaeze/mutt-open-message (message-id)
"In neomutt, open the email with the the given Message-ID"
(let*
((message-id (replace-regexp-in-string "^/*" "" message-id))
(mail-file
(replace-regexp-in-string
"\n$" "" (shell-command-to-string
(format "mu find -n 1 -f l i:%s" message-id))))
(mail-dir (replace-regexp-in-string "/\\(cur\\|new\\|tmp\\)/$" ""
(file-name-directory mail-file)))
(message-id-escaped (regexp-quote message-id))
(mutt-keystrokes
(format "L~i %s\n\n" (shell-quote-argument message-id-escaped)))
(mutt-command (list "neomutt" "-R" "-f" mail-dir
"-e" (format "push '%s'" mutt-keystrokes))))
(message "Launching neomutt for message %s" message-id)
(call-process "setsid" nil nil
"-f" "termite" "-e"
(concat "neomutt -R -f " mail-dir " -e \"" (format "push '%s a l'\"" mutt-keystrokes)))))
;; Hook up `message:...` style URLs
(org-add-link-type "message" 'tdehaeze/mutt-open-message)
#+end_src