Gnus development mailing list
 help / color / mirror / Atom feed
From: Dan Christensen <jdc+news@uwo.ca>
Subject: Re: C-d heuristics
Date: Tue, 23 Apr 2002 23:02:52 -0400	[thread overview]
Message-ID: <87ofg9ol2b.fsf@uwo.ca> (raw)
In-Reply-To: <871yepo3tl.fsf@uwo.ca> (Dan Christensen's message of "Tue, 12 Mar 2002 16:48:22 -0500")

[-- Attachment #1: Type: text/plain, Size: 920 bytes --]

Dan Christensen <jdc+news@uwo.ca> writes:

> Attached are two articles of a sort that I receive daily.
> On the first one, if I hit C-d, I get a nice summary buffer
> which uses the Authors field for the From information and
> the Title field for the Subject.  But on the second one
> I get the From information from the (less useful) From
> header, and I get no subject.  Could the heuristics of
> C-d be tweaked to handle the second case better?

I fixed this problem and many other problems with the handling
of the lanl nndoc type:

- recognizes math postings properly now (original problem)
- extracts Date correctly
- extracts e-mail address correctly
- creates Date header for revised versions
- creates From header for revised versions
- gets rid of spurious \\ lines
- detects end of message correctly
- correctly rephrases the URL

Could someone please apply this patch?  I have papers on file.

Thanks,

Dan


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nndoc.el.patch --]
[-- Type: text/x-patch, Size: 3541 bytes --]

--- nndoc.el.orig	Thu Apr 11 21:28:18 2002
+++ nndoc.el	Tue Apr 23 22:59:51 2002
@@ -123,8 +123,8 @@
      (head-begin . "^Paper.*:")
      (head-end   . "\\(^\\\\\\\\.*\n\\|-----------------\\)")
      (body-begin . "")
-     (body-end   . "-------------------------------------------------")
-     (file-end   . "^Title: Recent Seminal")
+     (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))
@@ -597,35 +597,54 @@
 
 (defun nndoc-lanl-gov-announce-type-p ()
   (when (let ((case-fold-search nil))
-	  (re-search-forward "^\\\\\\\\\nPaper: [a-z-]+/[0-9]+" nil t))
+	  (re-search-forward "^\\\\\\\\\nPaper\\( (\\*cross-listing\\*)\\)?: [a-zA-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 "\n\nGet it at \\1 (\\2)" t nil))
+  (goto-char (point-min))
+  (while (re-search-forward "^\\\\\\\\$" nil t)
+    (replace-match "" t nil))
+  (goto-char (point-min))
+  (when (re-search-forward "^replaced with revised version +\\(.*[^ ]\\) +" nil t)
+    (replace-match "Date: \\1 (revised) " t nil))
+  (goto-char (point-min))
+  (unless (re-search-forward "^From" nil t)
+    (goto-char (point-min))
+    (when (re-search-forward "^Authors?: \\(.*\\)" nil t)
+      (goto-char (point-min))
+      (insert "From: " (match-string 1) "\n"))))
 
 (defun nndoc-generate-lanl-gov-head (article)
   (let ((entry (cdr (assq article nndoc-dissection-alist)))
-	(e-mail "no address given")
-	subject from)
+	(from "<no address given>")
+	subject date)
     (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]+\\)")
+	(when (looking-at "^Paper.*: \\([a-zA-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 "^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) " <" e-mail ">"))))))
+	    (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")))
+	    "\nSubject: " (or subject "(no subject)") "\n")
+    (if date (insert "Date: " date))))
 
 (defun nndoc-nsmail-type-p ()
   (when (looking-at "From - ")

  parent reply	other threads:[~2002-04-24  3:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-12 21:48 Dan Christensen
2002-03-12 22:08 ` Ted Stern
2002-04-24  3:02 ` Dan Christensen [this message]
2002-04-24 11:25   ` Kai Großjohann
2002-04-24 18:59     ` Dan Christensen
2002-04-24 19:36       ` Kai Großjohann
2002-04-24 19:33 Ted Stern
2002-04-25  7:43 ` Kai Großjohann
2002-04-25  7:44 ` Kai Großjohann
2002-04-25 19:11 Ted Stern
2002-04-26 11:10 ` Kai Großjohann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ofg9ol2b.fsf@uwo.ca \
    --to=jdc+news@uwo.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).