unread message appear `folded'
[notmuch-archives.git] / 94 / 209cf21a7475d116850e6117b2ae48819e9f8b
1 Return-Path: <schnouki@schnouki.net>\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 88ED1431FD0\r
6         for <notmuch@notmuchmail.org>; Tue, 25 Oct 2011 00:41:31 -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.1\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id TFk8uuePvlyu for <notmuch@notmuchmail.org>;\r
17         Tue, 25 Oct 2011 00:41:31 -0700 (PDT)\r
18 Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222])\r
19         by olra.theworths.org (Postfix) with ESMTP id CD3A9431FB6\r
20         for <notmuch@notmuchmail.org>; Tue, 25 Oct 2011 00:41:30 -0700 (PDT)\r
21 Received: from localhost.localdomain (thor.loria.fr [152.81.12.250])\r
22         by ks3536.kimsufi.com (Postfix) with ESMTPSA id 2667D6A0005;\r
23         Tue, 25 Oct 2011 09:41:30 +0200 (CEST)\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net;\r
25         s=key-schnouki; t=1319528490;\r
26         bh=5vrxszd3ckHNYDrSoHoSTFUNrnBGXJn8Zfrwm52XPbI=;\r
27         h=From:To:Subject:Date:Message-Id:In-Reply-To:References;\r
28         b=c9n8i8VwDM3YMebzPSMTMa8fxvDkVthOeBF9nPme9KCH4shj+IunuBXFp0usvOJW7\r
29         3BUs4iXj3ch+YGFbD+364oJyXlientx8nrs9TqKfNEmaiIqKfTc2h6FHVCu20bsb29\r
30         5NGIG6bkIggRBz8Jf0mz0ma6V8tSW4H2WrQy1bLQ=\r
31 From: Thomas Jost <schnouki@schnouki.net>\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [PATCH] emacs: Let the user choose where to compose new mails\r
34 Date: Tue, 25 Oct 2011 09:41:04 +0200\r
35 Message-Id: <1319528464-22654-1-git-send-email-schnouki@schnouki.net>\r
36 X-Mailer: git-send-email 1.7.7\r
37 In-Reply-To: <87pqhlh64c.fsf@thor.loria.fr>\r
38 References: <87pqhlh64c.fsf@thor.loria.fr>\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: Tue, 25 Oct 2011 07:41:31 -0000\r
52 \r
53 ---\r
54  emacs/notmuch-mua.el |   37 +++++++++++++++++++++++++++++++++++--\r
55  1 files changed, 35 insertions(+), 2 deletions(-)\r
56 \r
57 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
58 index 8824b08..ebc922f 100644\r
59 --- a/emacs/notmuch-mua.el\r
60 +++ b/emacs/notmuch-mua.el\r
61 @@ -31,6 +31,34 @@\r
62    :group 'notmuch\r
63    :type 'hook)\r
64  \r
65 +(defvar notmuch-mua-switch-function nil\r
66 +  "Function used to switch and display the mail buffer. This is\r
67 +  normally set by `notmuch-mua-compose-in'.")\r
68 +(defvar notmuch-mua-dedicated-flag nil\r
69 +  "Flag to pass to `set-window-dedicated-p' in the mail buffer.\r
70 +  This is normally set by `notmuch-mua-compose-in'.")\r
71 +(defcustom notmuch-mua-compose-in 'current-window\r
72 +  "Where to create the mail buffer used to compose a new message.\r
73 +  Possible values are `current-window' (default), `new-window'\r
74 +  and `new-frame'. If set to `new-window' or `new-frame', the\r
75 +  mail buffer will be displayer in a new window/frame that will\r
76 +  be destroyed when the buffer is killed. You may want to\r
77 +  customize `message-kill-buffer-on-exit' accordingly."\r
78 +  :group 'notmuch\r
79 +  :type 'symbol\r
80 +  :set (lambda (sym val)\r
81 +        (cond ((eq val 'current-window)\r
82 +               (setq notmuch-mua-switch-function nil\r
83 +                     notmuch-mua-dedicated-flag nil))\r
84 +              ((eq val 'new-window)\r
85 +               (setq notmuch-mua-switch-function 'switch-to-buffer-other-window\r
86 +                     notmuch-mua-dedicated-flag 1))\r
87 +              ((eq val 'new-frame)\r
88 +               (setq notmuch-mua-switch-function 'switch-to-buffer-other-frame\r
89 +                     notmuch-mua-dedicated-flag 1))\r
90 +              (t (error (concat "Bad value for notmuch-mua-compose-in: "\r
91 +                                (symbol-value val)))))))\r
92 +\r
93  (defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full\r
94    "Function used to generate a `User-Agent:' string. If this is\r
95  `nil' then no `User-Agent:' will be generated."\r
96 @@ -99,7 +127,8 @@ list."\r
97         ((same-window-regexps '("\\*mail .*")))\r
98        (notmuch-mua-mail (mail-header 'to headers)\r
99                         (mail-header 'subject headers)\r
100 -                       (message-headers-to-generate headers t '(to subject))))\r
101 +                       (message-headers-to-generate headers t '(to subject))\r
102 +                       nil notmuch-mua-switch-function))\r
103      ;; insert the message body - but put it in front of the signature\r
104      ;; if one is present\r
105      (goto-char (point-max))\r
106 @@ -112,6 +141,8 @@ list."\r
107    (message-goto-body))\r
108  \r
109  (defun notmuch-mua-forward-message ()\r
110 +  (when notmuch-mua-switch-function\r
111 +    (funcall notmuch-mua-switch-function (current-buffer)))\r
112    (message-forward)\r
113  \r
114    (when notmuch-mua-user-agent-function\r
115 @@ -121,6 +152,7 @@ list."\r
116    (message-sort-headers)\r
117    (message-hide-headers)\r
118    (set-buffer-modified-p nil)\r
119 +  (set-window-dedicated-p (selected-window) notmuch-mua-dedicated-flag)\r
120  \r
121    (message-goto-to))\r
122  \r
123 @@ -143,6 +175,7 @@ list."\r
124    (message-sort-headers)\r
125    (message-hide-headers)\r
126    (set-buffer-modified-p nil)\r
127 +  (set-window-dedicated-p (selected-window) notmuch-mua-dedicated-flag)\r
128  \r
129    (message-goto-to))\r
130  \r
131 @@ -199,7 +232,7 @@ the From: address first."\r
132    (let ((other-headers\r
133          (when (or prompt-for-sender notmuch-always-prompt-for-sender)\r
134            (list (cons 'from (notmuch-mua-prompt-for-sender))))))\r
135 -    (notmuch-mua-mail nil nil other-headers)))\r
136 +    (notmuch-mua-mail nil nil other-headers nil notmuch-mua-switch-function)))\r
137  \r
138  (defun notmuch-mua-new-forward-message (&optional prompt-for-sender)\r
139    "Invoke the notmuch message forwarding window.\r
140 -- \r
141 1.7.7\r
142 \r