Re: [PATCH] emacs: call "notmuch tag" only once when archiving a thread
[notmuch-archives.git] / d8 / c6b052e1cffd9740e31456257e3419690002d5
1 Return-Path: <jani@nikula.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 288FE429E26\r
6         for <notmuch@notmuchmail.org>; Tue, 18 Oct 2011 11:58:10 -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.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 pR0asbpmO1zx for <notmuch@notmuchmail.org>;\r
16         Tue, 18 Oct 2011 11:58:09 -0700 (PDT)\r
17 Received: from mail-vx0-f181.google.com (mail-vx0-f181.google.com\r
18         [209.85.220.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 71EDD429E25\r
21         for <notmuch@notmuchmail.org>; Tue, 18 Oct 2011 11:58:09 -0700 (PDT)\r
22 Received: by vcbfk14 with SMTP id fk14so953285vcb.26\r
23         for <notmuch@notmuchmail.org>; Tue, 18 Oct 2011 11:58:07 -0700 (PDT)\r
24 Received: by 10.52.38.4 with SMTP id c4mr3779705vdk.123.1318964287613;\r
25         Tue, 18 Oct 2011 11:58:07 -0700 (PDT)\r
26 Received: from doommachine (bensakone.com. [92.243.29.139])\r
27         by mx.google.com with ESMTPS id hl5sm2840795vdb.18.2011.10.18.11.58.04\r
28         (version=TLSv1/SSLv3 cipher=OTHER);\r
29         Tue, 18 Oct 2011 11:58:05 -0700 (PDT)\r
30 Date: Tue, 18 Oct 2011 21:58:02 +0300 (EEST)\r
31 From: Jani Nikula <jani@nikula.org>\r
32 To: Thomas Jost <schnouki@schnouki.net>\r
33 Subject: Re: [PATCH v2] emacs: Support a message-mode switch function in\r
34         notmuch-mua\r
35 In-Reply-To: <1318362674-17652-1-git-send-email-schnouki@schnouki.net>\r
36 Message-ID: <alpine.DEB.2.00.1110182144360.2880@qbbzznpuvar>\r
37 References: <8739eztijn.fsf@schnouki.net>\r
38         <1318362674-17652-1-git-send-email-schnouki@schnouki.net>\r
39 User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)\r
40 MIME-Version: 1.0\r
41 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed\r
42 Cc: notmuch@notmuchmail.org\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Tue, 18 Oct 2011 18:58:10 -0000\r
56 \r
57 \r
58 Hi Thomas -\r
59 \r
60 AFAICT :options is not meaningful for a function type. I think you should \r
61 use choice type for this instead. This allows sensible documentation for \r
62 the choices in the customization interface too.\r
63 \r
64 I sent a patch earlier to fix a similar issue [1], please have a look at \r
65 that for an example. (Unfortunately, it hasn't been applied, like many \r
66 other emacs patches by me and others. I hope yours will make it. I've \r
67 given up trying until I see some progress in that front.)\r
68 \r
69 [1] http://permalink.gmane.org/gmane.mail.notmuch.general/5602\r
70 \r
71 \r
72 BR,\r
73 Jani.\r
74 \r
75 \r
76 On Tue, 11 Oct 2011, Thomas Jost wrote:\r
77 \r
78 > ---\r
79 > emacs/notmuch-mua.el |   21 +++++++++++++++++++--\r
80 > 1 files changed, 19 insertions(+), 2 deletions(-)\r
81 >\r
82 > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
83 > index 8824b08..639407f 100644\r
84 > --- a/emacs/notmuch-mua.el\r
85 > +++ b/emacs/notmuch-mua.el\r
86 > @@ -31,6 +31,20 @@\r
87 >   :group 'notmuch\r
88 >   :type 'hook)\r
89 >\r
90 > +(defcustom notmuch-mua-switch-function nil\r
91 > +  "Function used to switch to and display a new mail buffer. If\r
92 > +this is `nil' then the buffer will be displayed in the current\r
93 > +window. Other common values are `switch-to-buffer-other-frame'\r
94 > +and `switch-to-buffer-other-window'. If you change this, you may\r
95 > +also want to change `message-sent-hook' accordingly:\r
96 > +    (setq notmuch-muas-witch-function 'switch-to-buffer-other-frame)\r
97 > +    (add-hook 'message-sent-hook '(delete-frame))"\r
98 > +  :group 'notmuch\r
99 > +  :type 'function\r
100 > +  :options '(nil\r
101 > +          switch-to-buffer-other-frame\r
102 > +          switch-to-buffer-other-window))\r
103 > +\r
104 > (defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full\r
105 >   "Function used to generate a `User-Agent:' string. If this is\r
106 > `nil' then no `User-Agent:' will be generated."\r
107 > @@ -99,7 +113,8 @@ list."\r
108 >       ((same-window-regexps '("\\*mail .*")))\r
109 >       (notmuch-mua-mail (mail-header 'to headers)\r
110 >                       (mail-header 'subject headers)\r
111 > -                     (message-headers-to-generate headers t '(to subject))))\r
112 > +                     (message-headers-to-generate headers t '(to subject))\r
113 > +                     nil notmuch-mua-switch-function))\r
114 >     ;; insert the message body - but put it in front of the signature\r
115 >     ;; if one is present\r
116 >     (goto-char (point-max))\r
117 > @@ -112,6 +127,8 @@ list."\r
118 >   (message-goto-body))\r
119 >\r
120 > (defun notmuch-mua-forward-message ()\r
121 > +  (when notmuch-mua-switch-function\r
122 > +    (funcall notmuch-mua-switch-function (current-buffer)))\r
123 >   (message-forward)\r
124 >\r
125 >   (when notmuch-mua-user-agent-function\r
126 > @@ -199,7 +216,7 @@ the From: address first."\r
127 >   (let ((other-headers\r
128 >        (when (or prompt-for-sender notmuch-always-prompt-for-sender)\r
129 >          (list (cons 'from (notmuch-mua-prompt-for-sender))))))\r
130 > -    (notmuch-mua-mail nil nil other-headers)))\r
131 > +    (notmuch-mua-mail nil nil other-headers nil notmuch-mua-switch-function)))\r
132 >\r
133 > (defun notmuch-mua-new-forward-message (&optional prompt-for-sender)\r
134 >   "Invoke the notmuch message forwarding window.\r
135 >\r