Function: nndoc-generate-lanl-gov-head

nndoc-generate-lanl-gov-head is a byte-compiled function defined in nndoc.el.gz.

Signature

(nndoc-generate-lanl-gov-head ARTICLE)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nndoc.el.gz
(defun nndoc-generate-lanl-gov-head (article)
  (let ((entry (cdr (assq article nndoc-dissection-alist)))
	(from "<no address given>")
	subject date)
    (with-current-buffer nndoc-current-buffer
      (save-restriction
	(narrow-to-region (car entry) (nth 1 entry))
	(goto-char (point-min))
	(when (looking-at "^\\(Paper.*: \\|arXiv:\\)\\([0-9a-zA-Z\\./-]+\\)")
	  (setq subject (concat " (" (match-string 2) ")"))
	  (when (re-search-forward "^From: \\(.*\\)" nil t)
	    (setq from (concat "<"
			       (cadr (funcall gnus-extract-address-components
					      (match-string 1))) ">")))
	  (if (re-search-forward "^Date: +\\([^(]*\\)" nil t)
	      (setq date (match-string 1))
	    (when (re-search-forward "^replaced with revised version +\\([^(]*\\)" nil t)
	      (setq date (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) " " 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")
    (if date (insert "Date: " date))))