From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bill Wohler Newsgroups: gmane.emacs.bugs Subject: bug#21650: fix should be underneath MH-E Date: Wed, 03 Feb 2016 14:52:47 -0800 Organization: Newt Software Message-ID: <111400.1454539967@olgas.newt.com> References: <29197.1454352814@allegro.localdomain> <0tzivin3m4.fsf@fencepost.gnu.org> <87lh72le2h.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: ger.gmane.org 1454540003 3550 80.91.229.3 (3 Feb 2016 22:53:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Feb 2016 22:53:23 +0000 (UTC) Cc: Lars Ingebrigtsen , 21650@debbugs.gnu.org, Mike Kupfer To: Katsumi Yamaoka Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 03 23:53:11 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aR6IR-0008Ko-76 for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Feb 2016 23:53:11 +0100 Original-Received: from localhost ([::1]:38155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR6IQ-0006EI-Lf for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Feb 2016 17:53:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR6IM-0006At-B5 for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2016 17:53:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aR6II-0004jy-5w for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2016 17:53:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49912) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR6II-0004jr-30 for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2016 17:53:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aR6IH-0002f9-S0 for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2016 17:53:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Bill Wohler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Feb 2016 22:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21650 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: security Original-Received: via spool by 21650-submit@debbugs.gnu.org id=B21650.145453998010227 (code B ref 21650); Wed, 03 Feb 2016 22:53:01 +0000 Original-Received: (at 21650) by debbugs.gnu.org; 3 Feb 2016 22:53:00 +0000 Original-Received: from localhost ([127.0.0.1]:58501 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aR6IG-0002et-41 for submit@debbugs.gnu.org; Wed, 03 Feb 2016 17:53:00 -0500 Original-Received: from tassie.newt.com ([66.135.33.59]:52730) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aR6IE-0002eh-Fg for 21650@debbugs.gnu.org; Wed, 03 Feb 2016 17:52:58 -0500 Original-Received: from olgas.newt.com (c-50-161-94-13.hsd1.ca.comcast.net [50.161.94.13]) by tassie.newt.com (Postfix) with ESMTPSA id 307766802C4; Wed, 3 Feb 2016 14:52:48 -0800 (PST) Original-Received: by olgas.newt.com (Postfix, from userid 1000) id 6FD9C38145E; Wed, 3 Feb 2016 14:52:47 -0800 (PST) In-reply-to: Comments: In-reply-to Katsumi Yamaoka message dated "Wed, 03 Feb 2016 18:43:43 +0900." X-Mailer: MH-E 8.6+git; nmh 1.6; GNU Emacs 24.4.1 X-Image-URL: http://www.newt.com/wohler/images/bill-diving.png Content-ID: <111399.1454539967.1@olgas.newt.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:112357 Archived-At: Katsumi Yamaoka wrote: > On Wed, 03 Feb 2016 13:31:34 +1100, Lars Ingebrigtsen wrote: > > Glenn Morris 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 aka http://www.newt.com/wohler/ GnuPG ID:610BD9AD