GNU bug report logs - #21650
24.5; mh-e keeps trying to open urls

Previous Next

Packages: mh-e, emacs;

Reported by: Simon Gerraty <sjg <at> juniper.net>

Date: Thu, 8 Oct 2015 18:43:01 UTC

Severity: normal

Found in version 24.5

Done: Mike Kupfer <m.kupfer <at> acm.org>

Bug is archived. No further changes may be made.

Full log


Message #60 received at 21650 <at> debbugs.gnu.org (full text, mbox):

From: Bill Wohler <wohler <at> newt.com>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: Glenn Morris <rgm <at> gnu.org>, Lars Ingebrigtsen <larsi <at> gnus.org>,
 21650 <at> debbugs.gnu.org, Mike Kupfer <m.kupfer <at> acm.org>
Subject: Re: bug#21650: fix should be underneath MH-E
Date: Wed, 03 Feb 2016 14:52:47 -0800
Katsumi Yamaoka <yamaoka <at> jpl.org> wrote:

> On Wed, 03 Feb 2016 13:31:34 +1100, Lars Ingebrigtsen wrote:
> > Glenn Morris <rgm <at> 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 <at> newt.com> aka <Bill.Wohler <at> nasa.gov>
http://www.newt.com/wohler/
GnuPG ID:610BD9AD




This bug report was last modified 8 years and 353 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.