CLOS / MOP discussion archives for Thunderbird

From: Pascal Costanza (costanza_at_web.de)
Date: 11/25/04


Date: Thu, 25 Nov 2004 18:04:05 +0100

Hi,

The ftp site ftp://parcftp.xerox.com/pub/pcl/ contains an archive of
what seems to be the original mailing list for the designers of CLOS and
its MOP. There is a lot of information contained in it that explains the
ideas and rationale behind the design decisions.

The problem with that archive is that it is stored in a format that
doesn't seem to comply with current mailbox formats. A friend of mine
(Axel Katerbau from http://www.objectpark.net/ ) has some experience
with such formats, and so has written one of his first Lisp programs to
convert the format of that archive to one that is accepted by
Thunderbird / Mozilla. The conversion is not perfect, but makes the
archive much more readable. (Unfortunately, the conversion doesn't work
well for Apple Mail, and probably other mail clients.)

Anyway, here is the program for doing the conversion (I have polished it
a bit). I hope this is helpful to some.

Pascal

(defun received-line-p (line)
   "Test whether it's a line beginning with Received: "
   (eql (search "Received: " line) 0))

(defun copy-header (input output)
   "Read rest of message header"
   (loop for line = (read-line input nil "")
         until (equal line "")
         do (format output "~A~%" line)))

(defun from-quoted-body-line (line)
   (if (eql (search "From " line) 0)
       (format nil ">~A" line)
     line))

(defun convert-ml (path)
   "Converts a strange mailinglist archive (e.g. mob.text)
    at the given path into mbox format (<path>.mbox)"
   (with-open-file (input path :direction :input)
     (with-open-file (output (format nil "~A.mbox" path)
                             :direction :output :if-exists :supersede)
       (loop for line = (read-line input nil 'eof)
             until (eq line 'eof)
             if (received-line-p line)
             do (progn
                  (format output "From <new msg marker>~%~A~%" line)
                  (copy-header input output)
                  (format output "~%"))
             else do (format output "~A~%"
                             (from-quoted-body-line line))))))

-- 
Tyler: "How's that working out for you?"
Jack: "Great."
Tyler: "Keep it up, then."


Relevant Pages

  • Re: CLOS / MOP discussion archives for Thunderbird
    ... > convert the format of that archive to one that is accepted by ... The conversion is not perfect, ... and probably other mail clients.) ... (defun copy-header (input output) ...
    (comp.lang.lisp)
  • Proposal: String::Format::General
    ... It provides format string parsing and output assembly, you provide the code that implements the individual conversion characters. ... Format syntax is kind of a cross between sprintf and strftime, but how close it is to each of these depends on the semantics implemented by the user. ... Note that the following is pre-alpha documentation; the interface to the output conversion code has changed since yesterday, ... conversion character, and contain a number of optional fields which may ...
    (comp.lang.perl.modules)
  • Proposal: String::Format::General
    ... This should be considered pre-Alpha, since it has changed since yesterday, and I am seriously considering passing the format parameters to the output conversion code as a hash reference instead of a large number of arguments. ... Some limited heading capability is provided. ... This module provides a formatter class which allows its user to ...
    (comp.lang.perl.modules)
  • Proposal: String::Format::General
    ... It's almost a meta-formatter with the user providing individual conversion code behind a sprintf/strftime-like interface. ... A format is basically a string into which data are to be inserted. ... conversion character, and contain a number of optional fields which may ...
    (comp.lang.perl.modules)
  • Re: Proposal: String::Format::General
    ... It's almost a meta-formatter with the user providing individual conversion code behind a sprintf/strftime-like interface. ... A format is basically a string into which data are to be inserted. ... conversion character, and contain a number of optional fields which may ...
    (comp.lang.perl.modules)