summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2017-09-01 15:02:44 +0200
committerAlan Pearce2017-09-01 15:02:44 +0200
commit1b0608b3999f0c0349a14cfc9227db4501110f83 (patch)
tree3af6928a4a372e75bdb2a66f599a92215d424d85
parentc9a0183d78fa568720a5da6af892ed42003ee65c (diff)
downloadnixfiles-1b0608b3999f0c0349a14cfc9227db4501110f83.tar.lz
nixfiles-1b0608b3999f0c0349a14cfc9227db4501110f83.tar.zst
nixfiles-1b0608b3999f0c0349a14cfc9227db4501110f83.zip
Emacs: Set shr-like keybindings in mu4e
-rw-r--r--emacs/.emacs.d/main.el140
1 files changed, 72 insertions, 68 deletions
diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el
index 7c636573..eb8259ed 100644
--- a/emacs/.emacs.d/main.el
+++ b/emacs/.emacs.d/main.el
@@ -1371,74 +1371,78 @@
                             (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-mu-home (expand-file-name "~/.cache/mu/alanpearce.eu")
-          mu4e-maildir (expand-file-name "~/mail/personal/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-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")
-                    (mu4e-maildir . ,(expand-file-name "~/mail/personal/alanpearce"))
-                    (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/alanpearce.eu"))
-                    (mu4e-sent-messages-behavior . sent)
-                    (mu4e-sent-folder . "/Sent")
-                    (mu4e-drafts-folder . "/Drafts")
-                    (mu4e-refile-folder . "/Archive")
-                    (mu4e-trash-folder . "/Trash")))
-           (make-mu4e-context
-            :name "Riseup"
-            :match-func (lambda (msg)
-                          (when msg
-                            (mu4e-message-contact-field-matches
-                             msg :to "alanpearce@riseup.net")))
-            :vars `((user-mail-address . "alanpearce@riseup.net")
-                    (mu4e-maildir . ,(expand-file-name "~/mail/personal/riseup"))
-                    (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/riseup.net"))
-                    (mu4e-sent-messages-behavior . sent)
-                    (mu4e-sent-folder . "/Sent")
-                    (mu4e-drafts-folder . "/Drafts")
-                    (mu4e-refile-folder . "/Archive")
-                    (mu4e-trash-folder . "/Trash")))
-           (make-mu4e-context
-            :name "Satoshipay"
-            :match-func (lambda (msg)
-                          (when msg
-                            (mu4e-message-contact-field-matches
-                             msg :to "alan@satoshipay.io")))
-            :vars `((user-mail-address . "alan@satoshipay.io")
-                    (mu4e-maildir . ,(expand-file-name "~/mail/satoshipay"))
-                    (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/satoshipay.io"))
-                    (mu4e-sent-messages-behavior . sent)
-                    (mu4e-drafts-folder . "/[Gmail].Drafts")
-                    (mu4e-sent-folder .   "/[Gmail].Sent Mail")
-                    (mu4e-trash-folder .  "/[Gmail].Bin"))))
-          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")))))
+    :config (progn
+              (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-mu-home (expand-file-name "~/.cache/mu/alanpearce.eu")
+                    mu4e-maildir (expand-file-name "~/mail/personal/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-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")
+                              (mu4e-maildir . ,(expand-file-name "~/mail/personal/alanpearce"))
+                              (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/alanpearce.eu"))
+                              (mu4e-sent-messages-behavior . sent)
+                              (mu4e-sent-folder . "/Sent")
+                              (mu4e-drafts-folder . "/Drafts")
+                              (mu4e-refile-folder . "/Archive")
+                              (mu4e-trash-folder . "/Trash")))
+                     (make-mu4e-context
+                      :name "Riseup"
+                      :match-func (lambda (msg)
+                                    (when msg
+                                      (mu4e-message-contact-field-matches
+                                       msg :to "alanpearce@riseup.net")))
+                      :vars `((user-mail-address . "alanpearce@riseup.net")
+                              (mu4e-maildir . ,(expand-file-name "~/mail/personal/riseup"))
+                              (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/riseup.net"))
+                              (mu4e-sent-messages-behavior . sent)
+                              (mu4e-sent-folder . "/Sent")
+                              (mu4e-drafts-folder . "/Drafts")
+                              (mu4e-refile-folder . "/Archive")
+                              (mu4e-trash-folder . "/Trash")))
+                     (make-mu4e-context
+                      :name "Satoshipay"
+                      :match-func (lambda (msg)
+                                    (when msg
+                                      (mu4e-message-contact-field-matches
+                                       msg :to "alan@satoshipay.io")))
+                      :vars `((user-mail-address . "alan@satoshipay.io")
+                              (mu4e-maildir . ,(expand-file-name "~/mail/satoshipay"))
+                              (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/satoshipay.io"))
+                              (mu4e-sent-messages-behavior . sent)
+                              (mu4e-drafts-folder . "/[Gmail].Drafts")
+                              (mu4e-sent-folder .   "/[Gmail].Sent Mail")
+                              (mu4e-trash-folder .  "/[Gmail].Bin"))))
+                    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")))
+           (define-hook-helper mu4e-view-mode ()
+             ;; try to emulate some of the eww key-bindings
+             (local-set-key (kbd "<tab>") 'shr-next-link)
+             (local-set-key (kbd "<backtab>") 'shr-previous-link)))))
 ;; #+END_SRC
 
 ;; ** Misc