From 61b2e837d8eefcba7ae8dbe442a818f05d5ed6f0 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Sun, 20 Mar 2016 14:47:22 +0100 Subject: [PATCH] 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 cd55f223cf..4adb4a6099 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 acb41c47eb..8993555425 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 -- 2.39.2