From cf81ccc6e7a4cb50151d1b2f7a81369ef516a0db Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 16 May 2021 02:12:12 +0100 Subject: fix for init loading --- email.org | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'email.org') diff --git a/email.org b/email.org index 745fb07..64b4e7c 100644 --- a/email.org +++ b/email.org @@ -247,6 +247,13 @@ (setq bbdb-file (expand-file-name "~/.emacs.d/bbdb")) (bbdb-initialize 'message 'pgp 'mail) #+end_src +* mailboxes + #+begin_src emacs-lisp + (defun jao-list-mailboxes (base) + (let ((dir (expand-file-name base "~/var/mail"))) + (seq-difference (directory-files dir) + '("." ".." "sent" "inbox" "trash")))) + #+end_src * gnus *** Directories #+begin_src emacs-lisp @@ -322,6 +329,33 @@ ,(jao-notmuch--q "new" nil "n" '("tag:new")) ,(jao-notmuch--q "draft" nil "d" '("tag:draft")))) #+end_src +*** consult + #+begin_src emacs-lisp + (use-package consult-notmuch + :ensure t + :init (setq consult-notmuch-authors-width 30) + :config + (add-to-list 'consult-config '(consult-notmuch :preview-key any)) + (add-to-list 'consult-buffer-sources 'consult-notmuch-buffer-source)) + + (defvar jao-consult-notmuch-folders + (seq-mapcat (lambda (base) + (mapcar `(lambda (d) (format "%s/%s" ,base d)) + (jao-list-mailboxes base))) + '("jao" "bigml" "feeds" "trove"))) + + (defun jao-consult-notmuch-folder (&optional tree folder) + (interactive "P") + (let* ((root "~/var/mail/") + (folder (if folder + (file-name-as-directory folder) + (completing-read "Folder: " + jao-consult-notmuch-folders))) + (folder (replace-regexp-in-string "/\\(.\\)" ".\\1" folder)) + (init (read-string "Initial query: ")) + (init (format "folder:/%s/ %s" folder init))) + (if tree (consult-notmuch-tree init) (consult-notmuch init)))) + #+end_src *** org mode integration Stolen and adapted from [[https://gist.github.com/fedxa/fac592424473f1b70ea489cc64e08911][Fedor Bezrukov]]. #+begin_src emacs-lisp -- cgit v1.2.3