* lisp/net/shr.el (shr--remove-blank-lines-at-the-end): New function.
(shr-insert-document): Use it to remove trailing blank lines
at the end of documents, since these never seem to be very useful.
(set-window-hscroll nil 0)
(shr-descend dom)
(shr-fill-lines start (point))
+ (shr--remove-blank-lines-at-the-end start (point))
(shr-remove-trailing-whitespace start (point))
(when shr-warning
(message "%s" shr-warning))))
+(defun shr--remove-blank-lines-at-the-end (start end)
+ (save-restriction
+ (save-excursion
+ (current-buffer)
+ (narrow-to-region start end)
+ (goto-char end)
+ (when (and (re-search-backward "[^ \n]" nil t)
+ (not (eobp)))
+ (forward-char 1)
+ (delete-region (point) (point-max))
+ (unless (bolp)
+ (insert "\n"))))))
+
(defun shr-remove-trailing-whitespace (start end)
(let ((width (window-width)))
(save-restriction