[mew-int 2549] Re: Non-interactive attachment description
Christophe TROESTLER
Christophe.Troestler at example.com
Sun Jul 6 00:34:56 JST 2008
On Wed, 02 Jul 2008 18:37:35 +0900 (JST), Kazu Yamamoto (山本和彦) wrote:
>
> > I want to write some elisp code. The real problem is to provide a way
> > for bazaar http://bazaar-vcs.org/ to use Mew to send bundles: "bzr
> > send" creates a new message (with compose-mail) and then attach the
> > patch file to it (with the above 2 functions).
>
> Would you show me how to use compose-mail?
> I need to the entire code to understand this topic.
Basically, the code is as follows:
(compose-mail "TO" "SUBJECT")
(defun bzr-add-mime-att (file)
"Attach FILE to a mail buffer as a MIME attachment."
(let ((agent mail-user-agent))
(if (and file (file-exists-p file))
(cond
((eq agent 'sendmail-user-agent)
(progn
(mail-text)
(newline)
(if (functionp 'etach-attach)
(etach-attach file)
(mail-attach-file file))))
((or (eq agent 'message-user-agent)(eq agent 'gnus-user-agent))
(progn
(mml-attach-file file "text/x-patch" "BZR merge" "inline")))
((eq agent 'mew-user-agent)
(progn
(mew-draft-prepare-attachments)
(mew-attach-link file (file-name-nondirectory file))
(let* ((nums (mew-syntax-nums))
(syntax (mew-syntax-get-entry mew-encode-syntax nums)))
(mew-syntax-set-cd syntax "BZR merge")
(mew-encode-syntax-print mew-encode-syntax))
(mew-header-goto-body)))
(t
(message "Unhandled MUA, report it on bazaar at example.com")))
(error "File %s does not exist." file))))
(bzr-add-mime-att "FILE")
where the uppercase words are actually filled in by bzr. This code is
loaded and executed by emacsclient [1]. Notice the lengthy code in
the case mew-user-agent just to add the "BZR merge" description. I'd
like to know whether it is possible to do better (or, failing that,
whether mew-attach-description could be modified to accept an optional
argument for the description -- then disabling prompting the user).
Regards,
ChriS
---
[1] The details are a little more involved but that does not matter
for my question. If you are interested, see the class EmacsMail in
http://bazaar.launchpad.net/%7Ebzr/bzr/trunk/annotate/3526?file_id=mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
More information about the Mew-int
mailing list