]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-mua.el
emacs: quote MML tags in replies
[notmuch] / emacs / notmuch-mua.el
index 8824b080f5c280cd7fd5fae55f4ea9bd682bb193..3e93d7c8bfbf7945dcbc0fc36898a6ba2806e8b0 100644 (file)
   "Function used to generate a `User-Agent:' string. If this is
 `nil' then no `User-Agent:' will be generated."
   :group 'notmuch
-  :type 'function
-  :options '(notmuch-mua-user-agent-full
-            notmuch-mua-user-agent-notmuch
-            notmuch-mua-user-agent-emacs))
+  :type '(choice (const :tag "No user agent string" nil)
+                (const :tag "Full" notmuch-mua-user-agent-full)
+                (const :tag "Notmuch" notmuch-mua-user-agent-notmuch)
+                (const :tag "Emacs" notmuch-mua-user-agent-emacs)
+                (function :tag "Custom user agent function"
+                          :value notmuch-mua-user-agent-full)))
 
 (defcustom notmuch-mua-hidden-headers '("^User-Agent:")
   "Headers that are added to the `message-mode' hidden headers
@@ -109,7 +111,12 @@ list."
     (insert body))
   (set-buffer-modified-p nil)
 
-  (message-goto-body))
+  (message-goto-body)
+  ;; Original message may contain (malicious) MML tags.  We must
+  ;; properly quote them in the reply.  Note that using `point-max'
+  ;; instead of `mark' here is wrong.  The buffer may include user's
+  ;; signature which should not be MML-quoted.
+  (mml-quote-region (point) (point-max)))
 
 (defun notmuch-mua-forward-message ()
   (message-forward)
@@ -124,9 +131,10 @@ list."
 
   (message-goto-to))
 
-(defun notmuch-mua-mail (&optional to subject other-headers continue
-                                  switch-function yank-action send-actions)
-  "Invoke the notmuch mail composition window."
+(defun notmuch-mua-mail (&optional to subject other-headers &rest other-args)
+  "Invoke the notmuch mail composition window.
+
+OTHER-ARGS are passed through to `message-mail'."
   (interactive)
 
   (when notmuch-mua-user-agent-function
@@ -138,8 +146,7 @@ list."
     (push (cons "From" (concat
                        (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))
 
-  (message-mail to subject other-headers continue
-               switch-function yank-action send-actions)
+  (apply #'message-mail to subject other-headers other-args)
   (message-sort-headers)
   (message-hide-headers)
   (set-buffer-modified-p nil)