If the head is completely empty, narrow to the empty region
authorLars Magne Ingebrigtsen <larsi@stories.(none)>
Fri, 6 Jan 2012 19:43:56 +0000 (20:43 +0100)
committerLars Magne Ingebrigtsen <larsi@stories.(none)>
Fri, 6 Jan 2012 19:43:56 +0000 (20:43 +0100)
* gnus-art.el (article-narrow-to-head): If the head is completely
empty, narrow to the empty region (bug#9764).

This makes the `t' command with the following settings not eat
paragraphs of the bodies:

  (setq gnus-visible-headers "^nomatch")
  (setq gnus-visible-headers nil
        gnus-ignored-headers nil)

lisp/ChangeLog
lisp/gnus-art.el

index 4095cc9..280d5f7 100644 (file)
@@ -1,5 +1,8 @@
 2012-01-06  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus-art.el (article-narrow-to-head): If the head is completely
+       empty, narrow to the empty region (bug#9764).
+
        * gnus-sum.el (gnus-summary-mark-article-as-unread): Mark articles as
        read, and then mark them as unread only when the unread mark is used.
        This makes `C-- T k' actually work, even though it's confusing.
index 5c93514..b282afd 100644 (file)
@@ -3240,9 +3240,16 @@ always hide."
 Point is left at the beginning of the narrowed-to region."
   (narrow-to-region
    (goto-char (point-min))
-   (if (search-forward "\n\n" nil 1)
-       (1- (point))
-     (point-max)))
+   (cond
+    ;; Absolutely no headers displayed.
+    ((looking-at "\n")
+     (point))
+    ;; Normal headers.
+    ((search-forward "\n\n" nil 1)
+     (1- (point)))
+    ;; Nothing but headers.
+    (t
+     (point-max))))
   (goto-char (point-min)))
 
 (defun article-goto-body ()