From b387d32da3edf2e9341567590d2b8d29a79069e1 Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 24 Apr 2022 23:53:38 +0100 Subject: notmuch: simple side bars --- lib/eos/jao-afio.el | 50 +++++++++++++++++++++++++++++++++----------------- notmuch.org | 23 +++++++++++++++++++---- 2 files changed, 52 insertions(+), 21 deletions(-) diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index 28e6f67..2a4efbb 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -127,26 +127,42 @@ (gnus) (jao-gnus--set-summary-line)) +(defun jao-afio--mail-sidebar () + (other-window 1) + (delete-other-windows-vertically) + (find-file (expand-file-name "inbox.org" org-directory)) + (split-window-below (/ (window-height) 3)) + (other-window 1) + (org-agenda-list) + (split-window-below -9) + (other-window 1) + (switch-to-buffer "*Calendar*") + (other-window 1)) + +;;;###autoload +(defun jao-afio-open-notmuch () + (interactive) + (delete-other-windows) + (split-window-horizontally -80) + (notmuch) + (jao-afio--mail-sidebar)) + +(defun jao-afio-open-mail-function () + (interactive) + (jao-trisect) + (other-window 2) + (delete-window) + (other-window 1) + (funcall jao-afio-mail-function) + (jao-afio--mail-sidebar)) + ;;;###autoload (defun jao-afio-open-mail () (interactive) - (if (or (null jao-afio-mail-function) (eq 'gnus jao-afio-mail-function)) - (jao-afio-open-gnus) - (calendar) - (jao-trisect) - (other-window 2) - (delete-window) - (other-window 1) - (funcall jao-afio-mail-function) - (other-window 1) - (find-file (expand-file-name "inbox.org" org-directory)) - (split-window-below (/ (window-height) 3)) - (other-window 1) - (org-agenda-list) - (split-window-below -9) - (other-window 1) - (switch-to-buffer "*Calendar*") - (other-window 1))) + (unless (get-buffer "*Calendar*") (calendar)) + (cond ((eq 'gnus jao-afio-mail-function) (jao-afio-open-gnus)) + ((eq 'notmuch jao-afio-mail-function) (jao-afio-open-notmuch)) + (jao-afio-open-mail-function (jao-afio-open-mail-function)))) (defun jao-afio--goto-frame (next &optional reset) (when (or reset (not (eq next jao-afio--current-config))) diff --git a/notmuch.org b/notmuch.org index fee756c..4d255ff 100644 --- a/notmuch.org +++ b/notmuch.org @@ -204,8 +204,8 @@ notmuch-address-internal-completion '(received nil) notmuch-fcc-dirs '(("\\(support\\|education\\)@bigml.com" . nil) - (".*@bigml.com" . "bigml +bigml +sent -new -unread") - (".*" . "jao +jao +sent +trove -new -unread")) + (".*@bigml.com" . "bigml.trove +bigml +sent -new -unread") + (".*" . "jao.trove +jao +sent +trove -new -unread")) notmuch-maildir-use-notmuch-insert t) :config @@ -434,9 +434,9 @@ :init (setq notmuch-tree-result-format `(("date" . "%12s ") - ("authors" . "%-35s") + ("authors" . "%-25s") (jao-notmuch-msg-ticks . ,jao-mails-regexp) - (jao-notmuch-tree-and-subject . "%>-102s") + (jao-notmuch-tree-and-subject . "%>-80s") (jao-notmuch-format-tags . " (%s)")) notmuch-unthreaded-result-format notmuch-search-result-format consult-notmuch-result-format @@ -459,6 +459,21 @@ (jao-notmuch-tree-setup "T") + (defun jao-notmuch-before-tree (&rest args) + (when (string= (buffer-name) "*notmuch-hello*") + (split-window-right 40) + (other-window 1))) + + (defun jao-notmuch-after-tree-quit (&optional both) + (when (and (not (derived-mode-p 'notmuch-tree-mode 'notmuch-hello-mode)) + (save-window-excursion (other-window -1) + (derived-mode-p 'notmuch-hello-mode))) + (delete-window) + (jao-notmuch-refresh-hello))) + + (advice-add 'notmuch-tree :before #'jao-notmuch-before-tree) + (advice-add 'notmuch-tree-quit :after #'jao-notmuch-after-tree-quit) + :bind (:map notmuch-tree-mode-map (("b" . jao-notmuch-browse-urls) ("d" . jao-notmuch-tree-toggle-delete) -- cgit v1.2.3