[MERGE] Replace mail-mode call with compose-mail from GNU Emacs.

Harald Meland harald.meland at usit.uio.no
Wed Apr 2 08:18:44 BST 2008


[Ian Clatworthy]

> Xavier Maillard wrote:
>> +        _defun = """(defun bzr-add-mime-att (file)
>> +  \"Attach FILe to a mail buffer as a MIME attachment.\"
>> +  (let ((agent mail-user-agent))
>> +    (mail-text)
>> +    (newline)
>> +    (if (and file (file-exists-p file))
>> +	(cond
>> +	 ((eq agent \'sendmail-user-agent)
>> +	  (etach-attach file))
>> +	 ((or (eq agent \'message-user-agent)(eq agent \'gnus-user-agent))
>> +	  (mml-attach-file file \"text/x-patch\" \"BZR merge\" \"attachement\"))
>> +	 (t
>> +	  (message \"Unhandled MUA\")))
>> +      (error \"File does not exist.\"))))
>> +"""
>
> If you use a raw string here, you don't need to escape ' and ". A raw
> string can be specified using r""" ... """. Also:

Just a quick note on this apparent misunderstanding: You don't need to
use a raw string to avoid the need for escaping singular quotes inside
a tripled-quote string in Python --- that's builtin to how
tripled-quote strings work, even though e.g. Emacs syntax highlighting
will typically be confused by strings like

  """This looks like a string "but this does not"."""

Raw strings instead change the special interpretation of backslash
escape sequences like "\n"; in a raw string any character following an
escaping backslash are included without change, and all backslashes
are left in the string, so e.g. r"\n" is a string consisting of two
characters, a backslash and a lowercase N.
-- 
Harald



More information about the bazaar mailing list