summaryrefslogtreecommitdiffhomepage
path: root/email.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-06-08 02:52:45 +0100
committerjao <jao@gnu.org>2021-06-08 02:53:05 +0100
commit63c7742de1cb4ec8d63abd6f8553367531d3847d (patch)
treeee1e7b6ce431eda4f8638104e12bb6976a23cbac /email.org
parent32ad514876fe48362daf1bee3a9a6d6af6b68134 (diff)
downloadelibs-63c7742de1cb4ec8d63abd6f8553367531d3847d.tar.gz
elibs-63c7742de1cb4ec8d63abd6f8553367531d3847d.tar.bz2
generic narrowing for mail workspace
Diffstat (limited to 'email.org')
-rw-r--r--email.org54
1 files changed, 38 insertions, 16 deletions
diff --git a/email.org b/email.org
index c67a9d0..fb0a2c1 100644
--- a/email.org
+++ b/email.org
@@ -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)