[RFC] Emacs message mode as email client option
Aaron Bentley
aaron at aaronbentley.com
Mon Mar 24 16:13:08 GMT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Bojan,
Bojan Nikolic wrote:
> This small patch adds a mail client "emacs-message" that allows sending
> of merge directives from the emacs Message mode. This allows reuse of
> mechanisms in emacs for email address aliases and such.
This looks like a good start. Emacs is a reasonably popular platform,
so it would make sense to support it.
To actually merge it, it would need tests like those for Thunderbird in
bzrlib/tests/test_mail_client.py
> === modified file 'bzrlib/mail_client.py'
> --- bzrlib/mail_client.py 2008-03-16 14:41:10 +0000
> +++ bzrlib/mail_client.py 2008-03-24 15:37:10 +0000
> @@ -305,6 +305,39 @@
> self._encode_path(attach_path, 'attachment')])
> return commandline
>
> +class EMACSMessageEmail(ExternalMailClient):
^^^ needs two blank lines (required by PEP8).
> +
> + """
> +
> + Enter the bundle into emacs message-mode mail buffer
> +
> + """
We never put leading or trailing blank lines in docstrings. For
single-line docstrings, we put it all on one line, like:
"""Enter the bundle into emacs message-mode mail buffer"""
> +
> + _client_commands = ['emacsclient']
> +
> + def _get_compose_commandline(self,
> + to,
> + subject,
> + attach_path):
> +
> + commandline = [ "--eval" ]
^^^ We don't put spaces inside brackets.
> + mmform = "(message-mail "
> + if to is not None :
> + mmform += (" \"%s\" " % self._encode_safe(to) )
^^^ We also don't put spaces inside parentheses
> + if subject is not None:
> + mmform += (" \"%s\" " % self._encode_safe(subject))
> + mmform += ")"
> +
> + commandline.append( mmform)
> +
> + if attach_path is not None:
> + ifform = "(insert-file-contents \"%s\") " % self._encode_path(attach_path,
> + 'attachment')
> + commandline.append( ifform)
> +
> + return commandline
^^^ We put very few blank lines within methods. We occasionally do it
to break up logical sections.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFH59MU0F+nu1YWqI0RAiQmAJ4sl5jV/2v8MmlRMpLPDampN7yChACeM6Ze
th7xEbTas+3KFnBlBZr2QMU=
=6+Gl
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list