From ef955c13df5f269818995075861aea681d52989a Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 28 Jul 2021 02:20:02 +0100 Subject: notmuch: better image toggling for w3m --- init.org | 6 +++++- lib/net/jao-notmuch.el | 10 +++++++++- notmuch.org | 9 ++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/init.org b/init.org index e3b0c7d..77fc22f 100644 --- a/init.org +++ b/init.org @@ -995,11 +995,15 @@ (setq line-move-visual t) - (use-package iscroll :ensure t :diminish) + (use-package iscroll + :ensure t + :diminish) (with-eval-after-load "gnus-art" (add-hook 'gnus-article-mode-hook #'iscroll-mode)) (with-eval-after-load "eww" (add-hook 'eww-mode-hook #'iscroll-mode)) + (with-eval-after-load "notmuch-show" + (add-hook 'notmuch-show-mode #'iscroll-mode)) #+end_src *** Splitting and switch #+begin_src emacs-lisp diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index c470682..7fae647 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -153,6 +153,8 @@ (jao-notmuch-goto-tree-buffer t) (jao-notmuch--tree-update-buffer-name))) +(defvar-local jao-notmuch--showing-images nil) + (defun jao-notmuch-show-images () (interactive) (save-window-excursion @@ -163,7 +165,13 @@ (when (looking-at-p "(hidden)") (notmuch-show-toggle-part-invisibility)) (forward-line 1) - (w3m-toggle-inline-images))))) + (setq-local jao-notmuch--showing-images + (not jao-notmuch--showing-images) + w3m-ignored-image-url-regexp + (unless jao-notmuch--showing-images + notmuch-show-text/html-blocked-images)) + (w3m-toggle-inline-images + (if jao-notmuch--showing-images t 'turnoff)))))) (defun jao-notmuch-show-ret () (interactive) diff --git a/notmuch.org b/notmuch.org index 728851d..9a7772f 100644 --- a/notmuch.org +++ b/notmuch.org @@ -88,7 +88,9 @@ ,(jao-notmuch--qn "emacs" "devel" "ed" '("tag:emacs-devel")) ,(jao-notmuch--qn "emacs" "bugs" "eb" '("tag:emacs-bugs")) ,(jao-notmuch--qn "emacs" "diffs" "ec" '("tag:emacs-diffs")) - ,@(jao-notmuch--mboxes-search "feeds" "emacs") + ,(jao-notmuch--qn "feeds" "lobsters" "fl" '("tag:lobsters")) + ,(jao-notmuch--qn "feeds" "prog" "fp" '("tag:prog" "not tag:lobsters")) + ,@(jao-notmuch--mboxes-search "feeds" "emacs" "prog") ,(jao-notmuch--q "bml" "today" "tb" '("tag:bigml" "date:1d..") t) ,(jao-notmuch--q "jao" "today" "tj" '("tag:jao" "date:1d.." @@ -102,7 +104,8 @@ (defun jao-notmuch-widen-searches (searches) (mapcar (lambda (s) (let ((q (plist-get s :query))) - (plist-put s :query (string-replace jao-notmuch--newa "" q)))) + (plist-put (copy-sequence s) + :query (string-replace jao-notmuch--newa "" q)))) searches)) (defvar jao-notmuch-widened-searches @@ -229,7 +232,7 @@ :config (setq jao-notmuch-mailboxes (jao-mailbox-folders))) #+end_src -* tree view +* views #+begin_src emacs-lisp (use-package notmuch-tree :config -- cgit v1.2.3