aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaúl Benencia <id@rbenencia.name>2023-05-06 09:46:27 -0700
committerRaúl Benencia <id@rbenencia.name>2023-05-06 09:47:29 -0700
commit21004e70921566b7a616ecd657e3afc07d501599 (patch)
treee03cc4c15d83b77db5619217a74f110783e488cf
parent6401a151d80c79f84cb80a67a1cd936776f35865 (diff)
emacs: notmuch indicator, sections and binds
-rw-r--r--.emacs.local.d/modes/notmuch.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/.emacs.local.d/modes/notmuch.el b/.emacs.local.d/modes/notmuch.el
index c84f5a6..54178e6 100644
--- a/.emacs.local.d/modes/notmuch.el
+++ b/.emacs.local.d/modes/notmuch.el
@@ -2,6 +2,7 @@
;; notmuch mode
;; --------
(require 'notmuch)
+(require 'notmuch-indicator)
(require 'rul-config-mail)
;; Keymaps
@@ -98,3 +99,27 @@ than one email. Use notmuch-show otherwise."
(add-hook 'notmuch-hello-refresh-hook 'color-inbox-if-unread)
(add-hook 'notmuch-hello-refresh-hook 'notmuch-hello-refresh-status-message)
+
+(setq notmuch-hello-sections '(notmuch-hello-insert-saved-searches
+ notmuch-hello-insert-search
+ notmuch-hello-insert-recent-searches
+ notmuch-hello-insert-alltags
+ ))
+
+;; https://git.sr.ht/~tslil/dotfiles/tree/4e51afbb/emacs/notmuch-config.el#L76-82
+(defmacro make-binds (mode-map binds argfunc &rest body)
+ "Create keybindings in `mode-map' using a list of (keystr . arg)
+pairs in `binds' of the form ( ... (argfunc arg) body)."
+ `(progn ,@(mapcar (lambda (pair)
+ `(define-key ,mode-map (kbd ,(car pair))
+ (lambda () (interactive) (,argfunc ,(cdr pair)) ,@body)))
+ (eval binds))))
+
+(defvar notmuch-hello-tree-searches '(("u" . "tag:unread")
+ ("i" . "tag:inbox")
+ ("*" . "*"))
+ "List of (key . query) pairs to bind in notmuch-hello.")
+
+(make-binds notmuch-hello-mode-map
+ notmuch-hello-tree-searches
+ notmuch-search)
nihil fit ex nihilo