From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/44367 Path: main.gmane.org!not-for-mail From: Dan Christensen Newsgroups: gmane.emacs.gnus.general Subject: Re: C-d heuristics Date: Tue, 23 Apr 2002 23:02:52 -0400 Sender: owner-ding@hpc.uh.edu Message-ID: <87ofg9ol2b.fsf@uwo.ca> References: <871yepo3tl.fsf@uwo.ca> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1019617483 28800 127.0.0.1 (24 Apr 2002 03:04:43 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 24 Apr 2002 03:04:43 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 170D5G-0007UP-00 for ; Wed, 24 Apr 2002 05:04:42 +0200 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 170D4C-0000qH-00; Tue, 23 Apr 2002 22:03:36 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Tue, 23 Apr 2002 22:03:49 -0500 (CDT) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id WAA26842 for ; Tue, 23 Apr 2002 22:03:36 -0500 (CDT) Original-Received: (qmail 22061 invoked by alias); 24 Apr 2002 03:03:12 -0000 Original-Received: (qmail 22056 invoked from network); 24 Apr 2002 03:03:12 -0000 Original-Received: from pony.its.uwo.ca (129.100.2.63) by gnus.org with SMTP; 24 Apr 2002 03:03:12 -0000 Original-Received: from femail.its.uwo.ca (hurdle.its.uwo.ca [129.100.2.108]) by pony.its.uwo.ca (8.12.1/8.12.0) with ESMTP id g3O334C5004026 for ; Tue, 23 Apr 2002 23:03:11 -0400 (EDT) Original-Received: from localhost (ren.math.uwo.ca [129.100.75.76]) by femail.its.uwo.ca (8.12.1/8.12.0) with ESMTP id g3O32rGU000133 for ; Tue, 23 Apr 2002 23:02:53 -0400 (EDT) Original-Received: from jdc by localhost with local (Exim 3.35 #1 (Debian)) id 170D3U-0006FI-00; Tue, 23 Apr 2002 23:02:52 -0400 Original-To: ding@gnus.org Mail-Copies-To: nobody In-Reply-To: <871yepo3tl.fsf@uwo.ca> (Dan Christensen's message of "Tue, 12 Mar 2002 16:48:22 -0500") Original-Lines: 30 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-debian-linux-gnu) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:44367 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:44367 --=-=-= Dan Christensen 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=nndoc.el.patch --- 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 "") + 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 - ") --=-=-=--