]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't remove too much white space at the end of documents
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 20 Mar 2016 13:47:22 +0000 (14:47 +0100)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 20 Mar 2016 13:47:30 +0000 (14:47 +0100)
* lisp/net/shr.el (shr--remove-blank-lines-at-the-end): Don't
remove too much white space -- leave it on the last line (in
case there's a background color).

lisp/net/shr.el
test/data/shr/ul-empty.txt

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.
index acb41c47eb4d74a022ccc312b391a7e80bda71a7..8993555425b11deed23e9be8f0dd8a0ac8853acb 100644 (file)
@@ -1,3 +1,3 @@
 * 
 
-Lala
+Lala 
\ No newline at end of file