(shr-tag-p): Don't insert newlines at the start of the buffer.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 3 Oct 2010 12:57:16 +0000 (14:57 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 3 Oct 2010 12:57:16 +0000 (14:57 +0200)
lisp/ChangeLog
lisp/mm-decode.el
lisp/shr.el

index aa4c82d..4b4ba56 100644 (file)
@@ -1,5 +1,11 @@
 2010-10-03  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * shr.el (shr-tag-p): Don't insert newlines at the start of the
+       buffer.
+
+       * mm-decode.el (mm-shr): Narrow before inserting, so that shr can know
+       when it's at the start of the buffer.
+
        * shr.el (shr-tag-blockquote): Convert name.
        (shr-rescale-image): Use the right image-size variant.
 
index e98d666..72bf61b 100644 (file)
@@ -1679,9 +1679,11 @@ If RECURSIVE, search recursively."
   (let ((article-buffer (current-buffer)))
     (unless handle
       (setq handle (mm-dissect-buffer t)))
-    (shr-insert-document
-     (mm-with-part handle
-       (libxml-parse-html-region (point-min) (point-max))))))
+    (save-restriction
+      (narrow-to-region (point) (point))
+      (shr-insert-document
+       (mm-with-part handle
+        (libxml-parse-html-region (point-min) (point-max)))))))
 
 (provide 'mm-decode)
 
index 2efd740..af2a5ef 100644 (file)
@@ -89,8 +89,9 @@ fit these criteria."
       (shr-descend sub)))))
 
 (defun shr-tag-p (cont)
-  (shr-ensure-newline)
-  (insert "\n")
+  (unless (bobp)
+    (shr-ensure-newline)
+    (insert "\n"))
   (shr-generic cont)
   (insert "\n"))