From e4cdb0f77e523ee4d2405f2f6621039ae93b0ed5 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 7 May 2021 00:16:32 +0100 Subject: notmuch comfort --- email.org | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'email.org') diff --git a/email.org b/email.org index 2cb0374..57d5de0 100644 --- a/email.org +++ b/email.org @@ -262,12 +262,19 @@ #+begin_src emacs-lisp (defvar-local jao-notmuch--tree-buffer nil) - (defun jao-notmuch-goto-message-buffer () - (interactive) + (defun jao-notmuch-goto-message-buffer (&optional and-click) + (interactive "P") (when (window-live-p notmuch-tree-message-window) (let ((b (current-buffer))) (select-window notmuch-tree-message-window) - (setq-local jao-notmuch--tree-buffer b)))) + (setq-local jao-notmuch--tree-buffer b) + (when (and and-click (button-at (point))) + (push-button)) + t))) + + (defun jao-notmuch-goto-message-buffer* () + (interactive) + (save-window-excursion (jao-notmuch-goto-message-buffer t))) (defun jao-notmuch-goto-index-buffer () (interactive) @@ -297,7 +304,8 @@ (defun jao-notmuch-toggle-images () (interactive) (save-window-excursion - (when (jao-notmuch-goto-message-buffer) + (jao-notmuch-goto-message-buffer) + (when (derived-mode-p 'notmuch-show-mode) (let ((notmuch-show-text/html-blocked-images nil) (shr-inhibit-images nil) (shr-blocked-images nil)) @@ -558,22 +566,25 @@ (scroll-other-window 1) (notmuch-tree-show-message nil))) - (defun jao-notmuch-tree-delete-next (reverse) - "Mark as deleted current message and move to next. Prefix undeletes." + (defun jao-notmuch-tree-delete (reverse &optional next) + "Mark as deleted current message. Prefix undeletes." (interactive "P") (notmuch-tree-tag (notmuch-tag-change-list '("+deleted" "-unread" "-new") reverse)) - (notmuch-tree-next-message)) + (when next (notmuch-tree-next-message))) - (defun jao-notmuch-tree-undelete-next (reverse) + (defun jao-notmuch-tree-undelete (reverse) "Mark as not-deleted current message and move to next." (interactive "P") - (jao-notmuch-tree-delete-next (not reverse))) + (jao-notmuch-tree-delete (not reverse))) - (defun jao-notmuch-tree-read-thread-next () + (defun jao-notmuch-tree-read-thread-next (&optional delete) "Mark the current thread as read and move to next one." - (interactive) - (jao-notmuch-tree--tag-next '("-unread" "-new") nil t)) + (interactive "P") + (jao-notmuch-tree--tag-next (if delete + '("+deleted" "-unread" "-new") + '("-unread" "-new")) + nil t)) (dolist (f '(notmuch-tree-match-tree-face notmuch-tree-no-match-tree-face)) @@ -592,9 +603,10 @@ :bind (:map notmuch-tree-mode-map (("." . jao-notmuch-toggle-mime-parts) ("i" . jao-notmuch-toggle-images) - ("d" . jao-notmuch-tree-delete-next) - ("D" . jao-notmuch-tree-undelete-next) + ("d" . jao-notmuch-tree-delete) + ("D" . jao-notmuch-tree-undelete) ("h" . jao-notmuch-goto-message-buffer) + ("H" . jao-notmuch-goto-message-buffer*) ("K" . jao-notmuch-tag-jump) ("k" . jao-notmuch-tree-read-thread-next) ("n" . jao-notmuch-tree-next) -- cgit v1.2.3