unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: More DWIM when editing messages
@ 2010-04-26 14:01 David Edmondson
  2010-04-26 16:31 ` Dirk Hohndel
  0 siblings, 1 reply; 10+ messages in thread
From: David Edmondson @ 2010-04-26 14:01 UTC (permalink / raw)
  To: notmuch

For composing new messages and forwarding, leave the cursor on the
'To:' field. For replies, leave the cursor at the start of the
body. In all cases, mark the buffer as not modified so that the user
is not prompted if she decides to immediately kill the buffer.
---
 emacs/notmuch-mua.el |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index bca20db..c7a9aee 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -98,21 +98,24 @@ list."
 			      collect header)))
     (message-sort-headers)
     (message-hide-headers)
-    (save-excursion
-      (goto-char (point-max))
-      (insert body))
-    (set-buffer-modified-p nil)))
+    (goto-char (point-max))
+    (insert body))
+    (set-buffer-modified-p nil)
+
+    (message-goto-body))
 
 (defun notmuch-mua-forward-message ()
   (message-forward)
-  (save-excursion
-    (when notmuch-mua-user-agent-function
-      (let ((user-agent (funcall notmuch-mua-user-agent-function)))
-	(when (not (string= "" user-agent))
-	  (message-add-header (format "User-Agent: %s" user-agent)))))
-    (message-sort-headers)
-    (message-hide-headers))
-  (set-buffer-modified-p nil))
+
+  (when notmuch-mua-user-agent-function
+    (let ((user-agent (funcall notmuch-mua-user-agent-function)))
+      (when (not (string= "" user-agent))
+	(message-add-header (format "User-Agent: %s" user-agent)))))
+  (message-sort-headers)
+  (message-hide-headers)
+  (set-buffer-modified-p nil)
+
+  (message-goto-to))
 
 (defun notmuch-mua-mail (&optional to subject other-headers continue
 				   switch-function yank-action send-actions)
@@ -126,7 +129,10 @@ list."
   (message-mail to subject other-headers continue
 		switch-function yank-action send-actions)
   (message-sort-headers)
-  (message-hide-headers))
+  (message-hide-headers)
+  (set-buffer-modified-p nil)
+
+  (message-goto-to))
 
 (defun notmuch-mua-send-and-exit (&optional arg)
   (interactive "P")
-- 
1.7.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-04-27 15:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-26 14:01 [PATCH] emacs: More DWIM when editing messages David Edmondson
2010-04-26 16:31 ` Dirk Hohndel
2010-04-26 17:28   ` Carl Worth
2010-04-26 17:46     ` Dirk Hohndel
2010-04-26 22:28     ` Dirk Hohndel
2010-04-26 23:39       ` Carl Worth
2010-04-27  1:52         ` Dirk Hohndel
2010-04-27  5:34       ` David Edmondson
2010-04-27  6:14         ` Carl Worth
2010-04-27 15:22           ` Dirk Hohndel

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).