[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mail-add-attachment

From: Eli Zaretskii
Subject: Re: mail-add-attachment
Date: Fri, 09 Sep 2011 18:04:12 +0300

> From: Stefan Monnier <address@hidden>
> Cc: address@hidden
> Date: Fri, 09 Sep 2011 10:32:19 -0400
> > +(autoload 'mm-default-file-encoding "mm-encode"
> > +  "Return the default encoding for FILE.")
> I must say I don't like such manually-managed autoloads.

Andreas suggested to add autoload cookies to the corresponding Gnus
files, but I see that both mml.el and mm-encode.el are entirely devoid
of such cookies, so I guess there are some Gnus coding standards
involved, which I don't want to break.

> I'd rather use a declare-function plus an explicit require call.

You mean, require in the function body, like below?

    (defun mail-add-attachment (file)
      "Add FILE as a MIME attachment to the end of the message."
      (interactive "fAttach file: ")
>>>>  (require 'mml)
>>>>  (require 'mm-encode)
      (mml-attach-file file
                       (or (mm-default-file-encoding file)
                           "application/octet-stream") nil)
      (setq mail-encode-mml t))

> My favorite would be to use a new require-autoload construct which
> the byte-compiler would replace by autoloads of the functions
> actually called (so the byte-compiler would manage the list of
> autoloads rather than doing it by hand).

I'll leave that project to you ;-)

> > +\\[mail-attach-file] insert a text file into the message.
> > +\\[mail-add-attachment] add to the message a file as a MIME attachment.
> I think mail-attach-file needs to be renamed to mail-insert-file.

I thought about this, but isn't it too late to introduce incompatible
changes on the user level?  This command is there by that name since
1997.  I would at most go with a new name and an alias that is

reply via email to

[Prev in Thread] Current Thread [Next in Thread]