aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2013-12-25 23:52:15 +0100
committerLars Ingebrigtsen2013-12-25 23:52:15 +0100
commitf7f071dcf47fc47b987d9a9700bf558844262d19 (patch)
treeb77c1b3912a01b98cbc9ebf478e11b2da33c498d
parented78d16c6eabaa6c23c9964cc925541349c6088c (diff)
downloademacs-f7f071dcf47fc47b987d9a9700bf558844262d19.tar.gz
emacs-f7f071dcf47fc47b987d9a9700bf558844262d19.zip
Don't infloop when we can't find a good place to break lines in shr
(shr-insert): Don't infloop if we can't find a good place to break the line. Fixes: debbugs:16256
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/net/shr.el21
2 files changed, 12 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 18f0a9f22fe..76e175919e4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -12,6 +12,8 @@
122013-12-25 Lars Ingebrigtsen <larsi@gnus.org> 122013-12-25 Lars Ingebrigtsen <larsi@gnus.org>
13 13
14 * net/shr.el (shr-visit-file): Remove debugging function. 14 * net/shr.el (shr-visit-file): Remove debugging function.
15 (shr-insert): Don't infloop if we can't find a good place to break
16 the line (bug#16256).
15 17
162013-12-25 Fabián Ezequiel Gallina <fgallina@gnu.org> 182013-12-25 Fabián Ezequiel Gallina <fgallina@gnu.org>
17 19
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 5b8ab28c837..93e2be0086a 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -455,11 +455,10 @@ size, and full-buffer size."
455 (insert elem) 455 (insert elem)
456 (setq shr-state nil) 456 (setq shr-state nil)
457 (let (found) 457 (let (found)
458 (while (and (> (current-column) shr-width) 458 (when (and (> (current-column) shr-width)
459 (> shr-width 0) 459 (progn
460 (progn 460 (setq found (shr-find-fill-point))
461 (setq found (shr-find-fill-point)) 461 (not (eolp))))
462 (not (eolp))))
463 (when (eq (preceding-char) ? ) 462 (when (eq (preceding-char) ? )
464 (delete-char -1)) 463 (delete-char -1))
465 (insert "\n") 464 (insert "\n")
@@ -528,12 +527,12 @@ size, and full-buffer size."
528 (not (memq (preceding-char) (list ?\C-@ ?\n ? ))) 527 (not (memq (preceding-char) (list ?\C-@ ?\n ? )))
529 (or (shr-char-kinsoku-eol-p (preceding-char)) 528 (or (shr-char-kinsoku-eol-p (preceding-char))
530 (shr-char-kinsoku-bol-p (following-char))))))) 529 (shr-char-kinsoku-bol-p (following-char)))))))
531 (if (setq failed (= (current-column) shr-indentation)) 530 (when (setq failed (= (current-column) shr-indentation))
532 ;; There's no breakable point that doesn't violate kinsoku, 531 ;; There's no breakable point that doesn't violate kinsoku,
533 ;; so we go to the second best position. 532 ;; so we go to the second best position.
534 (if (looking-at "\\(\\c<+\\)\\c<") 533 (if (looking-at "\\(\\c<+\\)\\c<")
535 (goto-char (match-end 1)) 534 (goto-char (match-end 1))
536 (forward-char 1)))) 535 (forward-char 1))))
537 ((shr-char-kinsoku-bol-p (following-char)) 536 ((shr-char-kinsoku-bol-p (following-char))
538 ;; Find forward the point where kinsoku-bol characters end. 537 ;; Find forward the point where kinsoku-bol characters end.
539 (let ((count 4)) 538 (let ((count 4))