[PATCH v3 06/10] cli: Introduce "notmuch address" command
[notmuch-archives.git] / 0d / 1268ddc8c7c96dfb3470b2395e1d6928339411
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 9F486431FAF\r
6         for <notmuch@notmuchmail.org>; Fri, 24 May 2013 04:58:27 -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 X1QXs-vEzRGQ for <notmuch@notmuchmail.org>;\r
16         Fri, 24 May 2013 04:58:18 -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 76CB9431FAE\r
19         for <notmuch@notmuchmail.org>; Fri, 24 May 2013 04:58:18 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 85F7B1002C3;\r
22         Fri, 24 May 2013 14:58:12 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: David Bremner <david@tethera.net>, David Belohrad <david@belohrad.ch>,\r
25         notmuch <notmuch@notmuchmail.org>\r
26 Subject: Re: converting notmuch email to 'TODO' entry in org-mode\r
27 In-Reply-To: <87li74obe9.fsf@zancas.localnet>\r
28 References: <uaxbo803kqx.fsf@beesknees.cern.ch>\r
29         <87li74obe9.fsf@zancas.localnet>\r
30 User-Agent: Notmuch/0.15.2+115~g12cf6af (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: Fri, 24 May 2013 14:58:12 +0300\r
36 Message-ID: <m2mwrklhd7.fsf@guru.guru-group.fi>\r
37 MIME-Version: 1.0\r
38 Content-Type: text/plain\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Fri, 24 May 2013 11:58:27 -0000\r
52 \r
53 On Fri, May 24 2013, David Bremner <david@tethera.net> wrote:\r
54 \r
55 > David Belohrad <david@belohrad.ch> writes:\r
56 >>\r
57 >> is there any way how to get 'current email' (not current thread)\r
58 >> contents into kill ring so I could write a small script to paste it into\r
59 >> org-mode template?\r
60 >\r
61 > Here is what I came up with by canibalizing existing functions. \r
62 > Probably there is a more elegant way to do this.\r
63 >\r
64 > (defun notmuch-show-stash-body ()\r
65 >   (interactive)\r
66 >   (let ((all (buffer-substring (notmuch-show-message-top)\r
67 >                    (notmuch-show-message-bottom))))\r
68 \r
69 (copy-region-as-kill (notmuch-show-message-top) (notmuch-show-message-bottom)) ?\r
70 \r
71 Sorry didn't do any experiments whether this approach works (and thought\r
72 whether any save-excursions. etc are needed (or not!))\r
73 \r
74 Anyway, this was easy to come by after David's example withouth much\r
75 thinking :D\r
76 \r
77 Tomi\r
78 \r
79 \r
80 \r
81 >     (with-temp-buffer\r
82 >       (insert all)\r
83 >       ;; Remove the original header.\r
84 >       (goto-char (point-min))\r
85 >       (re-search-forward "^$" (point-max) nil)\r
86 >       (delete-region (point-min) (point))\r
87 >       (notmuch-common-do-stash\r
88 >        (buffer-string)))))\r