diff options
Diffstat (limited to 'custom')
| -rw-r--r-- | custom/jao-custom-completion.el | 3 | ||||
| -rw-r--r-- | custom/jao-custom-notmuch.el | 32 |
2 files changed, 28 insertions, 7 deletions
diff --git a/custom/jao-custom-completion.el b/custom/jao-custom-completion.el index 98b853c..3076c3a 100644 --- a/custom/jao-custom-completion.el +++ b/custom/jao-custom-completion.el @@ -375,8 +375,7 @@ (embark-act))) (add-to-list 'avy-dispatch-alist '(?\; . avy-embark-act)) - :bind (("s-j" . avy-goto-char-timer) - ("C-M-j" . avy-goto-char-timer))) + :bind (("C-M-j" . avy-goto-char-timer))) ;;; link-hint (use-package link-hint diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el index b0e7043..3f714b3 100644 --- a/custom/jao-custom-notmuch.el +++ b/custom/jao-custom-notmuch.el @@ -53,6 +53,7 @@ ;;; saved searches (defvar jao-notmuch--new "tag:\"/^(unread|new)$/\"") +(defvar jao-notmuch--new-rx (regexp-quote jao-notmuch--new)) (defvar jao-notmuch--newa (concat jao-notmuch--new " AND ")) (defun jao-notmuch--q (d0 &optional k d1 qs st) @@ -188,12 +189,32 @@ (if widen jao-notmuch-widened-searches notmuch-saved-searches))) (notmuch-jump-search))) +(defun jao-notmuch--searches-w/new (searches) + (seq-filter (lambda (s) + (string-match-p jao-notmuch--new-rx (plist-get s :query))) + (notmuch-hello-query-counts searches))) + +(defconst jao-notmuch--search-keys '("a" "s" "d" "f" "g" "h" "j" "k" "l")) + +(defun jao-notmuch--index-searches (searches) + (seq-map-indexed (lambda (q i) + (plist-put q :key (or (elt jao-notmu +ch--search-keys i) + (format "%s" i)))) + searches)) + (defun jao-notmuch-jump () "Jump to a saved, non-zero count search." (interactive) - (let ((notmuch-saved-searches - (notmuch-hello-query-counts notmuch-saved-searches))) - (notmuch-jump-search))) + (if-let* ((searches (jao-notmuch--searches-w/new notmuch-saved-searches))) + (if (= 1 (length searches)) + (let* ((q (car searches)) + (of (eq 'oldest-first (plist-get q :sort-order))) + (query (plist-get q :query))) + (notmuch-tree query nil nil nil nil nil nil of t)) + (let ((notmuch-saved-searches (jao-notmuch--index-searches searches))) + (notmuch-jump-search))) + (jao-notmuch-jump-search t))) ;;; tags (defvar jao-notmuch--shared-tags @@ -335,7 +356,8 @@ (when jao-notmuch-enabled (add-hook 'jao-afio-switch-hook #'jao-notmuch-refresh-hello)) - :bind (:map notmuch-hello-mode-map + :bind (("s-j" . jao-notmuch-jump) + :map notmuch-hello-mode-map (("a" . jao-notmuch-refresh-agenda) ("A" . jao-afio-open-mail) ("g" . jao-notmuch-refresh-hello) @@ -489,7 +511,7 @@ (defun jao-notmuch-before-tree (&rest _args) (window-configuration-to-register ?G) - (when (string= (buffer-name) "*notmuch-hello*") + (when t ;; (string= (buffer-name) "*notmuch-hello*") (when (< (frame-width) 230) (delete-other-windows)) (split-window-right 40) (other-window 1))) |
