]> code.delx.au - gnu-emacs/blobdiff - lisp/net/shr.el
Don't remove too much white space at the end of documents
[gnu-emacs] / lisp / net / shr.el
index cd55f223cf692fa93edb181ffaa8cfa951278ab2..4adb4a6099c58ef2478b3b3877e8e8d352018c21 100644 (file)
@@ -281,15 +281,12 @@ DOM should be a parse tree as generated by
 (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"))))))
+        (forward-line 1)
+        (delete-region (point) (point-max))))))
 
 (defun shr-copy-url (&optional image-url)
   "Copy the URL under point to the kill ring.