Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
Subject: Re: mml-generate-default-type
Date: Thu, 28 Jul 2005 14:39:35 +0900	[thread overview]
Message-ID: <b9ybr4nsd48.fsf@jpl.org> (raw)
In-Reply-To: <v964uwxufq.fsf@marauder.physik.uni-ulm.de>

>>>>> In <v964uwxufq.fsf@marauder.physik.uni-ulm.de> Reiner Steib wrote:

> `M-x grep RET mml-generate-default-type SPC *.el RET' (in the v5-10
> branch) gives:

> ,----
>| grep -nH -e mml-generate-default-type *.el
>| mml.el:126:(defvar mml-generate-default-type "text/plain")
>| mml.el:440:			  (mml-generate-default-type "text/plain"))
>| mml.el:537:	       (mml-generate-default-type (if (equal type "digest")
>| mml.el:633:	      (not (equal type mml-generate-default-type))
> `----

I looked into it and realized the reason why
`mml-generate-default-type' is needed to be a variable, not a
constant.  It is a variable, but users must not modify the value!

> (1) Is there a good reason for the let-binding in line 440?

> 		    (let ((mml-boundary (mml-compute-boundary cont))
> 			  (mml-generate-default-type "text/plain"))
> 		      (mml-to-mime))

It is because `mml-generate-mime-1' is called recursively when a
user marks two or more articles and forwards them in a single
message.  In that case, `mml-generate-default-type' is bound as
"message/rfc822" for encoding each entire article at the first
time, but it should be "text/plain" to encode each body at the
second time.

The reason it is bound as "message/rfc822" at the first time is
to prevent the `Content-Type: message/rfc822' header being
inserted in each article part.  It is also the reason of the
following.

> (2) The code...

>     (when (or charset
> 	      parameters
> 	      flowed
> 	      (not (equal type mml-generate-default-type))
> 	      mml-insert-mime-headers-always)
>       [...]
>       (insert "Content-Type: " type)

>     ... suggests that `mml-generate-default-type' is the default
>     Content-Type that doesn't need to be declared according to the
>     relevant RFC(s).  In this case, `mml-generate-default-type' should
>     probably be a constant, I think.  And it should get a doc string.

The code is used not only to omit the `Content-Type: text/plain'
header but also to suppress inserting of the
`Content-Type: message/rfc822' header.  In the later case,
`mml-generate-default-type' is bound as "message/rfc822".



  reply	other threads:[~2005-07-28  5:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-27 13:14 mml-generate-default-type Reiner Steib
2005-07-28  5:39 ` Katsumi Yamaoka [this message]
2005-07-28 13:14   ` mml-generate-default-type Reiner Steib
2005-07-28 22:23     ` mml-generate-default-type Katsumi Yamaoka

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=b9ybr4nsd48.fsf@jpl.org \
    --to=yamaoka@jpl.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).