*** empty log message ***
[gnus] / lisp / nndoc.el
index bf58850..6873dc5 100644 (file)
@@ -97,8 +97,8 @@ One of `mbox', `babyl', `digest', `news', `rnews', `mmdf', `forward',
       (article-begin . "^\\\\\\\\\n")
       (head-begin . "^Paper.*:")
       (head-end   . "\\(^\\\\\\\\.*\n\\|-----------------\\)")
-      (body-begin . "")  
-      (body-end   . "-------------------------------------------------")     
+      (body-begin . "")
+      (body-end   . "-------------------------------------------------")
       (file-end   . "^Title: Recent Seminal")
       (generate-head-function . nndoc-generate-lanl-gov-head)
       (article-transform-function . nndoc-transform-lanl-gov-announce)
@@ -132,6 +132,7 @@ One of `mbox', `babyl', `digest', `news', `rnews', `mmdf', `forward',
 (defvoo nndoc-prepare-body-function nil)
 (defvoo nndoc-generate-head-function nil)
 (defvoo nndoc-article-transform-function nil)
+(defvoo nndoc-article-begin-function nil)
 
 (defvoo nndoc-status-string "")
 (defvoo nndoc-group-alist nil)
@@ -165,7 +166,8 @@ One of `mbox', `babyl', `digest', `news', `rnews', `mmdf', `forward',
                (insert-buffer-substring
                 nndoc-current-buffer (car entry) (nth 1 entry)))
              (goto-char (point-max))
-             (or (= (char-after (1- (point))) ?\n) (insert "\n"))
+             (unless (= (char-after (1- (point))) ?\n)
+               (insert "\n"))
              (insert (format "Lines: %d\n" (nth 4 entry)))
              (insert ".\n")))
 
@@ -335,7 +337,7 @@ One of `mbox', `babyl', `digest', `news', `rnews', `mmdf', `forward',
     t))
 
 (defun nndoc-mbox-article-begin ()
-  (when (re-search-forward (concat "^" message-unix-mail-delimiter))
+  (when (re-search-forward (concat "^" message-unix-mail-delimiter) nil t)
     (goto-char (match-beginning 0))))
 
 (defun nndoc-mbox-body-end ()
@@ -343,17 +345,18 @@ One of `mbox', `babyl', `digest', `news', `rnews', `mmdf', `forward',
        len end)
     (when
        (save-excursion
-         (and (re-search-backward nndoc-article-begin nil t)
+         (and (re-search-backward 
+               (concat "^" message-unix-mail-delimiter) nil t)
               (setq end (point))
               (search-forward "\n\n" beg t)
               (re-search-backward
                "^Content-Length:[ \t]*\\([0-9]+\\) *$" end t)
               (setq len (string-to-int (match-string 1)))
               (search-forward "\n\n" beg t)
-              (or (= (setq len (+ (point) len)) (point-max))
-                  (and (< len (point-max))
-                       (goto-char len)
-                       (looking-at nndoc-article-begin)))))
+              (unless (= (setq len (+ (point) len)) (point-max))
+                (and (< len (point-max))
+                     (goto-char len)
+                     (looking-at message-unix-mail-delimiter)))))
       (goto-char len))))
 
 (defun nndoc-mmdf-type-p ()
@@ -527,9 +530,7 @@ One of `mbox', `babyl', `digest', `news', `rnews', `mmdf', `forward',
       ;; Go through the file.
       (while (if (and first nndoc-first-article)
                 (nndoc-search nndoc-first-article)
-              (condition-case ()
-                  (nndoc-search nndoc-article-begin)
-                (error nil)))
+              (nndoc-article-begin))
        (setq first nil)
        (cond (nndoc-head-begin-function
               (funcall nndoc-head-begin-function))
@@ -550,9 +551,7 @@ One of `mbox', `babyl', `digest', `news', `rnews', `mmdf', `forward',
                   (funcall nndoc-body-end-function))
              (and nndoc-body-end
                   (nndoc-search nndoc-body-end))
-             (condition-case ()
-                 (nndoc-search nndoc-article-begin)
-               (error nil))
+             (nndoc-article-begin)
              (progn
                (goto-char (point-max))
                (when nndoc-file-end
@@ -563,6 +562,13 @@ One of `mbox', `babyl', `digest', `news', `rnews', `mmdf', `forward',
                      (count-lines body-begin body-end))
                nndoc-dissection-alist))))))
 
+(defun nndoc-article-begin ()
+  (if nndoc-article-begin-function
+      (funcall nndoc-article-begin-function)
+    (condition-case ()
+       (nndoc-search nndoc-article-begin)
+      (error nil))))
+
 (defun nndoc-unquote-dashes ()
   "Unquote quoted non-separators in digests."
   (while (re-search-forward "^- -"nil t)