Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / 27 / a0cfa3725791edcdc67509f1cab680699f83c5
1 Return-Path: <tomi.ollila@iki.fi>\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 0C244431FDD\r
6         for <notmuch@notmuchmail.org>; Thu,  5 Sep 2013 07:22:36 -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: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\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 ru8DjhWrlEq5 for <notmuch@notmuchmail.org>;\r
16         Thu,  5 Sep 2013 07:22:29 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 7EBE7431FDB\r
19         for <notmuch@notmuchmail.org>; Thu,  5 Sep 2013 07:22:29 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id D3BFA10005E;\r
22         Thu,  5 Sep 2013 17:22:21 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH 1/1] emacs: fix notmuch-mua-reply point placement when\r
26         signature involved\r
27 In-Reply-To: <87d2one4u0.fsf@nikula.org>\r
28 References: <1378322458-30159-1-git-send-email-tomi.ollila@iki.fi>\r
29         <87d2one4u0.fsf@nikula.org>\r
30 User-Agent: Notmuch/0.16+60~gbdcc747 (http://notmuchmail.org) Emacs/24.3.1\r
31         (x86_64-unknown-linux-gnu)\r
32 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
33         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
34         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
35 Date: Thu, 05 Sep 2013 17:22:21 +0300\r
36 Message-ID: <m2txhzfiw2.fsf@guru.guru-group.fi>\r
37 MIME-Version: 1.0\r
38 Content-Type: text/plain; charset=utf-8\r
39 Content-Transfer-Encoding: quoted-printable\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Thu, 05 Sep 2013 14:22:36 -0000\r
53 \r
54 On Thu, Sep 05 2013, Jani Nikula <jani@nikula.org> wrote:\r
55 \r
56 > On Wed, 04 Sep 2013, "Tomi.Ollila" <tomi.ollila@iki.fi> wrote:\r
57 >> From: Tomi Ollila <tomi.ollila@iki.fi>\r
58 >>\r
59 >> When composing a reply, notmuch-mua-reply attempts to  cite the\r
60 >> the original message by inserting it before the user signature, if\r
61 >> one is present. The existing method used to search the signature\r
62 >> separator backward from the end of the buffer and then move one\r
63 >> line up. In case of variable `message-signature-insert-empty-line'\r
64 >> being nil (and `message-signature-setup-hook' not intervening) this\r
65 >> caused point to go to the beginning of '--text follows this line--'\r
66 >> separator line, and citation was inserted there.\r
67 >> This change checks the value of `message-signature-insert-empty-line'\r
68 >> and doesn't move point if that is nil. Additional narrowing to\r
69 >> the body region ensures that point never goes to the separator line\r
70 >> (or beyond).\r
71 >>\r
72 >> Original patch from "Geoffrey H. Ferrari", continued with iterations\r
73 >> from Jani and Mark.\r
74 >\r
75 > Hi Tomi, I don't think you've sufficiently convinced me why we need all\r
76 > this complexity instead of just doing [1]. And if you do get me\r
77 > convinced, I'd like the reason to be in the commit message and in a\r
78 > comment above the piece of code in question.\r
79 \r
80 (add-hook 'message-signature-setup-hook=20\r
81    (lambda () (insert "Insert this text before the citation not after.\n")))\r
82 \r
83 >From emacs documentation:\r
84 \r
85 message-signature-setup-hook is a variable defined in `message.el'.\r
86 Its value is nil\r
87 \r
88   This variable may be risky if used as a file-local variable.\r
89 \r
90 Documentation:\r
91 Normal hook, run each time a new outgoing message is initialized.\r
92 It is run after the headers have been inserted and before\r
93 the signature is inserted.\r
94 \r
95 You can customize this variable.\r
96 \r
97 \r
98 Adding the comments is a good idea -- if the above convinces you\r
99 I'll prepare comments along this idea.\r
100 \r
101 > Cheers,\r
102 > Jani.\r
103 \r
104 Tomi\r
105 \r
106 >\r
107 >\r
108 > [1] id:cover.1377718199.git.jani@nikula.org\r
109 >\r
110 >\r
111 >\r
112 >\r
113 >> ---\r
114 >>  emacs/notmuch-mua.el | 12 ++++++++----\r
115 >>  1 file changed, 8 insertions(+), 4 deletions(-)\r
116 >>\r
117 >> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
118 >> index 2baae5f..0280c9f 100644\r
119 >> --- a/emacs/notmuch-mua.el\r
120 >> +++ b/emacs/notmuch-mua.el\r
121 >> @@ -192,10 +192,14 @@ list."\r
122 >>=20=20\r
123 >>        ;; Insert the message body - but put it in front of the signature\r
124 >>        ;; if one is present\r
125 >> -      (goto-char (point-max))\r
126 >> -      (if (re-search-backward message-signature-separator nil t)\r
127 >> -      (forward-line -1)\r
128 >> -    (goto-char (point-max)))\r
129 >> +      (save-restriction\r
130 >> +    (message-goto-body)\r
131 >> +    (narrow-to-region (point) (point-max))\r
132 >> +    (goto-char (point-max))\r
133 >> +    (if (re-search-backward message-signature-separator nil t)\r
134 >> +        (if message-signature-insert-empty-line\r
135 >> +            (forward-line -1))\r
136 >> +      (goto-char (point-max))))\r
137 >>=20=20\r
138 >>        (let ((from (plist-get original-headers :From))\r
139 >>          (date (plist-get original-headers :Date))\r
140 >> --=20\r
141 >> 1.8.0\r
142 >>\r
143 >> _______________________________________________\r
144 >> notmuch mailing list\r
145 >> notmuch@notmuchmail.org\r
146 >> http://notmuchmail.org/mailman/listinfo/notmuch\r
147 > _______________________________________________\r
148 > notmuch mailing list\r
149 > notmuch@notmuchmail.org\r
150 > http://notmuchmail.org/mailman/listinfo/notmuch\r
151 >\r
152 \r
153 --=20\r
154 "kaik on m=C3=A4nt!"\r