🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.gnus
Article #81474

Re: To Those who know elisp: How to gather whole "GNUS" group to file??

#81474
From: Steve Preston
Date: Wed, 03 Feb 1993 03:25
88 lines
4175 bytes
>>>>> In article <JAALTO.93Feb1112432@elite.tre.tele.nokia.fi>, jaalto@tre.tele.nokia.fi (Jari Aalto) writes:
> 	The problem I can't figure out is that I don't know any means to
> 	put all articles in a specified newsgroup to a single file with
> 	a one comman or GNU-macro.

I wrote the following, which pretty much does what you want.  It is
from a file called "gnus-auto-save.el" and I added these lines to my
.emacs file.

(autoload 'gnus-save-all-unreads "gnus-auto-save"
	  "save all unread articles from current Newsgroup down" t)
(autoload 'gnus-save-current-group  "gnus-auto-save"
	  "save all unread articles from current Newsgroup only" t)

They can be executed (via eg: M-x gnus-save-all-unreads ) from the
*Newsgroup* buffer of gnus.

----------------------------------------------------------------------
(defun gnus-save-current-group ()
  "Get all unread articles in current group.  Can be executed
from *Newsgroup* buffer"
  (interactive)
  (gnus-Group-save-unread-articles (gnus-Group-group-name))
  (gnus-Group-catch-up nil t))

(defun gnus-Group-save-unread-articles (group)
  "Get all unread articles in GROUP and save them for local
reading later"
  (interactive)
  (gnus-select-newsgroup group)
  (let ((articles gnus-newsgroup-unreads)
	(gnus-break-pages nil) ;; otherwise ^L in article prevent saving of whole article
	filename)
    (set-buffer gnus-Article-buffer)
    (if (null articles) nil
      (setq filename
	    (expand-file-name
	     (if gnus-use-long-file-name
		 group
	       (gnus-newsgroup-directory-form group))
	     (or gnus-article-save-directory "~/News")))
      (gnus-make-directory filename))
    (while articles
      (gnus-Article-prepare (car articles) t)
      (setq filename (gnus-numeric-save-name group gnus-current-headers))
      (gnus-output-to-file filename)
      (setq articles (cdr articles))
      )))

(defun gnus-save-all-unreads ()
  "Save all unread articles in the current newsgroup (in gnus-Group-buffer)
and all those below current newsgroup.  Thus if point is on the first
newsgroup, all unread articles in subscribed groups will be saved.
NOTE: the environment variable SAVEDIR can be set to the desired
      destination for the saved articles."
  (interactive)
  (get-buffer-create gnus-Article-buffer)
  (set-buffer gnus-Group-buffer)
  (setq gnus-large-newsgroup 999)
  (let ((continue t)
	(gnus-Mark-article-hook nil) ;; so we dont need Subject buffer; no Marking, saves time
	)
    (while (eq continue t)
      (save-excursion
	(gnus-Group-save-unread-articles (gnus-Group-group-name)))
      (setq continue (gnus-Group-catch-up nil t))))
  (gnus-save-newsrc-file))

(defun gnus-save-all-groups ()
  "Meant to be called non-interactively by saying:
      emacs -batch -l gnus-auto-save -f gnus-save-all-groups [news server]
from a shell prompt.  The news server will be prompted for if it is omitted"
  (if (not noninteractive)
      (error "gnus-save-all-groups is to be used only with -batch"))
  ;; check for nntp server name on command line
  (if command-line-args-left
      (setq gnus-nntp-server (car command-line-args-left)))
  (load "gnus")
  (gnus)
  (gnus-save-all-unreads)
  (kill-emacs 0)
  )
----------------------------------------------------------------------

Good luck.
--
--
Steve Preston (spreston@gte.com)
Technical Details
Message-ID: <STEVE.93Feb2222504@eowyn.gte.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!bu.edu!lll-winken!uwm.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!usenet.ins.cwru.edu!agate!spool.mu.edu!hri.com!noc.near.net!ceylon!steve
References: <JAALTO.93Feb1112432@elite.tre.tele.nokia.fi>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1016f0,13245c2f04db532b
X-Google-Attributes: gid1016f0,public
X-Google-ArrivalTime: 1993-02-04 08:37:25 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!bu.edu!lll-winken!uwm.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!usenet.ins.cwru.edu!agate!spool.mu.edu!hri.com!noc.near.net!ceylon!steve
From: steve@eowyn.gte.com (Steve Preston)
Newsgroups: gnu.emacs.gnus
Subject: Re: To Those who know elisp: How to gather whole "GNUS" group to file??
Message-ID: <STEVE.93Feb2222504@eowyn.gte.com>
Date: 3 Feb 93 03:25:04 GMT
References: <JAALTO.93Feb1112432@elite.tre.tele.nokia.fi>
Sender: news@ceylon.gte.com
Organization: GTE Laboratories
Lines: 88
In-reply-to: jaalto@tre.tele.nokia.fi's message of 1 Feb 93 09:24:32 GMT