From: Bill Wohler <wohler@newt.com>
To: Katsumi Yamaoka <yamaoka@jpl.org>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
21650@debbugs.gnu.org, Mike Kupfer <m.kupfer@acm.org>
Subject: bug#21650: fix should be underneath MH-E
Date: Wed, 03 Feb 2016 14:52:47 -0800 [thread overview]
Message-ID: <111400.1454539967@olgas.newt.com> (raw)
In-Reply-To: <b4mwpqm86y8.fsf@jpl.org>
Katsumi Yamaoka <yamaoka@jpl.org> wrote:
> On Wed, 03 Feb 2016 13:31:34 +1100, Lars Ingebrigtsen wrote:
> > Glenn Morris <rgm@gnu.org> writes:
>
> >> Surely Gnus should make whatever buffer-local shr-related settings it
> >> needs in its Gnus buffers, and the MH-E folks can do the same, rather
> >> than hard-coding Gnus-specific behavior in mm-shr?
>
> > Yup.
>
> My solution is below. Tested briefly. This patch moves the
> binding of shr-inhibit-images and shr-blocked-images to Gnus
> from mm. So, MH-E has to do a similar thing.
I disagree. This only works for shr and defeats encapsulation.
mm-text-html-renderer can also be gnus-w3m, w3m, emacs-w3m,
w3m-standalone, links, lynx, w3, and html2text. The solution should be
encapsulated in mm and work for all of those renderers rather than
duplicating an incomplete solution in Gnus and MH-E and elsewhere.
Alternatively, the solution can be applied to each renderer that is
missing that functionality.
In any event, Gnus and MH-E are not the correct level for this solution
since we delegate to mm to do the rendering.
> --- gnus-art.el~ 2016-02-02 02:43:45.605413000 +0000
> +++ gnus-art.el 2016-02-03 09:42:20.238190600 +0000
> @@ -2722,9 +2722,8 @@
> (when (gmm-called-interactively-p 'any)
> (gnus-treat-article nil))))
>
> -(defun article-wash-html ()
> +(defun article-wash-html-1 ()
> "Format an HTML article."
> - (interactive)
> (let ((handles nil)
> (buffer-read-only nil))
> (when (gnus-buffer-live-p gnus-original-article-buffer)
> @@ -2735,6 +2734,19 @@
> (mm-enable-multibyte)
> (mm-inline-text-html handles)))
>
> +(defun article-wash-html ()
> + "Format an HTML article."
> + (interactive)
> + (cond ((eq mm-text-html-renderer 'shr)
> + (require 'shr)
> + (let (shr-inhibit-images shr-blocked-images)
> + (with-current-buffer gnus-summary-buffer
> + (setq shr-inhibit-images gnus-inhibit-images
> + shr-blocked-images (gnus-blocked-images)))
> + (article-wash-html-1)))
> + (t
> + (article-wash-html-1))))
> +
> (defvar gnus-article-browse-html-temp-list nil
> "List of temporary files created by `gnus-article-browse-html-parts'.
> Internal variable.")
> @@ -4930,7 +4942,9 @@
> gnus-url-button-commands)))
>
> (defmacro gnus-bind-safe-url-regexp (&rest body)
> - "Bind `mm-w3m-safe-url-regexp' according to `gnus-safe-html-newsgroups'."
> + "Bind `mm-w3m-safe-url-regexp' according to `gnus-safe-html-newsgroups'.
> +Also bind `shr-inhibit-images' and `shr-blocked-images' with
> +`gnus-inhibit-images' and `gnus-blocked-images' if `shr' is used."
> `(let ((mm-w3m-safe-url-regexp
> (let ((group (if (and (derived-mode-p 'gnus-article-mode)
> (gnus-buffer-live-p
> @@ -4948,7 +4962,15 @@
> (member group gnus-safe-html-newsgroups)))
> nil
> mm-w3m-safe-url-regexp))))
> - ,@body))
> + (cond ((eq mm-text-html-renderer 'shr)
> + (require 'shr)
> + (let (shr-inhibit-images shr-blocked-images)
> + (with-current-buffer gnus-summary-buffer
> + (setq shr-inhibit-images gnus-inhibit-images
> + shr-blocked-images (gnus-blocked-images)))
> + ,@body))
> + (t
> + ,@body))))
>
> (defun gnus-mime-button-menu (event prefix)
> "Construct a context-sensitive menu of MIME commands."
> --- mm-decode.el~ 2016-01-04 22:05:27.255542500 +0000
> +++ mm-decode.el 2016-02-03 09:42:20.238799100 +0000
> @@ -1844,15 +1844,7 @@
> (when handle
> (mm-with-part handle
> (buffer-string))))))
> - shr-inhibit-images shr-blocked-images charset char)
> - (if (and (boundp 'gnus-summary-buffer)
> - (bufferp gnus-summary-buffer)
> - (buffer-name gnus-summary-buffer))
> - (with-current-buffer gnus-summary-buffer
> - (setq shr-inhibit-images gnus-inhibit-images
> - shr-blocked-images (gnus-blocked-images)))
> - (setq shr-inhibit-images gnus-inhibit-images
> - shr-blocked-images (gnus-blocked-images)))
> + charset char)
> (unless handle
> (setq handle (mm-dissect-buffer t)))
> (setq charset (mail-content-type-get (mm-handle-type handle) 'charset))
--
Bill Wohler <wohler@newt.com> aka <Bill.Wohler@nasa.gov>
http://www.newt.com/wohler/
GnuPG ID:610BD9AD
next prev parent reply other threads:[~2016-02-03 22:52 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-08 17:03 bug#21650: 24.5; mh-e keeps trying to open urls Simon Gerraty
2015-10-08 19:20 ` Eli Zaretskii
2015-10-08 20:19 ` Simon J. Gerraty
2015-10-08 21:21 ` Glenn Morris
2015-10-09 15:10 ` Simon J. Gerraty
2015-10-09 7:11 ` Eli Zaretskii
2015-12-23 6:07 ` Bill Wohler
2016-01-09 2:20 ` Mike Kupfer
2015-10-09 1:23 ` Wolfgang Jenkner
2016-02-01 18:53 ` bug#21650: fix should be underneath MH-E Mike Kupfer
2016-02-02 18:28 ` Glenn Morris
2016-02-02 22:23 ` Katsumi Yamaoka
2016-02-02 22:34 ` Glenn Morris
2016-02-02 23:34 ` Katsumi Yamaoka
2016-02-03 2:31 ` Lars Ingebrigtsen
2016-02-03 9:43 ` Katsumi Yamaoka
2016-02-03 22:52 ` Bill Wohler [this message]
2016-02-04 3:58 ` Mike Kupfer
2016-02-03 5:58 ` Bill Wohler
2016-02-04 6:09 ` Katsumi Yamaoka
2016-02-05 1:41 ` Mike Kupfer
2016-02-05 6:04 ` Katsumi Yamaoka
2016-02-06 22:53 ` Mike Kupfer
2016-02-05 6:41 ` Katsumi Yamaoka
2016-02-08 22:43 ` Katsumi Yamaoka
2016-02-09 0:41 ` Mike Kupfer
2016-02-09 3:24 ` Mike Kupfer
2016-02-09 1:49 ` Katsumi Yamaoka
2016-02-09 4:41 ` Katsumi Yamaoka
2016-02-09 5:49 ` Bill Wohler
2016-02-09 15:17 ` Mike Kupfer
2016-02-09 22:15 ` Katsumi Yamaoka
2016-02-10 2:23 ` Mike Kupfer
2016-02-10 3:51 ` Bill Wohler
2016-02-28 3:20 ` Mike Kupfer
2016-06-07 0:35 ` bug#21650: 21650: fixed in Emacs 25 Mike Kupfer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=111400.1454539967@olgas.newt.com \
--to=wohler@newt.com \
--cc=21650@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=m.kupfer@acm.org \
--cc=yamaoka@jpl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.