Gnus development mailing list
 help / color / mirror / Atom feed
From: Lars Magne Ingebrigtsen <larsi@gnus.org>
Subject: Re: Backing up expired mail?
Date: 27 Apr 1997 11:01:01 +0200	[thread overview]
Message-ID: <m24tcsx2k2.fsf@proletcult.slip.ifi.uio.no> (raw)
In-Reply-To: Steinar Bang's message of 24 Apr 1997 19:00:10 +0200

Steinar Bang <sb@metis.no> writes:

> > I'd suggest doing this from inside Gnus.  Write a macro to enter the
> > group, process-mark all the articles and `B m' them to somewhere
> > else.
> 
> Hm... is this a keyboard macro, or a lisp macro? (I've never quite
> understood lisp macros...).

Keyboard macro.

> What would be the best/simplest way to gzip the articles, after I've
> moved them?

Hm...  I think the easiest would be to do it from a shell, but you can
also do some mapcar'ing on the output from `directory-files'.  Perhaps
there should be a function to do this; it's not uncommon that one
wants to do something like this.

  (shell-map-directory-files "~/some/dir/" "gzip" "^[0-9]+$")

to run gzip on all files that match that regexp.

Howzabout this:

(defun shell-map-directory-files (directory program &optional regularp match)
  "Execute PROGRAM on all the files in DIRECTORY.
If REGULARP (the prefix), only use the files that are regular files.
If MATCH, only use the files that match this regexp.

If PROGRAM contains the string \"%s\", insert each file name to be
processed there.  For instance:

   \(shell-map-directory-files \"~/smallfiles\" \"cat %s >> /tmp/bigfile\" t)

The number of files processed will be returned."
  (interactive "DDirectory: \nsProgram: \nP")
  (let ((format (if (string-match "%s" program) 'format 'concat)))
    (length
     (mapcar
      (lambda (file)
	(call-process shell-file-name nil nil nil shell-command-switch
		      (funcall format program file)))
      (directory-files directory t match)))))

If this seems useful, I'll mail it to RMS and see whether it can be
included in Emacs.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


  reply	other threads:[~1997-04-27  9:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-19 14:23 Norman Walsh
1997-04-21  0:35 ` Lars Magne Ingebrigtsen
1997-04-22  9:07   ` Norman Walsh
1997-04-24 12:01     ` Lars Magne Ingebrigtsen
1997-04-24 17:00       ` Steinar Bang
1997-04-27  9:01         ` Lars Magne Ingebrigtsen [this message]
1997-04-22 11:14   ` Hrvoje Niksic
1997-04-22  2:16 ` Dewey M. Sasser
1997-04-24 12:01   ` Lars Magne Ingebrigtsen

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=m24tcsx2k2.fsf@proletcult.slip.ifi.uio.no \
    --to=larsi@gnus.org \
    /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).