summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/emacs/init.el153
1 files changed, 50 insertions, 103 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index 18c55d7..6856bce 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -1004,111 +1004,58 @@ By default, returns all jabber related buffers format."
:defer t)
(when (or is-zeus is-hermes)
- (use-package mu4e
- :straight nil
- :ensure nil
+ (use-package notmuch
+ :ensure t
+ :commands notmuch-hello
+ :bind (("C-x m" . notmuch-hello)
+ :map notmuch-hello-mode-map
+ ("U" . thanos/notmuch-update)
+ ("u" . notmuch-hello-update)
+ :map notmuch-search-mode-map
+ ("u" . notmuch-refresh-all-buffers))
+ :hook ((notmuch-hello-mode . (lambda () (display-line-numbers-mode 0)))
+ (notmuch-search-mode . (lambda () (display-line-numbers-mode 0) (emojify-mode))))
:config
- (require 'server)
- (require 'mu4e)
-
- (setf mu4e-get-mail-command "mbsync -a")
-
- ;; (when (and is-zeus (server-running-p))
- ;; (setf mu4e-update-interval (* 10 60)))
-
- (defun set-mu4e-context (context-name full-name mail-address signature)
- "Return a mu4e context named CONTEXT-NAME with :match-func matching
- folder name CONTEXT-NAME in Maildir. The context's `user-mail-address',
- `user-full-name' and `mu4e-compose-signature'`smtpmail-smpt-server' is set to MAIL-ADDRESS
- FULL-NAME SIGNATURE and SERVER respectively.
- Special folders are set to context specific folders."
- (let ((dir-name (concat "/" context-name)))
- (make-mu4e-context
- :name context-name
- ;; we match based on the maildir of the message
- :match-func
- `(lambda (msg)
- (when msg
- (string-match-p
- ,(concat "^" dir-name)
- (mu4e-message-field msg :maildir))))
- :vars
- `((user-mail-address . ,mail-address)
- (user-full-name . ,full-name)
- (mu4e-sent-folder . ,(concat dir-name "/Sent"))
- (mu4e-drafts-folder . ,(concat dir-name "/Drafts"))
- (mu4e-trash-folder . ,(concat dir-name "/Trash"))
- (mu4e-trash-folder . ,(concat dir-name "/Starred"))
- (mu4e-refile-folder . ,(concat dir-name "/Archive"))
- (mu4e-compose-signature . ,signature)))))
-
- ;;Fixing duplicate UID errors when using mbsync and mu4e
- (setf mu4e-change-filenames-when-moving t
- mu4e-maildir-shortcuts
- '(("/Fastmail/Inbox" . ?i)
- ("/Drafts" . ?d)
- ("/Sent" . ?s)
- ("/Fastmail/Emacs/dev" . ?e)
- ("/MUSofia/[Gmail]/All Mail" . ?u)
- ("/Fastmail/Guix/dev" . ?g)))
-
- (setf mu4e-contexts
- (list
- (make-mu4e-context
- :name "Public"
- :match-func
- (lambda (msg)
- (when msg
- (string-prefix-p "/Fastmail" (mu4e-message-field msg :maildir))))
- :vars '((user-mail-address . "[email protected]")
- (user-full-name . "Thanos Apollo")
- (smtpmail-smtp-server . "smtp.fastmail.com")
- (smtpmail-smtp-service . 465)
- (smtpmail-stream-type . ssl)
- (mu4e-drafts-folder . "/Drafts")
- (mu4e-sent-folder . "/Sent")
- (mu4e-refile-folder . "/Archive")
- (mu4e-trash-folder . "/Trash")))
- (make-mu4e-context
- :name "MUSofia"
- :match-func
- (lambda (msg)
- (when msg
- (string-prefix-p "/MUSofia" (mu4e-message-field msg :maildir))))
- :vars '((user-mail-address . "[email protected]")
- (user-full-name . "Thanos Apollo")
- (smtpmail-smtp-server . "smtp.gmail.com")
- (smtpmail-smtp-service . 465)
- (smtpmail-stream-type . ssl)))))
-
- (setf message-send-mail-function 'smtpmail-send-it
- mu4e-compose-signature "\nThanos Apollo\n \nhttps://thanosapollo.org\n
-62B7 58D0 F671 9938 BC09 CECA 339F 736C 3A72 0928\n"
- mu4e-compose-context-policy 'ask)
-
- (setf mu4e-view-actions
- (delete-dups
- (append
- '(("gapply git patches" . mu4e-action-git-apply-patch)
- ("mgit am patch" . mu4e-action-git-apply-mbox)
- ("bb4 am patch" . mu4e-action-git-apply-b4)
- ("ssetup reword list with b4" . mu4e-action-setup-reword-b4)
- ("crun checkpatch script" . my-mu4e-action-run-check-patch)
- ("MCheck if merged" . my-mu4e-action-check-if-merged)))))
-
- (define-minor-mode mu4e-mode
- "Fix for mu4e mode guix (undefined)."
- :global t
- :group 'mu4e
- :lighter nil
- (message "mu4e mode"))
+ (defun thanos/notmuch-update ()
+ (interactive)
+ (let ((default-directory "~/")
+ (new-buffer (generate-new-buffer "*notmuch update*"))
+ (height (max 5 (truncate (* (frame-height) 0.1))))
+ (command "mbsync -a; ./.scripts/notmuch-hook.sh"))
+ (split-window-vertically (- height))
+ (other-window 1)
+ (switch-to-buffer new-buffer)
+ (let ((proc (async-shell-command command new-buffer)))
+ (set-process-sentinel
+ (get-buffer-process new-buffer)
+ (lambda (process event)
+ (when (memq (process-status process) '(exit signal))
+ (delete-window (get-buffer-window (process-buffer process)))
+ (kill-buffer (process-buffer process))))))))
+
+ (setf notmuch-archive-tags '("-inbox" "-unread" "+archived")
+ notmuch-hello-sections '(notmuch-hello-insert-header notmuch-hello-insert-saved-searches notmuch-hello-insert-recent-searches notmuch-hello-insert-alltags notmuch-hello-insert-footer))
+
+ (setq notmuch-search-oldest-first nil)
- :bind (("C-x m" . 'mu4e))
- :hook
- ;; Sign messages
- ((message-send . 'mml-secure-message-sign-pgpmime)
- ;; Disable line numbers & autosave
- (mu4e-main-mode . (lambda () (display-line-numbers-mode -1) (auto-save-mode -1))))))
+ (setf notmuch-identities '("[email protected]" "[email protected]"
+
+ (setf notmuch-saved-searches
+ `((:name "Inbox" :query "tag:inbox" :sort-order newest-first :key ,(kbd "i"))
+ (:name "Today's message" :query "tag:inbox date:today" :sort-order newest-first
+ :key ,(kbd "t"))
+ (:name "sent" :query "tag:sent" :sort-order newest-first :key ,(kbd "s"))
+ (:name "drafts" :query "tag:draft" :sort-order newest-first :key ,(kbd "d"))
+ (:name "all mail" :query "*" :sort-order newest-first :key ,(kbd "a"))))))
+
+;; smtpmail settings
+(setf smtpmail-smtp-user "[email protected]"
+ smtpmail-smtp-server "smtp.forwardemail.net"
+ smtpmail-smtp-service 465
+ smtpmail-stream-type 'ssl
+ message-send-mail-function 'smtpmail-send-it
+ message-signature "Thanos Apollo\n https://thanosapollo.org")
(use-package yasnippet
:ensure nil