Make shr do line filling better when encountering very long words

(shr-insert): If we have a word that's longer than `shr-width',
break after it anyway.  Otherwise we'll do no breaking once we get
such a long word.
This commit is contained in:
Lars Magne Ingebrigtsen 2014-01-05 11:23:35 +01:00
parent 1a29adc257
commit 3d95a0f45a
2 changed files with 10 additions and 1 deletions

View file

@ -2,6 +2,9 @@
* net/shr.el (shr-descend): Don't bug out if the anchor is empty
(bug#16285).
(shr-insert): If we have a word that's longer than `shr-width',
break after it anyway. Otherwise we'll do no breaking once we get
such a long word.
2014-01-05 Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com>

View file

@ -475,7 +475,13 @@ size, and full-buffer size."
(when (> shr-indentation 0)
(shr-indent))
(end-of-line))
(insert " ")))
(if (<= (current-column) shr-width)
(insert " ")
;; In case we couldn't get a valid break point (because of a
;; word that's longer than `shr-width'), just break anyway.
(insert "\n")
(when (> shr-indentation 0)
(shr-indent)))))
(unless (string-match "[ \t\r\n ]\\'" text)
(delete-char -1)))))