-;;; nndoc.el --- single file access for Gnus
;; Copyright (C) 1995,96 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
(file-end . "^End of")
(prepare-body-function . nndoc-unquote-dashes)
(subtype digest guess))
+ (lanl-gov-announce
+ (article-begin . "^\\\\\\\\\n")
+ (head-begin . "^Paper.*:")
+ (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)
+ (subtype preprints guess))
(guess
- (guess . nndoc-guess-type))
+ (guess . t)
+ (subtype nil))
(digest
- (guess . nndoc-guess-digest-type))
+ (guess . t)
+ (subtype nil))
+ (preprints
+ (guess . t)
+ (subtype nil))
))
\f
(set (pop vars) nil)))
(let (defs)
;; Guess away until we find the real file type.
- (while (setq defs (cdr (assq nndoc-article-type nndoc-type-alist))
- guess (assq 'guess defs))
+ (while (assq 'guess (setq defs (cdr (assq nndoc-article-type
+ nndoc-type-alist))))
(setq nndoc-article-type (nndoc-guess-type nndoc-article-type)))
;; Set the nndoc variables.
(while defs
(defun nndoc-slack-digest-type-p ()
0)
+(defun nndoc-lanl-gov-announce-type-p ()
+ (when (let ((case-fold-search nil))
+ (re-search-forward "^\\\\\\\\\nPaper: [a-z-]+/[0-9]+" nil t))
+ t))
+
+(defun nndoc-transform-lanl-gov-announce (article)
+ (goto-char (point-max))
+ (when (re-search-backward "^\\\\\\\\ +(\\([^ ]*\\) , *\\([^ ]*\\))" nil t)
+ (replace-match "\n\nGet it at \\1 (\\2)" t nil))
+ ;; (when (re-search-backward "^\\\\\\\\$" nil t)
+ ;; (replace-match "" t t))
+ )
+
+(defun nndoc-generate-lanl-gov-head (article)
+ (let ((entry (cdr (assq article nndoc-dissection-alist)))
+ (e-mail "no address given")
+ subject from)
+ (save-excursion
+ (set-buffer nndoc-current-buffer)
+ (save-restriction
+ (narrow-to-region (car entry) (nth 1 entry))
+ (goto-char (point-min))
+ (when (looking-at "^Paper.*: \\([a-z-]+/[0-9]+\\)")
+ (setq subject (concat " (" (match-string 1) ")"))
+ (when (re-search-forward "^From: \\([^ ]+\\)" nil t)
+ (setq e-mail (match-string 1)))
+ (when (re-search-forward "^Title: \\([^\f]*\\)\nAuthors?: \\(.*\\)"
+ nil t)
+ (setq subject (concat (match-string 1) subject))
+ (setq from (concat (match-string 2) " <" e-mail ">"))))
+ ))
+ (while (and from (string-match "(\[^)\]*)" from))
+ (setq from (replace-match "" t t from)))
+ (insert "From: " (or from "unknown")
+ "\nSubject: " (or subject "(no subject)") "\n")))
+
+
+
;;;
;;; Functions for dissecting the documents
;;;
(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 "^$"))
as the last checked definition, if t or `first', add as the
first definition, and if any other symbol, add after that
symbol in the alist."
+ ;; First remove any old instances.
+ (setq nndoc-type-alist
+ (delq (assq (car definition) nndoc-type-alist)
+ nndoc-type-alist))
+ ;; Then enter the new definition in the proper place.
(cond
((or (null position) (eq position 'last))
(setq nndoc-type-alist (nconc nndoc-type-alist (list definition))))
((or (eq position t) (eq position 'first))
(push definition nndoc-type-alist))
(t
- (let ((list (memq (assq position nndoc-type-alist))))
+ (let ((list (memq (assq position nndoc-type-alist)
+ nndoc-type-alist)))
(unless list
(error "No such position: %s" position))
(setcdr list (cons definition (cdr list)))))))