Re: [PATCH v2] Omit User-Agent: header by default
[notmuch-archives.git] / e5 / 5c9eb9309925f48e7d6fbbe23054d333c75a13
1 Return-Path: <dme@dme.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 0346A4196F0\r
6         for <notmuch@notmuchmail.org>; Mon, 26 Apr 2010 07:01:32 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.9\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
12         tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id aJZrt1RUmBIt for <notmuch@notmuchmail.org>;\r
16         Mon, 26 Apr 2010 07:01:31 -0700 (PDT)\r
17 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.159])\r
18         by olra.theworths.org (Postfix) with ESMTP id BF71B431FC1\r
19         for <notmuch@notmuchmail.org>; Mon, 26 Apr 2010 07:01:30 -0700 (PDT)\r
20 Received: by fg-out-1718.google.com with SMTP id e21so5333935fga.2\r
21         for <notmuch@notmuchmail.org>; Mon, 26 Apr 2010 07:01:30 -0700 (PDT)\r
22 Received: by 10.87.71.7 with SMTP id y7mr2269192fgk.63.1272290483056;\r
23         Mon, 26 Apr 2010 07:01:23 -0700 (PDT)\r
24 Received: from ut.hh.sledj.net (gmp-ea-fw-1b.sun.com [192.18.8.1])\r
25         by mx.google.com with ESMTPS id 26sm8508430fks.52.2010.04.26.07.01.20\r
26         (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
27         Mon, 26 Apr 2010 07:01:21 -0700 (PDT)\r
28 Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
29         id 9752959413B; Mon, 26 Apr 2010 15:01:26 +0100 (BST)\r
30 From: David Edmondson <dme@dme.org>\r
31 To: notmuch@notmuchmail.org\r
32 Subject: [PATCH] emacs: More DWIM when editing messages\r
33 Date: Mon, 26 Apr 2010 15:01:25 +0100\r
34 Message-Id: <1272290485-14217-1-git-send-email-dme@dme.org>\r
35 X-Mailer: git-send-email 1.7.0\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.13\r
38 Precedence: list\r
39 List-Id: "Use and development of the notmuch mail system."\r
40         <notmuch.notmuchmail.org>\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
44 List-Post: <mailto:notmuch@notmuchmail.org>\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
48 X-List-Received-Date: Mon, 26 Apr 2010 14:01:32 -0000\r
49 \r
50 For composing new messages and forwarding, leave the cursor on the\r
51 'To:' field. For replies, leave the cursor at the start of the\r
52 body. In all cases, mark the buffer as not modified so that the user\r
53 is not prompted if she decides to immediately kill the buffer.\r
54 ---\r
55  emacs/notmuch-mua.el |   32 +++++++++++++++++++-------------\r
56  1 files changed, 19 insertions(+), 13 deletions(-)\r
57 \r
58 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
59 index bca20db..c7a9aee 100644\r
60 --- a/emacs/notmuch-mua.el\r
61 +++ b/emacs/notmuch-mua.el\r
62 @@ -98,21 +98,24 @@ list."\r
63                               collect header)))\r
64      (message-sort-headers)\r
65      (message-hide-headers)\r
66 -    (save-excursion\r
67 -      (goto-char (point-max))\r
68 -      (insert body))\r
69 -    (set-buffer-modified-p nil)))\r
70 +    (goto-char (point-max))\r
71 +    (insert body))\r
72 +    (set-buffer-modified-p nil)\r
73 +\r
74 +    (message-goto-body))\r
75  \r
76  (defun notmuch-mua-forward-message ()\r
77    (message-forward)\r
78 -  (save-excursion\r
79 -    (when notmuch-mua-user-agent-function\r
80 -      (let ((user-agent (funcall notmuch-mua-user-agent-function)))\r
81 -       (when (not (string= "" user-agent))\r
82 -         (message-add-header (format "User-Agent: %s" user-agent)))))\r
83 -    (message-sort-headers)\r
84 -    (message-hide-headers))\r
85 -  (set-buffer-modified-p nil))\r
86 +\r
87 +  (when notmuch-mua-user-agent-function\r
88 +    (let ((user-agent (funcall notmuch-mua-user-agent-function)))\r
89 +      (when (not (string= "" user-agent))\r
90 +       (message-add-header (format "User-Agent: %s" user-agent)))))\r
91 +  (message-sort-headers)\r
92 +  (message-hide-headers)\r
93 +  (set-buffer-modified-p nil)\r
94 +\r
95 +  (message-goto-to))\r
96  \r
97  (defun notmuch-mua-mail (&optional to subject other-headers continue\r
98                                    switch-function yank-action send-actions)\r
99 @@ -126,7 +129,10 @@ list."\r
100    (message-mail to subject other-headers continue\r
101                 switch-function yank-action send-actions)\r
102    (message-sort-headers)\r
103 -  (message-hide-headers))\r
104 +  (message-hide-headers)\r
105 +  (set-buffer-modified-p nil)\r
106 +\r
107 +  (message-goto-to))\r
108  \r
109  (defun notmuch-mua-send-and-exit (&optional arg)\r
110    (interactive "P")\r
111 -- \r
112 1.7.0\r
113 \r