Gnus development mailing list
 help / color / mirror / Atom feed
From: Jan Vroonhof <vroonhof@math.ethz.ch>
Cc: ding@ifi.uio.no
Subject: [Red Gnus, prototype patch] nndoc support for preprint announcements (xxx.lanl.gov)
Date: 23 Jul 1996 11:56:26 +0200	[thread overview]
Message-ID: <byzq4ruwc5.fsf@math.ethz.ch> (raw)
In-Reply-To: Lars Magne Ingebrigtsen's message of 19 Jul 1996 02:13:16 +0200


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  <vroonhof@math.ethz.ch (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  <larsi@ifi.uio.no>
  
  	* 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


                 reply	other threads:[~1996-07-23  9:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=byzq4ruwc5.fsf@math.ethz.ch \
    --to=vroonhof@math.ethz.ch \
    --cc=ding@ifi.uio.no \
    /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).