]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-mua.el
emacs: add support for replying just to the sender
[notmuch] / emacs / notmuch-mua.el
index 274c5dabc61030d593eeb80d29d1eaf253b500b9..d8ab822a2697db2e81aca8591e385d81adc5fa59 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
@@ -65,16 +67,19 @@ list."
 (defun notmuch-mua-add-more-hidden-headers ()
   "Add some headers to the list that are hidden by default."
   (mapc (lambda (header)
-         (when (not (member header 'message-hidden-headers))
+         (when (not (member header message-hidden-headers))
            (push header message-hidden-headers)))
        notmuch-mua-hidden-headers))
 
-(defun notmuch-mua-reply (query-string &optional sender)
+(defun notmuch-mua-reply (query-string &optional sender reply-all)
   (let (headers
        body
        (args '("reply")))
     (if notmuch-show-process-crypto
        (setq args (append args '("--decrypt"))))
+    (if reply-all
+       (setq args (append args '("--reply-to=all")))
+      (setq args (append args '("--reply-to=sender"))))
     (setq args (append args (list query-string)))
     ;; This make assumptions about the output of `notmuch reply', but
     ;; really only that the headers come first followed by a blank
@@ -106,7 +111,8 @@ list."
     (if (re-search-backward message-signature-separator nil t)
          (forward-line -1)
       (goto-char (point-max)))
-    (insert body))
+    (insert body)
+    (push-mark))
   (set-buffer-modified-p nil)
 
   (message-goto-body))
@@ -124,9 +130,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 +145,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)
@@ -215,13 +221,13 @@ the From: address first."
        (notmuch-mua-forward-message))
     (notmuch-mua-forward-message)))
 
-(defun notmuch-mua-new-reply (query-string &optional prompt-for-sender)
+(defun notmuch-mua-new-reply (query-string &optional prompt-for-sender reply-all)
   "Invoke the notmuch reply window."
   (interactive "P")
   (let ((sender
         (when prompt-for-sender
           (notmuch-mua-prompt-for-sender))))
-    (notmuch-mua-reply query-string sender)))
+    (notmuch-mua-reply query-string sender reply-all)))
 
 (defun notmuch-mua-send-and-exit (&optional arg)
   (interactive "P")