unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Michael Reilly <pmr@pajato.com>
Cc: stephen@xemacs.org, emacs-devel@gnu.org
Subject: Re: Need some help with Rmail/mbox
Date: Fri, 19 Sep 2008 12:32:40 +0300	[thread overview]
Message-ID: <u8wtoqy4n.fsf@gnu.org> (raw)
In-Reply-To: <48D33A10.4040102@pajato.com>

> Date: Fri, 19 Sep 2008 01:35:12 -0400
> From: Paul Michael Reilly <pmr@pajato.com>
> Cc: emacs-devel@gnu.org
> 
> I first copy the relevant headers to the view buffer by collecting
> them from the PMAIL buffer into a string and insert the string into
> the view buffer.

I hope you use insert-buffer-substring instead of actually making a
string and inserting it.  Consing large strings is not a good idea, if
all you need is copy text from one buffer to another.

> Then I basically copy the message body into a string and insert it
> into the view buffer.

Same comment as above.

> But when I started to work on the decoding it seemed that decoding
> the string before inserting it seemed like a good idea.

Actually, it isn't: in Emacs, whenever you can work on a buffer
instead of a string, you should generally prefer a buffer.
Specifically, decoding of strings uses scratch buffers behind your
back, and you don't gain anything in efficiency.

So just copy the text to the view buffer, then decode it in-place.

> (Pardon my Elisp rustiness ... is it better to use buffer to
> buffer copying than insert string?)

Yes.

> If you had said content type and content encoding I would have said
> "yup" and that is what led to my request for help.  Except for the
> case of quoted-printable and base64 I'm not sure how to parse those
> two headers (Content-Type and Content-Transfer-Encoding) into a coding
> system so that I can then do the decoding.

You should parse them separately, and use them separately, just like
Rmail/Babyl does: first decode qp or b64 into 8-bit encoded bytes,
then decode the rest using the charset gleaned from the Content-Type
header.

> I'm assuming the coding system guesswork becomes relevant for
> combinations of the two headers that Rmail does not grok.

This should not happen, in general; but for more robust code, you
could try `undecided' if all else fails; this is what Rmail/Babyl
does.  See rmail-decode-region.

> And I now see that there is a strong relationship between charset
> and coding system.

Yes; they are mostly the same.  Emacs defines an alias coding-system
for every MIME charset, IIRC.

> OK, this is helpful.  I assume that for all other type/subtype cases
> we punt for now and use guessing or just raw text?

It's not raw text, it should be plain ASCII (before you qp- or
b64-decode them; I suggest not to decode their original qp or b64
encoding until you support those additional types).  Rmail/Babyl uses
`undecided' for those, and so can you.

> But certainly
> there are some that we want to process/decode in some fashion,
> e.g. text/html or text/xml.

Eventually, yes.

> Is there another Emacs package/library
> that you are aware of that provides a good model for where we want to
> take Rmail so that it handles more type/subtype cases seamlessly in
> the view buffer? Even perhaps audio and video (not pure MIME,
> i.e. multipart ... yet).

Gnus, of course.  But again, I suggest not to bother about these
extensions for now: just make Rmail/mbox be no worse than Rmail/Babyl,
so that people could start using it.  Extensions can come later.

> >         Wash body for presentation, eg:
> >             Highlight and activate url-like substrings
> >             Highlight quoted material
> 
> I don't believe Rmail does either of these operations now.

Right, it doesn't.  We have ffap and similar features to do that
without highlighting, although highlighting would be nice (again, as
an extension of what Rmail does now).




  reply	other threads:[~2008-09-19  9:32 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 16:02 Need some help with Rmail/mbox Paul Michael Reilly
2008-09-19  3:28 ` Stephen J. Turnbull
2008-09-19  5:35   ` Paul Michael Reilly
2008-09-19  9:32     ` Eli Zaretskii [this message]
2008-09-20  7:12     ` Stephen J. Turnbull
2008-09-20 10:04       ` Daiki Ueno
2008-09-20 10:19         ` Eli Zaretskii
2008-09-20 10:46           ` Daiki Ueno
2008-09-20 11:30             ` Eli Zaretskii
2008-09-20 23:33               ` Richard M. Stallman
2008-09-21  3:18                 ` Eli Zaretskii
2008-09-21 13:34               ` Stefan Monnier
2008-09-21 17:59                 ` Eli Zaretskii
2008-09-21 19:26                   ` Stefan Monnier
2008-09-21 20:56                     ` Eli Zaretskii
2008-09-21 22:07                       ` Stefan Monnier
2008-09-22  3:07                         ` Eli Zaretskii
2008-09-22  3:36                           ` Stefan Monnier
2008-09-22  3:41                           ` Daiki Ueno
2008-09-22  3:58                             ` Stefan Monnier
2008-09-22 18:48                               ` Eli Zaretskii
2008-09-22  4:31                         ` Kenichi Handa
2008-09-22 14:10                           ` Stefan Monnier
2008-09-24  0:56                             ` Kenichi Handa
2008-09-24  2:53                               ` Stefan Monnier
2008-09-24  3:48                                 ` Kenichi Handa
2008-09-22 15:24                           ` Paul Michael Reilly
2008-09-20 13:48         ` Stephen J. Turnbull
2008-09-21  0:57           ` Daiki Ueno
2008-09-22  9:14             ` Stephen J. Turnbull
2008-09-19  4:30 ` Richard M. Stallman
2008-09-19  4:30 ` Richard M. Stallman
2008-09-19  9:12 ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=u8wtoqy4n.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=pmr@pajato.com \
    --cc=stephen@xemacs.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).