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 B2C9B431FAF
\r
6 for <notmuch@notmuchmail.org>; Sat, 28 Apr 2012 00:23:14 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 KoW9V2BA7qEx for <notmuch@notmuchmail.org>;
\r
16 Sat, 28 Apr 2012 00:23:12 -0700 (PDT)
\r
17 Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 59CA9431FAE
\r
19 for <notmuch@notmuchmail.org>; Sat, 28 Apr 2012 00:23:12 -0700 (PDT)
\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)
\r
21 id E061D68055; Sat, 28 Apr 2012 10:23:05 +0300 (EEST)
\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
23 To: Jameson Graef Rollins <jrollins@finestructure.net>,
\r
24 Notmuch Mail <notmuch@notmuchmail.org>
\r
25 Subject: Re: [PATCH] emacs: Let the user choose where to compose new mails
\r
26 In-Reply-To: <1334434815-7657-1-git-send-email-jrollins@finestructure.net>
\r
27 References: <87pqbayukw.fsf@servo.finestructure.net>
\r
28 <1334434815-7657-1-git-send-email-jrollins@finestructure.net>
\r
29 User-Agent: Notmuch/0.12+128~g512e176 (http://notmuchmail.org) Emacs/23.3.1
\r
30 (x86_64-unknown-linux-gnu)
\r
31 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
32 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
33 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
34 Date: Sat, 28 Apr 2012 10:23:05 +0300
\r
35 Message-ID: <m2ty049v6u.fsf@guru.guru-group.fi>
\r
37 Content-Type: text/plain; charset=us-ascii
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Sat, 28 Apr 2012 07:23:14 -0000
\r
52 On Sat, Apr 14 2012, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
\r
54 > From: Thomas Jost <schnouki@schnouki.net>
\r
56 > Introduce a new defcustom notmuch-mua-compose-in that allows users to
\r
57 > specify where new mails are composed., either in the current window or
\r
58 > in a new window or frame.
\r
60 > Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
\r
62 > This is a rebase of this original patch against the current master,
\r
63 > with an expanded commit message.
\r
70 > emacs/notmuch-mua.el | 42 +++++++++++++++++++++++++++++++++++++++---
\r
71 > 1 file changed, 39 insertions(+), 3 deletions(-)
\r
73 > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
\r
74 > index 87bd88d..a96ac3d 100644
\r
75 > --- a/emacs/notmuch-mua.el
\r
76 > +++ b/emacs/notmuch-mua.el
\r
77 > @@ -36,6 +36,21 @@
\r
78 > :group 'notmuch-send
\r
79 > :group 'notmuch-hooks)
\r
81 > +(defcustom notmuch-mua-compose-in 'current-window
\r
82 > + "Where to create the mail buffer used to compose a new message.
\r
83 > + Possible values are `current-window' (default), `new-window'
\r
84 > + and `new-frame'. If set to `current-window', the mail buffer
\r
85 > + will be displayed in the current window, so the old buffer will
\r
86 > + be restored when the mail buffer is killed. If set to
\r
87 > + `new-window' or `new-frame', the mail buffer will be displayed
\r
88 > + in a new window/frame that will be destroyed when the buffer is
\r
89 > + killed. You may want to customize `message-kill-buffer-on-exit'
\r
92 > + :type '(choice (const :tag "Compose in the current window" current-window)
\r
93 > + (const :tag "Compose mail in a new window" new-window)
\r
94 > + (const :tag "Compose mail in a new frame" new-frame)))
\r
96 > (defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full
\r
97 > "Function used to generate a `User-Agent:' string. If this is
\r
98 > `nil' then no `User-Agent:' will be generated."
\r
99 > @@ -55,6 +70,23 @@ list."
\r
103 > +(defun notmuch-mua-get-switch-function ()
\r
104 > + "Get a switch function according to `notmuch-mua-compose-in'."
\r
105 > + (cond ((eq notmuch-mua-compose-in 'current-window)
\r
106 > + 'switch-to-buffer)
\r
107 > + ((eq notmuch-mua-compose-in 'new-window)
\r
108 > + 'switch-to-buffer-other-window)
\r
109 > + ((eq notmuch-mua-compose-in 'new-frame)
\r
110 > + 'switch-to-buffer-other-frame)
\r
111 > + (t (error "Invalid value for `notmuch-mua-compose-in'"))))
\r
113 > +(defun notmuch-mua-maybe-set-window-dedicated ()
\r
114 > + "Set the selected window as dedicated according to
\r
115 > +`notmuch-mua-compose-in'."
\r
116 > + (when (or (eq notmuch-mua-compose-in 'new-frame)
\r
117 > + (eq notmuch-mua-compose-in 'new-window))
\r
118 > + (set-window-dedicated-p (selected-window) t)))
\r
120 > (defun notmuch-mua-user-agent-full ()
\r
121 > "Generate a `User-Agent:' string suitable for notmuch."
\r
122 > (concat (notmuch-mua-user-agent-notmuch)
\r
123 > @@ -148,7 +180,8 @@ list."
\r
125 > (notmuch-mua-mail (plist-get reply-headers :To)
\r
126 > (plist-get reply-headers :Subject)
\r
127 > - (notmuch-headers-plist-to-alist reply-headers))))
\r
128 > + (notmuch-headers-plist-to-alist reply-headers)
\r
129 > + nil (notmuch-mua-get-switch-function))))
\r
131 > ;; Insert the message body - but put it in front of the signature
\r
132 > ;; if one is present
\r
133 > @@ -186,6 +219,7 @@ list."
\r
134 > (set-buffer-modified-p nil))
\r
136 > (defun notmuch-mua-forward-message ()
\r
137 > + (funcall (notmuch-mua-get-switch-function) (current-buffer))
\r
138 > (message-forward)
\r
140 > (when notmuch-mua-user-agent-function
\r
141 > @@ -195,6 +229,7 @@ list."
\r
142 > (message-sort-headers)
\r
143 > (message-hide-headers)
\r
144 > (set-buffer-modified-p nil)
\r
145 > + (notmuch-mua-maybe-set-window-dedicated)
\r
147 > (message-goto-to))
\r
149 > @@ -217,6 +252,7 @@ OTHER-ARGS are passed through to `message-mail'."
\r
150 > (message-sort-headers)
\r
151 > (message-hide-headers)
\r
152 > (set-buffer-modified-p nil)
\r
153 > + (notmuch-mua-maybe-set-window-dedicated)
\r
155 > (message-goto-to))
\r
157 > @@ -272,8 +308,8 @@ the From: address first."
\r
158 > (interactive "P")
\r
159 > (let ((other-headers
\r
160 > (when (or prompt-for-sender notmuch-always-prompt-for-sender)
\r
161 > - (list (cons 'From (notmuch-mua-prompt-for-sender))))))
\r
162 > - (notmuch-mua-mail nil nil other-headers)))
\r
163 > + (list (cons "From" (notmuch-mua-prompt-for-sender))))))
\r
164 > + (notmuch-mua-mail nil nil other-headers nil (notmuch-mua-get-switch-function))))
\r
166 > (defun notmuch-mua-new-forward-message (&optional prompt-for-sender)
\r
167 > "Invoke the notmuch message forwarding window.
\r
171 > _______________________________________________
\r
172 > notmuch mailing list
\r
173 > notmuch@notmuchmail.org
\r
174 > http://notmuchmail.org/mailman/listinfo/notmuch
\r