diff options
author | jao <jao@gnu.org> | 2021-04-20 17:25:18 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-04-20 17:25:18 +0100 |
commit | 8ace7559e9590b1989efaf730fa8e5b134c95c81 (patch) | |
tree | 60d60d5b3ec81280b7b94c6c094e2352297a6c24 | |
parent | 603db659ecee227122855bdb959ab57cda37cc54 (diff) | |
download | elibs-8ace7559e9590b1989efaf730fa8e5b134c95c81.tar.gz elibs-8ace7559e9590b1989efaf730fa8e5b134c95c81.tar.bz2 |
notmuch: commands for toggling mime parts and images
-rw-r--r-- | email.org | 72 |
1 files changed, 53 insertions, 19 deletions
@@ -409,6 +409,32 @@ (pop-to-buffer jao-notmuch--tree-buffer) (user-error "No index for this buffer"))) + (defun jao-notmuch-browse-urls () + (interactive) + (when (or (derived-mode-p 'notmuch-show-mode) + (jao-notmuch-goto-message-buffer)) + (notmuch-show-browse-urls))) + + (defun jao-notmuch-toggle-mime-parts () + (interactive) + (when (jao-notmuch-goto-message-buffer) + (goto-char (point-min)) + (save-excursion + (when (re-search-forward "\\[ multipart/alternative \\]" nil t) + (while (forward-button 1 nil nil t) + (notmuch-show-toggle-part-invisibility)))) + (jao-notmuch-goto-index-buffer))) + + (defun jao-notmuch-toggle-images () + (interactive) + (save-window-excursion + (when (jao-notmuch-goto-message-buffer) + (let ((notmuch-show-text/html-blocked-images nil)) + (notmuch-refresh-this-buffer))))) + + #+end_src +*** commands + #+begin_src emacs-lisp (defun jao-notmuch-jump () (interactive) (let ((resize-mini-windows t)) (notmuch-jump-search))) @@ -422,11 +448,22 @@ (when-let (tag (notmuch-select-tag-with-completion "Forest of tag: ")) (notmuch-tree (concat "tag:" tag) (when new "tag:/unread|new/")))) - (defun jao-notmuch-browse-urls () - (interactive) - (when (or (derived-mode-p 'notmuch-show-mode) - (jao-notmuch-goto-message-buffer)) - (notmuch-show-browse-urls))) + (defun jao-notmuch-tree-delete-next (reverse) + (interactive "P") + (notmuch-tree-tag + (notmuch-tag-change-list '("+deleted" "-unread" "-new") reverse)) + (notmuch-tree-next-matching-message)) + + (defun jao-mail-clean-address (fun address) + (let ((address (if (string-match ".+ updates on arXiv.org: \\(.+\\)" + address) + (with-temp-buffer + (insert (match-string 1 address)) + (let ((shr-width 1000)) + (shr-render-region (point-min) (point-max))) + (buffer-string)) + address))) + (funcall fun address))) (defun jao-notmuch-follow-link (&optional external) (interactive "P") @@ -503,18 +540,8 @@ notmuch-wash-citation-lines-suffix 20) :config - ;; (setq mm-text-html-renderer 'shr) - - (defun jao-mail-clean-address (fun address) - (let ((address (if (string-match ".+ updates on arXiv.org: \\(.+\\)" - address) - (with-temp-buffer - (insert (match-string 1 address)) - (let ((shr-width 1000)) - (shr-render-region (point-min) (point-max))) - (buffer-string)) - address))) - (funcall fun address))) + (when (eq 'notmuch jao-afio-mail-function) + (setq mm-text-html-renderer 'shr)) (advice-add 'notmuch-clean-address :around #'jao-mail-clean-address) @@ -523,17 +550,24 @@ ("E" . jao-notmuch-open-enclosure) ("B" . jao-notmuch-browse-urls) ("M-g" . jao-notmuch-follow-link) + ("d" . jao-notmuch-tree-delete-next) ("k" . jao-notmuch-tag-jump) ("j" . jao-notmuch-jump)) :map notmuch-message-mode-map (("C-c C-d" . notmuch-draft-postpone)) :map notmuch-show-mode-map (("h" . jao-notmuch-goto-index-buffer) + ("i" . jao-notmuch-toggle-images) + ("j" . jao-notmuch-jump) + ("k" . jao-notmuch-tag-jump) ("C-c C-c" . jao-notmuch-goto-message-in-gnus)) :map notmuch-hello-mode-map - (("S" . consult-notmuch)) + (("g" . jao-notmuch-refresh-hello) + ("S" . consult-notmuch)) :map notmuch-tree-mode-map - (("h" . jao-notmuch-goto-message-buffer) + (("." . jao-notmuch-toggle-mime-parts) + ("i" . jao-notmuch-toggle-images) + ("h" . jao-notmuch-goto-message-buffer) ("k" . jao-notmuch-tag-jump)))) #+end_src *** org mode integration |