summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2017-08-29 10:17:16 +0200
committerAlan Pearce2017-08-29 10:17:16 +0200
commit51784ea0031ab238e3c9fa6c5e18c12e2ee56225 (patch)
treebb4eb2d7c21f3891778bc7e97e1e462aac1b82ce
parenta8a9b68dca50d829c45c10803b3ed2329724726e (diff)
downloadnixfiles-51784ea0031ab238e3c9fa6c5e18c12e2ee56225.tar.lz
nixfiles-51784ea0031ab238e3c9fa6c5e18c12e2ee56225.tar.zst
nixfiles-51784ea0031ab238e3c9fa6c5e18c12e2ee56225.zip
Emacs: Load mu4e only if mu executable is present
-rw-r--r--emacs/.emacs.d/main.el95
1 files changed, 48 insertions, 47 deletions
diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el
index 17d38b1b..69f584ec 100644
--- a/emacs/.emacs.d/main.el
+++ b/emacs/.emacs.d/main.el
@@ -1368,53 +1368,54 @@
 ;; *** mu
 
 ;; #+BEGIN_SRC emacs-lisp
-(add-to-list 'load-path (expand-file-name
-                         "../share/emacs/site-lisp/mu4e"
-                         (f-dirname
-                          (file-truename
-                           (executable-find "mu")))))
-(use-package mu4e
-  :config
-  (setq mu4e-use-fancy-chars nil
-        mu4e-attachment-dir "~/Downloads/"
-        mu4e-view-show-images t
-        mu4e-headers-date-format "%Y-%m-%d %H:%M"
-
-        mu4e-maildir (expand-file-name "~/mail/alanpearce")
-        mu4e-sent-folder "/Sent"
-        mu4e-drafts-folder "/Drafts"
-        mu4e-refile-folder "/Archive"
-        mu4e-trash-folder "/Trash"
-
-        message-send-mail-function #'message-send-mail-with-sendmail
-        sendmail-program "msmtp"
-
-        mu4e-maildir-shortcuts '(("/INBOX" . ?i))
-        ;; mu4e-get-mail-command "offlineimap -o"
-        mu4e-contexts
-        (list
-         (make-mu4e-context
-          :name "Personal"
-          :match-func (lambda (msg)
-                        (when msg
-                          (mu4e-message-contact-field-matches
-                           msg :to "alan@alanpearce\..*")))
-          :vars '((user-mail-address . "alan@alanpearce.eu")))
-         (make-mu4e-context
-          :name "Work"
-          :match-func (lambda (msg)
-                        (when msg
-                          (mu4e-message-contact-field-matches
-                           msg :to "alan.*@satoshipay.io")))
-          :vars '((user-mail-address . "alan@satoshipay.io"))))
-        mu4e-user-mail-address-list (append
-                                     (delq nil
-                                           (mapcar (lambda (context)
-                                                     (when (mu4e-context-vars context)
-                                                       (cdr (assq 'user-mail-address (mu4e-context-vars context)))))
-                                                   mu4e-contexts))
-                                     '("alan@alanpearce.uk"
-                                       "alan@alanpearce.co.uk"))))
+(when (executable-find "mu")
+  (add-to-list 'load-path (expand-file-name
+                           "../share/emacs/site-lisp/mu4e"
+                           (f-dirname
+                            (file-truename
+                             (executable-find "mu")))))
+  (use-package mu4e
+    :config
+    (setq mu4e-use-fancy-chars nil
+          mu4e-attachment-dir "~/Downloads/"
+          mu4e-view-show-images t
+          mu4e-headers-date-format "%Y-%m-%d %H:%M"
+
+          mu4e-maildir (expand-file-name "~/mail/alanpearce")
+          mu4e-sent-folder "/Sent"
+          mu4e-drafts-folder "/Drafts"
+          mu4e-refile-folder "/Archive"
+          mu4e-trash-folder "/Trash"
+
+          message-send-mail-function #'message-send-mail-with-sendmail
+          sendmail-program "msmtp"
+
+          mu4e-maildir-shortcuts '(("/INBOX" . ?i))
+          ;; mu4e-get-mail-command "offlineimap -o"
+          mu4e-contexts
+          (list
+           (make-mu4e-context
+            :name "Personal"
+            :match-func (lambda (msg)
+                          (when msg
+                            (mu4e-message-contact-field-matches
+                             msg :to "alan@alanpearce\..*")))
+            :vars '((user-mail-address . "alan@alanpearce.eu")))
+           (make-mu4e-context
+            :name "Work"
+            :match-func (lambda (msg)
+                          (when msg
+                            (mu4e-message-contact-field-matches
+                             msg :to "alan.*@satoshipay.io")))
+            :vars '((user-mail-address . "alan@satoshipay.io"))))
+          mu4e-user-mail-address-list (append
+                                       (delq nil
+                                             (mapcar (lambda (context)
+                                                       (when (mu4e-context-vars context)
+                                                         (cdr (assq 'user-mail-address (mu4e-context-vars context)))))
+                                                     mu4e-contexts))
+                                       '("alan@alanpearce.uk"
+                                         "alan@alanpearce.co.uk")))))
 ;; #+END_SRC
 
 ;; *** BBDB