]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-mua.el
emacs: define a notmuch-compose-mode based on message mode.
[notmuch] / emacs / notmuch-mua.el
index 934f6c95e8d4ec5c68fff40e1fac2c1b5ed42da9..101832157ccb281ae05ad4b97db5d5d9cf7aa2a3 100644 (file)
@@ -118,7 +118,10 @@ Note that these functions use `mail-citation-hook' if that is non-nil."
 
 (defun notmuch-mua-user-agent-notmuch ()
   "Generate a `User-Agent:' string suitable for notmuch."
-  (concat "Notmuch/" (notmuch-cli-version) " (http://notmuchmail.org)"))
+  (let ((notmuch-version (if (string= notmuch-emacs-version "unknown")
+                            (notmuch-cli-version)
+                          notmuch-emacs-version)))
+    (concat "Notmuch/" notmuch-version " (http://notmuchmail.org)")))
 
 (defun notmuch-mua-user-agent-emacs ()
   "Generate a `User-Agent:' string suitable for notmuch."
@@ -265,6 +268,9 @@ Note that these functions use `mail-citation-hook' if that is non-nil."
   (message-goto-body)
   (set-buffer-modified-p nil))
 
+(define-derived-mode notmuch-message-mode message-mode "Notmuch Message"
+  "Notmuch message composition mode. Mostly like `message-mode'")
+
 (defun notmuch-mua-mail (&optional to subject other-headers &rest other-args)
   "Invoke the notmuch mail composition window.
 
@@ -281,6 +287,7 @@ OTHER-ARGS are passed through to `message-mail'."
                       (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))
 
   (apply #'message-mail to subject other-headers other-args)
+  (notmuch-message-mode)
   (message-sort-headers)
   (message-hide-headers)
   (set-buffer-modified-p nil)