Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 0346A4196F0 for ; Mon, 26 Apr 2010 07:01:32 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aJZrt1RUmBIt for ; Mon, 26 Apr 2010 07:01:31 -0700 (PDT) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.159]) by olra.theworths.org (Postfix) with ESMTP id BF71B431FC1 for ; Mon, 26 Apr 2010 07:01:30 -0700 (PDT) Received: by fg-out-1718.google.com with SMTP id e21so5333935fga.2 for ; Mon, 26 Apr 2010 07:01:30 -0700 (PDT) Received: by 10.87.71.7 with SMTP id y7mr2269192fgk.63.1272290483056; Mon, 26 Apr 2010 07:01:23 -0700 (PDT) Received: from ut.hh.sledj.net (gmp-ea-fw-1b.sun.com [192.18.8.1]) by mx.google.com with ESMTPS id 26sm8508430fks.52.2010.04.26.07.01.20 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 26 Apr 2010 07:01:21 -0700 (PDT) Received: by ut.hh.sledj.net (Postfix, from userid 1000) id 9752959413B; Mon, 26 Apr 2010 15:01:26 +0100 (BST) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH] emacs: More DWIM when editing messages Date: Mon, 26 Apr 2010 15:01:25 +0100 Message-Id: <1272290485-14217-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.0 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Apr 2010 14:01:32 -0000 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