diff options
author | jao <jao@gnu.org> | 2021-07-05 00:34:44 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-07-05 00:34:44 +0100 |
commit | 666d7d94655a3b9151504b9550411feb845c7b96 (patch) | |
tree | ebed6583740bbc3b06e234d8216d0bdef55b76c9 | |
parent | c32e7602b05da3daecf5c487b04f163f5a4bf7e4 (diff) | |
download | elibs-666d7d94655a3b9151504b9550411feb845c7b96.tar.gz elibs-666d7d94655a3b9151504b9550411feb845c7b96.tar.bz2 |
cleaner handling of images in html email
-rw-r--r-- | eww.org | 10 | ||||
-rw-r--r-- | gnus.org | 4 | ||||
-rw-r--r-- | lib/net/jao-notmuch.el | 26 | ||||
-rw-r--r-- | notmuch.org | 9 | ||||
-rw-r--r-- | w3m.org | 17 |
5 files changed, 23 insertions, 43 deletions
@@ -21,16 +21,6 @@ (setq jao-browse-url-function #'jao-eww-browse-url) (setq eww-use-browse-url "^\\(gemini\\|gopher\\):") #+end_src -* Email - #+begin_src emacs-lisp - (defun jao-eww-html-renderer (handle) - (let ((shr-use-colors nil) - (shr-use-fonts nil) - ;; (mm-html-blocked-images nil) - (fill-column (min (window-width) 110))) - (mm-shr handle))) - (setq mm-text-html-renderer 'jao-eww-html-renderer) - #+end_src * Opening URLs #+begin_src emacs-lisp (defun jao-eww-copy-link () @@ -703,6 +703,10 @@ (define-key gnus-summary-mode-map "V" 'scroll-other-window-down) (define-key gnus-summary-mode-map "X" 'jao-gnus-arXiv-capture) + (with-eval-after-load "w3m" + (define-key gnus-article-mode-map "\C-ci" 'w3m-view-image) + (define-key gnus-article-mode-map "z" 'w3m-lnum-zoom-in-image)) + (major-mode-hydra-define gnus-summary-mode nil ("Browse" (("g" jao-gnus-follow-link "Follow link in emacs") diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index bb57f57..97e34f5 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -108,28 +108,30 @@ (jao-notmuch-goto-message-buffer)) (notmuch-show-browse-urls))) +(defun jao-notmuch--toggle-mime () + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "\\[ multipart/alternative \\]" nil t) + (while (forward-button 1 nil nil t) + (notmuch-show-toggle-part-invisibility))))) + (defun jao-notmuch-toggle-mime-parts () (interactive) (when (jao-notmuch-goto-message-buffer) (goto-char (point-min)) - (let ((notmuch-show-text/html-blocked-images nil) - (shr-inhibit-images nil) - (shr-blocked-images nil)) - (save-excursion - (when (re-search-forward "\\[ multipart/alternative \\]" nil t) - (while (forward-button 1 nil nil t) - (notmuch-show-toggle-part-invisibility))))) + (jao-notmuch--toggle-mime) (jao-notmuch-goto-tree-buffer))) -(defun jao-notmuch-toggle-images () +(defun jao-notmuch-show-images () (interactive) (save-window-excursion (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)) - (notmuch-refresh-this-buffer))))) + (setq-local mm-w3m-safe-url-regexp nil + notmuch-show-text/html-blocked-images nil + shr-inhibit-images nil + shr-blocked-images nil) + (notmuch-refresh-this-buffer)))) ;; Keeping track of unread messages in current tree view diff --git a/notmuch.org b/notmuch.org index 768bec7..4cfd416 100644 --- a/notmuch.org +++ b/notmuch.org @@ -1,7 +1,7 @@ #+property: header-args:emacs-lisp :lexical t :tangle yes :comments yes :results silent :shebang ";; -*- lexical-binding: t; -*-" :tangle-mode (identity #o644) #+title: notmuch configuration -* minibuffer notifications +* minibuffer #+begin_src emacs-lisp (defvar jao-notmuch-minibuffer-string "") @@ -141,8 +141,7 @@ :config (when (eq 'notmuch jao-afio-mail-function) - (setq mm-text-html-renderer 'shr - message-directory "~/var/mail/" + (setq message-directory "~/var/mail/" message-auto-save-directory "/tmp") (with-eval-after-load "notmuch-message" (define-key message-mode-map (kbd "C-c C-d") @@ -223,7 +222,7 @@ ("D" . jao-notmuch-tree-delete-thread) ("h" . jao-notmuch-goto-message-buffer) ("H" . jao-notmuch-click-message-buffer) - ("i" . jao-notmuch-toggle-images) + ("i" . jao-notmuch-show-images) ("K" . jao-notmuch-tag-jump-and-next) ("k" . jao-notmuch-tree-read-thread) ("M" . jao-notmuch-move-message) @@ -257,7 +256,7 @@ (major-mode-hydra-define notmuch-tree-mode nil ("View" (("." jao-notmuch-toggle-mime-parts "toggle mime parts") - ("i" jao-notmuch-toggle-images "toggle images") + ("i" jao-notmuch-show-images "toggle images") ("a" notmuch-tree-archive-thread-then-next "archive thread") ("C" jao-notmuch-echo-count "echo unread count")) "Mark" @@ -69,22 +69,7 @@ #+end_src * Email #+begin_src emacs-lisp - (defun jao-w3m-gnus-html-renderer (handle) - (let ((w3m-message-silent t) - (mm-w3m-safe-url-regexp nil) - (shr-use-colors nil) - (shr-use-fonts nil) - (fill-column (min (window-width) 110))) - (condition-case nil - (mm-inline-text-html-render-with-w3m handle) - (error (delete-region (point) (point-max)) - (mm-shr handle))))) - - (setq mm-text-html-renderer #'jao-w3m-gnus-html-renderer) - - (with-eval-after-load "gnus-art" - (define-key gnus-article-mode-map "\C-ci" 'w3m-view-image) - (define-key gnus-article-mode-map "z" 'w3m-lnum-zoom-in-image)) + (setq mm-text-html-renderer 'w3m) #+end_src * Narrowing #+begin_src emacs-lisp |