Subject: bug#29047: 26.0.90; shr hang (regression from 25.3)

From: Katsumi Yamaoka <[email-masked]>
Date: Mon, 30 Oct 2017 15:21:17 +0900

On Sun, 29 Oct 2017 16:07:34 +0200, Eli Zaretskii wrote:
> Thanks, this bug was introduced by 9eb028f, and the problematic
> property is 'display' with value '(space :align-to (NNN))'.  It
> causes shr-fill-line to infloop when this property is put on a
> newline.

Sorry, I did the 9eb028f change for fixing bug#24034:
<https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-07/msg01042.html>

> I can prevent the loop with the patch below.  I'm not sure this is the
> right fix, though.  Comments?

That's ok, but the properties necessary to copy there are only
`face' and `image-displayer'.  How about this one?

* lisp/net/shr.el (shr-fill-line): Copy only face and image-displayer
properties to gaps (bug#29047).

--- shr.el~	2017-10-29 22:05:08.139411500 +0000
+++ shr.el	2017-10-30 06:19:48.874402200 +0000
@@ -700,12 +700,16 @@
       ;; Success; continue.
       (when (= (preceding-char) ?\s)
 	(delete-char -1))
-      (let ((props (text-properties-at (point)))
+      (let ((props `(face ,(get-text-property (point) 'face)
+			  ;; Don't break the image-displayer property
+			  ;; as it will cause `gnus-article-show-images'
+			  ;; to show the two or more same images.
+			  image-displayer
+			  ,(get-text-property (point) 'image-displayer)))
 	    (gap-start (point)))
 	(insert "\n")
 	(shr-indent)
-	(when props
-	  (add-text-properties gap-start (point) props)))
+	(add-text-properties gap-start (point) props))
       (setq start (point))
       (shr-vertical-motion shr-internal-width)
       (when (looking-at " $")