(article-begin . "^#! *rnews +\\([0-9]+\\) *\n")
(body-end-function . nndoc-rnews-body-end))
(mbox
- (article-begin .
- ,(let ((delim (concat "^" message-unix-mail-delimiter)))
- (if (string-match "\n\\'" delim)
- (substring delim 0 (match-beginning 0))
- delim)))
+ (article-begin-function . nndoc-mbox-article-begin)
(body-end-function . nndoc-mbox-body-end))
(babyl
(article-begin . "\^_\^L *\n")
(subtype digest guess))
(standard-digest
(first-article . ,(concat "^" (make-string 70 ?-) "\n\n+"))
- (article-begin . ,(concat "\n\n" (make-string 30 ?-) "\n\n+"))
+ (article-begin . ,(concat "^\n" (make-string 30 ?-) "\n\n+"))
(prepare-body-function . nndoc-unquote-dashes)
(body-end-function . nndoc-digest-body-end)
(head-end . "^ ?$")
(body-begin . "^ ?$")
(file-end . "^End of")
(prepare-body-function . nndoc-unquote-dashes)
- (subtype digest)) ;; impossible to really guess?
+ (subtype digest guess))
(lanl-gov-announce
(article-begin . "^\\\\\\\\\n")
(head-begin . "^Paper.*:")
- (head-end . "^\\\\\\\\\n")
- (body-begin . "")
- (body-end . "-------------------------------------------------")
+ (head-end . "\\(^\\\\\\\\.*\n\\|-----------------\\)")
+ (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)
(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)
(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")))
(when (looking-at message-unix-mail-delimiter)
t))
+(defun nndoc-mbox-article-begin ()
+ (when (re-search-forward (concat "^" message-unix-mail-delimiter) nil t)
+ (goto-char (match-beginning 0))))
+
(defun nndoc-mbox-body-end ()
(let ((beg (point))
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 ()
(defun nndoc-babyl-body-begin ()
(re-search-forward "^\n" nil t)
(when (looking-at "\*\*\* EOOH \*\*\*")
- (re-search-forward "^\n" nil t)))
+ (let ((next (or (save-excursion
+ (re-search-forward nndoc-article-begin nil t))
+ (point-max))))
+ (unless (re-search-forward "^\n" next t)
+ (goto-char next)
+ (forward-line -1)
+ (insert "\n")
+ (forward-line -1)))))
(defun nndoc-babyl-head-begin ()
(when (re-search-forward "^[0-9].*\n" nil t)
(defun nndoc-mime-digest-type-p ()
(let ((case-fold-search t)
boundary-id b-delimiter entry)
- (when (and
- (re-search-forward
- (concat "^Content-Type: *multipart/digest;[ \t\n]*[ \t]"
- "boundary=\"\\([^\"\n]*[^\" \t\n]\\)\"")
- nil t)
- (match-beginning 1))
- (setq boundary-id (match-string 1)
- b-delimiter (concat "\n--" boundary-id "[\n \t]+"))
- (setq entry (assq 'mime-digest nndoc-type-alist))
- (setcdr entry
- (list
- (cons 'head-end "^ ?$")
- (cons 'body-begin "^ ?\n")
- (cons 'article-begin b-delimiter)
- (cons 'body-end-function 'nndoc-digest-body-end)
- (cons 'file-end (concat "\n--" boundary-id "--[ \t]*$"))))
- t)))
+ (when (and
+ (re-search-forward
+ (concat "^Content-Type: *multipart/digest;[ \t\n]*[ \t]"
+ "boundary=\"\\([^\"\n]*[^\" \t\n]\\)\"")
+ nil t)
+ (match-beginning 1))
+ (setq boundary-id (match-string 1)
+ b-delimiter (concat "\n--" boundary-id "[\n \t]+"))
+ (setq entry (assq 'mime-digest nndoc-type-alist))
+ (setcdr entry
+ (list
+ (cons 'head-end "^ ?$")
+ (cons 'body-begin "^ ?\n")
+ (cons 'article-begin b-delimiter)
+ (cons 'body-end-function 'nndoc-digest-body-end)
+ (cons 'file-end (concat "\n--" boundary-id "--[ \t]*$"))))
+ t)))
(defun nndoc-standard-digest-type-p ()
(when (and (re-search-forward (concat "^" (make-string 70 ?-) "\n\n") nil t)
(setq subject (concat (match-string 1) subject))
(setq from (concat (match-string 2) " <" e-mail ">"))))
))
- (while (string-match "(\[^)\]*)" from)
+ (while (and from (string-match "(\[^)\]*)" from))
(setq from (replace-match "" t t from)))
(insert "From: " (or from "unknown")
"\nSubject: " (or subject "(no subject)") "\n")))
;; Go through the file.
(while (if (and first nndoc-first-article)
(nndoc-search nndoc-first-article)
- (nndoc-search nndoc-article-begin))
+ (nndoc-article-begin))
(setq first nil)
(cond (nndoc-head-begin-function
(funcall nndoc-head-begin-function))
(nndoc-head-begin
(nndoc-search nndoc-head-begin)))
- (if (and nndoc-file-end
- (looking-at nndoc-file-end))
+ (if (or (>= (point) (point-max))
+ (and nndoc-file-end
+ (looking-at nndoc-file-end)))
(goto-char (point-max))
(setq head-begin (point))
(nndoc-search (or nndoc-head-end "^$"))
(funcall nndoc-body-end-function))
(and nndoc-body-end
(nndoc-search nndoc-body-end))
- (nndoc-search nndoc-article-begin)
+ (nndoc-article-begin)
(progn
(goto-char (point-max))
(when nndoc-file-end
(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)