Merge pull request #3932 from nackjicholson/rm-notmuch-hello-customizations

Notmuch module remove `*notmuch-hello*` buffer customizations + add some documentation
This commit is contained in:
Henrik Lissner 2021-03-05 20:58:53 -05:00 committed by GitHub
commit 4e90bbaf75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 15 deletions

View file

@ -19,6 +19,8 @@
- [[#offlineimap][offlineimap]] - [[#offlineimap][offlineimap]]
- [[#mbsync][mbsync]] - [[#mbsync][mbsync]]
- [[#notmuch][notmuch]] - [[#notmuch][notmuch]]
- [[#customize-notmuch-hello-buffer][Customize =*notmuch-hello*= buffer]]
- [[#changing-the-notmuch-landing-page][Changing the =notmuch= landing page]]
- [[#troubleshooting][Troubleshooting]] - [[#troubleshooting][Troubleshooting]]
* Description * Description
@ -35,13 +37,23 @@ This module makes Emacs an email client, using ~notmuch~.
* Prerequisites * Prerequisites
This module requires: This module requires:
+ Either ~gmailieer~ (default), ~mbsync~ or ~offlineimap~ (to sync mail with) + Either ~[[https://github.com/gauteh/lieer][gmailieer]]~ (default), ~mbsync~ or ~offlineimap~ (to sync mail with)
+ ~notmuch~, to index and tag your downloaded messages. + ~[[https://notmuchmail.org/][notmuch]]~, to index and tag your downloaded messages.
+ ~afew~, optionally to initially tag your downloaded messages. + ~afew~, optionally to initially tag your downloaded messages.
** TODO MacOS ** TODO MacOS
** TODO Arch Linux ** Arch Linux
Run one of the following commands.
#+BEGIN_SRC sh
pacman -S isync notmuch #mbsync
#+END_SRC
#+BEGIN_SRC sh
pacman -S offlineimap notmuch
#+END_SRC
See: [[https://wiki.archlinux.org/index.php/Notmuch][Arch Wiki - Notmuch]]
** NixOS ** NixOS
#+BEGIN_SRC nix #+BEGIN_SRC nix
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -57,6 +69,7 @@ environment.systemPackages = with pkgs; [
** TODO openSUSE ** TODO openSUSE
** TODO Debian/Ubuntu ** TODO Debian/Ubuntu
* TODO Features * TODO Features
* Configuration * Configuration
@ -85,7 +98,7 @@ This module uses =Gmailier= by default. To use =mbsync=, change ~+notmuch-sync-b
(setq +notmuch-sync-backend 'mbsync) (setq +notmuch-sync-backend 'mbsync)
#+END_SRC #+END_SRC
The steps needed to set up =mu4e= with =mbsync= are very similar to the ones for The steps needed to set up =notmuch= with =mbsync= are very similar to the ones for
[[*offlineimap][offlineimap]]. [[*offlineimap][offlineimap]].
Start with writing a ~\~/.mbsyncrc~. An example for GMAIL can be found on Start with writing a ~\~/.mbsyncrc~. An example for GMAIL can be found on
@ -95,8 +108,6 @@ page]] contains all needed information to set up your own.
Next you can download your email with ~mbsync --all~. This may take a while, but Next you can download your email with ~mbsync --all~. This may take a while, but
should be quicker than =offlineimap= ;). should be quicker than =offlineimap= ;).
You can now proceed with the [[*mu and mu4e][mu and mu4e]] section.
** notmuch ** notmuch
You should have your email downloaded already. If you have not, you need to set You should have your email downloaded already. If you have not, you need to set
=Gmailier=, =offlineimap= or =mbsync= up before you proceed. =Gmailier=, =offlineimap= or =mbsync= up before you proceed.
@ -107,4 +118,30 @@ Before you can use =notmuch=, you need to index your email initially.
notmuch new notmuch new
#+END_SRC #+END_SRC
** Customize =*notmuch-hello*= buffer
It is possible to change the =*notmuch-hello*= buffer if you want to.
#+BEGIN_SRC emacs-lisp
(after! notmuch
(setq notmuch-show-log nil
notmuch-hello-sections `(notmuch-hello-insert-saved-searches
notmuch-hello-insert-alltags)
;; Maybe you don't like seeing email headers when you write email either.
notmuch-message-headers-visible nil))
#+END_SRC
** Changing the =notmuch= landing page
You may want to forego the =*notmuch-hello*= buffer by having ~M-x =notmuch~ or
~SPC o m~ take you straight to a search page.
When using ~SPC o m~ the =+notmuch-home-function= is called. By default it uses
the =notmuch= function and so has the same familiar behavior of running a
vanilla install of notmuch-emacs. But, by overwriting this function you can run
a custom search as your landing page.
#+BEGIN_SRC emacs-lisp
(setq +notmuch-home-function (lambda () (notmuch-search "tag:inbox")))
#+END_SRC
* Troubleshooting * Troubleshooting

View file

@ -12,7 +12,7 @@
(if-let* ((buf (cl-find-if (lambda (it) (string-match-p "^\\*notmuch" (buffer-name (window-buffer it)))) (if-let* ((buf (cl-find-if (lambda (it) (string-match-p "^\\*notmuch" (buffer-name (window-buffer it))))
(doom-visible-windows)))) (doom-visible-windows))))
(select-window (get-buffer-window buf)) (select-window (get-buffer-window buf))
(notmuch-search "tag:inbox")) (funcall +notmuch-home-function))
(+workspace/display)) (+workspace/display))
('error ('error
(+notmuch/quit) (+notmuch/quit)

View file

@ -2,6 +2,9 @@
;; FIXME This module is a WIP! ;; FIXME This module is a WIP!
(defvar +notmuch-home-function #'notmuch
"Function for customizing the landing page for doom-emacs =notmuch.")
(defvar +notmuch-sync-backend 'gmi (defvar +notmuch-sync-backend 'gmi
"Which backend to use. Can be either gmi, mbsync, offlineimap or nil (manual).") "Which backend to use. Can be either gmi, mbsync, offlineimap or nil (manual).")
@ -27,8 +30,6 @@
(set-popup-rule! "^\\*notmuch-hello" :side 'left :size 30 :ttl 0) (set-popup-rule! "^\\*notmuch-hello" :side 'left :size 30 :ttl 0)
(setq notmuch-fcc-dirs nil (setq notmuch-fcc-dirs nil
notmuch-show-logo nil
notmuch-message-headers-visible nil
message-kill-buffer-on-exit t message-kill-buffer-on-exit t
message-send-mail-function 'message-send-mail-with-sendmail message-send-mail-function 'message-send-mail-with-sendmail
notmuch-search-oldest-first nil notmuch-search-oldest-first nil
@ -42,9 +43,6 @@
("tags" . "(%s)")) ("tags" . "(%s)"))
notmuch-tag-formats notmuch-tag-formats
'(("unread" (propertize tag 'face 'notmuch-tag-unread))) '(("unread" (propertize tag 'face 'notmuch-tag-unread)))
notmuch-hello-sections
'(notmuch-hello-insert-saved-searches
notmuch-hello-insert-alltags)
notmuch-saved-searches notmuch-saved-searches
'((:name "inbox" :query "tag:inbox not tag:trash" :key "i") '((:name "inbox" :query "tag:inbox not tag:trash" :key "i")
(:name "flagged" :query "tag:flagged" :key "f") (:name "flagged" :query "tag:flagged" :key "f")
@ -52,8 +50,6 @@
(:name "drafts" :query "tag:draft" :key "d")) (:name "drafts" :query "tag:draft" :key "d"))
notmuch-archive-tags '("-inbox" "-unread")) notmuch-archive-tags '("-inbox" "-unread"))
;; (setq-hook! 'notmuch-show-mode-hook line-spacing 0)
;; only unfold unread messages in thread by default ;; only unfold unread messages in thread by default
(add-hook 'notmuch-show-hook #'+notmuch-show-expand-only-unread-h) (add-hook 'notmuch-show-hook #'+notmuch-show-expand-only-unread-h)