summaryrefslogtreecommitdiffhomepage
path: root/attic/w3m.org
diff options
context:
space:
mode:
Diffstat (limited to 'attic/w3m.org')
-rw-r--r--attic/w3m.org27
1 files changed, 27 insertions, 0 deletions
diff --git a/attic/w3m.org b/attic/w3m.org
index 6bfbaca..3689c8e 100644
--- a/attic/w3m.org
+++ b/attic/w3m.org
@@ -43,6 +43,33 @@
(require 'ol-w3m nil t)
(define-key org-mode-map "\C-cW" 'jao-insert-w3m-link))
#+end_src
+* notmuch integration
+ #+begin_src emacs-lisp
+ (defvar-local jao-notmuch--showing-images nil)
+
+ (defun jao-notmuch--setup-w3m-images (&optional activate)
+ (when (eq mm-text-html-renderer 'w3m)
+ (setq-local w3m-ignored-image-url-regexp
+ (unless jao-notmuch--showing-images
+ notmuch-show-text/html-blocked-images))
+ (when activate
+ (setq-local scroll-margin 0)
+ (w3m-toggle-inline-images (if jao-notmuch--showing-images t 'turnoff)))))
+
+ (defun jao-notmuch--w3m-toggle-images ()
+ (save-window-excursion
+ (when (or (derived-mode-p 'notmuch-show-mode)
+ (jao-notmuch-goto-message-buffer nil t))
+ (goto-char (point-min))
+ (when (re-search-forward "^\\[ text/html " nil t)
+ (when (looking-at-p "(hidden)")
+ (notmuch-show-toggle-part-invisibility))
+ (forward-line 1)
+ (setq jao-notmuch--showing-images (not jao-notmuch--showing-images))
+ (jao-notmuch--setup-w3m-images t)))))
+
+ (add-hook 'notmuch-show-mode-hook #'jao-notmuch--setup-w3m-images)
+ #+end_src
* Capture page
#+begin_src emacs-lisp
(defun jao-w3m-capture-page ()