From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/7313 Path: main.gmane.org!not-for-mail From: Jan Vroonhof Newsgroups: gmane.emacs.gnus.general Subject: [Red Gnus, prototype patch] nndoc support for preprint announcements (xxx.lanl.gov) Date: 23 Jul 1996 11:56:26 +0200 Sender: vroonhof@math.ethz.ch Message-ID: NNTP-Posting-Host: coloc-standby.netfonds.no X-Trace: main.gmane.org 1035147644 6807 80.91.224.250 (20 Oct 2002 21:00:44 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 21:00:44 +0000 (UTC) Cc: ding@ifi.uio.no Return-Path: ding-request@ifi.uio.no Original-Received: from ifi.uio.no (ifi.uio.no [129.240.64.2]) by deanna.miranova.com (8.7.5/8.6.9) with SMTP id DAA01347 for ; Tue, 23 Jul 1996 03:24:44 -0700 Original-Received: from frege.math.ethz.ch (root@frege-math-bb.math.ethz.ch [129.132.148.14]) by ifi.uio.no with ESMTP (8.6.11/ifi2.4) id ; Tue, 23 Jul 1996 11:57:05 +0200 Original-Received: from fresnel.math.ethz.ch (vroonhof@fresnel-d-math-south-g-servers.math.ethz.ch [129.132.145.6]) by frege.math.ethz.ch (8.6.4/Main-mathdept-mailer) with ESMTP id LAA10411; Tue, 23 Jul 1996 11:56:59 +0200 Original-Received: (vroonhof@localhost) by fresnel.math.ethz.ch (8.6.9/D-MATH-client) id LAA04602; Tue, 23 Jul 1996 11:56:26 +0200 Original-To: Lars Magne Ingebrigtsen In-Reply-To: Lars Magne Ingebrigtsen's message of 19 Jul 1996 02:13:16 +0200 Original-Lines: 156 X-Mailer: Gnus v5.2.37/XEmacs 19.14 Xref: main.gmane.org gmane.emacs.gnus.general:7313 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:7313 Hi Lars and all, Naturally I split the daily preprint announcements I receive into different mailgroups. Now it occured to me that they look a lot like digests and so they would be a nice application for nndoc. Just to see how difficult or easy it was I tried it and low and behold it works! It is soooooo easy! (Thanks Lars!). I have included the patch below. Now this is a good application of the kibozed-collection-of-nndoc-groups-of-all-messages-in-a-group backend-to-come of Red Gnus if there ever was one. Jan P.S. I just noticed that the patch does't properly defvar nndoc-type-alist, sorry. defvar is a pain if you are debugging. Patch: *** /u/users/vroonhof/jvsoft/lib/xemacs/site-lisp/gnus-5.2.37/lisp/ChangeLog Fri Jul 19 01:27:46 1996 --- ChangeLog Mon Jul 22 23:11:38 1996 *************** *** 1,3 **** --- 1,10 ---- + Mon Jul 22 23:09:25 1996 Jan Vroonhof + + * nndoc.el (nndoc-type-alist): Added support for xxx.lanl.gov + preprint announcements + (nndoc-generate-preprint-announce-head): New function + (nndoc-transform-preprint-announce): New functions + Fri Jul 19 00:31:22 1996 Lars Magne Ingebrigtsen * gnus.el (gnus-subscribe-newsgroup): Add new groups to top-level *** /u/users/vroonhof/jvsoft/lib/xemacs/site-lisp/gnus-5.2.37/lisp/nndoc.el Wed Jun 5 19:17:38 1996 --- nndoc.el Mon Jul 22 23:09:46 1996 *************** *** 43,49 **** (defvoo nndoc-post-type 'mail "*Whether the nndoc group is `mail' or `post'.") ! (defvar nndoc-type-alist `((mmdf (article-begin . "^\^A\^A\^A\^A\n") (body-end . "^\^A\^A\^A\^A\n")) --- 43,50 ---- (defvoo nndoc-post-type 'mail "*Whether the nndoc group is `mail' or `post'.") ! (defvar nndoc-type-alist nil) ! (setq nndoc-type-alist `((mmdf (article-begin . "^\^A\^A\^A\^A\n") (body-end . "^\^A\^A\^A\^A\n")) *************** *** 75,80 **** --- 76,90 ---- (head-end . "^\t") (generate-head . nndoc-generate-clari-briefs-head) (article-transform . nndoc-transform-clari-briefs)) + (preprint-announce + (article-begin . "^\\\\\\\\\n") + (head-begin . "^Paper.*:") + (head-end . "^\\\\\\\\\n") + (body-begin . "") + (body-end . "-------------------------------------------------") + (file-end . "^Title: Recent Seminal") + (generate-head . nndoc-generate-preprint-announce-head) + (article-transform . nndoc-transform-preprint-announce)) (slack-digest (article-begin . "^------------------------------*[\n \t]+") (head-end . "^ ?$") *************** *** 326,331 **** --- 336,344 ---- ((let ((case-fold-search nil)) (re-search-forward "^\t[^a-z]+ ([^a-z]+) --" nil t)) 'clari-briefs) + ((let ((case-fold-search nil)) + (re-search-forward "^\\\\\\\\\nPaper: [a-z-]+/[0-9]+" nil t)) + 'preprint-announce) (t 'digest))) *************** *** 335,341 **** nndoc-first-article nndoc-article-end nndoc-head-begin nndoc-head-end nndoc-file-end nndoc-article-begin ! nndoc-body-begin nndoc-body-end-function nndoc-body-end nndoc-prepare-body nndoc-article-transform nndoc-generate-head nndoc-body-begin-function nndoc-head-begin-function))) --- 348,355 ---- nndoc-first-article nndoc-article-end nndoc-head-begin nndoc-head-end nndoc-file-end nndoc-article-begin ! nndoc-body-begin nndoc-body-begin ! doc-body-end-function nndoc-body-end nndoc-prepare-body nndoc-article-transform nndoc-generate-head nndoc-body-begin-function nndoc-head-begin-function))) *************** *** 471,476 **** --- 485,523 ---- (forward-line 1)) t)) + (defun nndoc-transform-preprint-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)) + + ; (run-hooks 'nndoc-preprint-announce-body-prepare-hook) + ; (nndoc-generate-preprint-announce-head article) + ) + + (defun nndoc-generate-preprint-announce-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 subject (match-string 1))) + (setq from (concat (match-string 2) " <" e-mail ">")))) + )) + (insert "From: " (or from "unknown") + "\nSubject: " (or subject "(no subject)") "\n"))) + + (provide 'nndoc) ;;; nndoc.el ends here -- Jan Vroonhof http://www.math.ethz.ch/~vroonhof/ Mathematik, vroonhof@math.ethz.ch HG E16, ETH-Zentrum, Tel: +41-1-6325456/25154 Raemistrasse 101, CH-8092 Zuerich. Fax: +41-1-6321085