emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 61b2e83: Don't remove too much white space at the e


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 61b2e83: Don't remove too much white space at the end of documents
Date: Sun, 20 Mar 2016 13:47:33 +0000

branch: master
commit 61b2e837d8eefcba7ae8dbe442a818f05d5ed6f0
Author: Lars Magne Ingebrigtsen <address@hidden>
Commit: Lars Magne Ingebrigtsen <address@hidden>

    Don't remove too much white space at the end of documents
    
    * 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            |    7 ++-----
 test/data/shr/ul-empty.txt |    2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index cd55f22..4adb4a6 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -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.
diff --git a/test/data/shr/ul-empty.txt b/test/data/shr/ul-empty.txt
index acb41c4..8993555 100644
--- a/test/data/shr/ul-empty.txt
+++ b/test/data/shr/ul-empty.txt
@@ -1,3 +1,3 @@
 * 
 
-Lala
+Lala 
\ No newline at end of file



reply via email to

[Prev in Thread] Current Thread [Next in Thread]