diff options
-rw-r--r-- | email.org | 54 |
1 files changed, 38 insertions, 16 deletions
@@ -254,6 +254,42 @@ (seq-difference (directory-files dir) '("." ".." "sent" "inbox" "trash")))) #+end_src +* consult narrowing + #+begin_src emacs-lisp + (defvar jao-mail-consult-buffer-history nil) + + (defun jao-mail-buffer-p (b) + (or (member (buffer-name b) + '("*Calendar*" "inbox.org" "*Org Agenda*" + "*Fancy Diary Entries*" "diary")) + (with-current-buffer b + (derived-mode-p 'notmuch-show-mode + 'notmuch-search-mode + 'notmuch-tree-mode + 'notmuch-hello-mode + 'notmuch-message-mode + 'gnus-group-mode + 'gnus-summary-mode + 'gnus-article-mode)))) + + (defvar jao-mail-consult-source + (list :name "mail buffer" + :category 'buffer + :hidden t + :narrow (cons ?n "mail buffer") + :history 'jao-mail-consult-buffer-history + :action (lambda (b) + (when (not (string-blank-p (or b ""))) + (jao-afio--goto-mail) + (if (get-buffer-window b) + (pop-to-buffer b) + (pop-to-buffer-same-window b)))) + :items (lambda () + (mapcar #'buffer-name + (seq-filter #'jao-mail-buffer-p (buffer-list)))))) + + (jao-consult-add-buffer-source 'jao-mail-consult-source "Mail" ?n) + #+end_src * gnus *** Directories #+begin_src emacs-lisp @@ -622,25 +658,11 @@ #+begin_src emacs-lisp (when (< emacs-major-version 28) (jao-load-path "consult-notmuch")) + (use-package consult-notmuch ;; :ensure t :init (setq consult-notmuch-authors-width 30) - :config - (add-to-list 'consult-config '(consult-notmuch :preview-key any)) - - (defvar jao-notmuch-consult-buffer-history nil) - (defvar jao-notmuch-consult-source - (list :name "mail buffer" - :category 'buffer - :hidden t - :narrow (cons ?n "mail buffer") - :history 'jao-notmuch-consult-buffer-history - :require-match t - :action (lambda (b) (jao-afio--goto-mail) (pop-to-buffer b)) - :items (lambda () - (append (consult-notmuch--interesting-buffers) - '("*Calendar*" "inbox.org" "*Org Agenda*"))))) - (jao-consult-add-buffer-source 'jao-notmuch-consult-source "Mail" ?n)) + :config (consult-customize consult-notmuch :preview-key 'any)) (defvar jao-consult-notmuch-folders (seq-mapcat (lambda (base) |