[PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua

2011-10-25 Thread Thomas Jost
On Tue, 18 Oct 2011 07:46:48 -0700, Jameson Graef Rollins  wrote:
> On Tue, 11 Oct 2011 21:49:48 +0200, Thomas Jost  
> wrote:
> > > Another question about this feature: how do you make the window
> > > (frame) go away after the email is sent?
> > 
> > I do this:
> > (add-hook 'message-sent-hook 'delete-frame)
> 
> Hey, Thomas.  Would it be possible to add this frame/window close
> functionality directly into this new configuration?  It would be really
> nice if we could work it out such that if you have new mail buffers open
> in a new window/frame that the window/frame is automatically closed once
> the message is sent.

Yes, it's possible using dedicated windows (for details: C-h f
set-window-dedicated-p). But it's a little trickier to use: if you call
it from a switch-function, it doesn't work when forwarding a message.
There's probably something in message-forward that causes the dedicated
flag to be reset to nil, but I could not find what.

So instead I wrote a little workaround that may be easier to use. I'll
send the commit as a reply.

Regards,

-- 
Thomas/Schnouki
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: 



Re: [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua

2011-10-25 Thread Thomas Jost
On Tue, 18 Oct 2011 07:46:48 -0700, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 On Tue, 11 Oct 2011 21:49:48 +0200, Thomas Jost schno...@schnouki.net wrote:
   Another question about this feature: how do you make the window
   (frame) go away after the email is sent?
  
  I do this:
  (add-hook 'message-sent-hook 'delete-frame)
 
 Hey, Thomas.  Would it be possible to add this frame/window close
 functionality directly into this new configuration?  It would be really
 nice if we could work it out such that if you have new mail buffers open
 in a new window/frame that the window/frame is automatically closed once
 the message is sent.

Yes, it's possible using dedicated windows (for details: C-h f
set-window-dedicated-p). But it's a little trickier to use: if you call
it from a switch-function, it doesn't work when forwarding a message.
There's probably something in message-forward that causes the dedicated
flag to be reset to nil, but I could not find what.

So instead I wrote a little workaround that may be easier to use. I'll
send the commit as a reply.

Regards,

-- 
Thomas/Schnouki


pgpkhibPbAbYg.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua

2011-10-18 Thread Jameson Graef Rollins
On Tue, 11 Oct 2011 21:49:48 +0200, Thomas Jost  
wrote:
> > Another question about this feature: how do you make the window
> > (frame) go away after the email is sent?
> 
> I do this:
> (add-hook 'message-sent-hook 'delete-frame)

Hey, Thomas.  Would it be possible to add this frame/window close
functionality directly into this new configuration?  It would be really
nice if we could work it out such that if you have new mail buffers open
in a new window/frame that the window/frame is automatically closed once
the message is sent.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



[PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua

2011-10-11 Thread Thomas Jost
On Mon, 10 Oct 2011 08:50:52 -0700, Jameson Graef Rollins  wrote:
> However, I find the customization variable a bit clunky.  Since I wasn't
> presented with any options in the customization, I didn't know what to
> put in.  I copy and pasted "switch-to-buffer-other-frame" into the
> customization field but that didn't work since I didn't protect the
> function name.  Finally I got it to work by putting in
> "'switch-to-buffer-other-frame" (with the initial "'").
> 
> So I definitely love this feature, but can we make the customization
> work better so that it's easier for the user to figure out how to set
> it?

Heh, I had just tested it using "(setq ...)", not using M-x customize.
And yes, when using the customization interface it's not clear at all.
The problem is that the ":options" property of customizable variables
is only useful for hooks or alists, not for functions (but that isn't
documented anywhere, I had to dig in custom.el to find this).

So I think the best way to make that clearer and easier to figure out is
just to add more details in the docstring. I'll send a patch as a reply
to this message.

> Another question about this feature: how do you make the window
> (frame) go away after the email is sent?

I do this:
(add-hook 'message-sent-hook 'delete-frame)

(added to the doc too).

Thanks for your review :)

-- 
Thomas/Schnouki
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: 



Re: [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua

2011-10-11 Thread Thomas Jost
On Mon, 10 Oct 2011 08:50:52 -0700, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 However, I find the customization variable a bit clunky.  Since I wasn't
 presented with any options in the customization, I didn't know what to
 put in.  I copy and pasted switch-to-buffer-other-frame into the
 customization field but that didn't work since I didn't protect the
 function name.  Finally I got it to work by putting in
 'switch-to-buffer-other-frame (with the initial ').
 
 So I definitely love this feature, but can we make the customization
 work better so that it's easier for the user to figure out how to set
 it?

Heh, I had just tested it using (setq ...), not using M-x customize.
And yes, when using the customization interface it's not clear at all.
The problem is that the :options property of customizable variables
is only useful for hooks or alists, not for functions (but that isn't
documented anywhere, I had to dig in custom.el to find this).

So I think the best way to make that clearer and easier to figure out is
just to add more details in the docstring. I'll send a patch as a reply
to this message.

 Another question about this feature: how do you make the window
 (frame) go away after the email is sent?

I do this:
(add-hook 'message-sent-hook 'delete-frame)

(added to the doc too).

Thanks for your review :)

-- 
Thomas/Schnouki


pgp2hbX4jbJk1.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua

2011-10-10 Thread Jameson Graef Rollins
Another question about this feature: how do you make the window (frame)
go away after the email is sent?

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



[PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua

2011-10-10 Thread Jameson Graef Rollins
Hey, Thomas.  I think these are all totally reasonable emacs
improvements, and I think we should merge them all.

I particularly like this feature to launch compose buffers in new
frames.  Thanks so much for figuring it out.  I had hacked up something
for myself but your solution is *much* more elegant and Just Works.
Thanks!

However, I find the customization variable a bit clunky.  Since I wasn't
presented with any options in the customization, I didn't know what to
put in.  I copy and pasted "switch-to-buffer-other-frame" into the
customization field but that didn't work since I didn't protect the
function name.  Finally I got it to work by putting in
"'switch-to-buffer-other-frame" (with the initial "'").

So I definitely love this feature, but can we make the customization
work better so that it's easier for the user to figure out how to set
it?

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



Re: [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua

2011-10-10 Thread Jameson Graef Rollins
Hey, Thomas.  I think these are all totally reasonable emacs
improvements, and I think we should merge them all.

I particularly like this feature to launch compose buffers in new
frames.  Thanks so much for figuring it out.  I had hacked up something
for myself but your solution is *much* more elegant and Just Works.
Thanks!

However, I find the customization variable a bit clunky.  Since I wasn't
presented with any options in the customization, I didn't know what to
put in.  I copy and pasted switch-to-buffer-other-frame into the
customization field but that didn't work since I didn't protect the
function name.  Finally I got it to work by putting in
'switch-to-buffer-other-frame (with the initial ').

So I definitely love this feature, but can we make the customization
work better so that it's easier for the user to figure out how to set
it?

jamie.


pgpHvTOc5eQKb.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua

2011-10-10 Thread Jameson Graef Rollins
Another question about this feature: how do you make the window (frame)
go away after the email is sent?

jamie.


pgpQA9VQdtTm9.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua

2011-10-03 Thread Thomas Jost
---
 emacs/notmuch-mua.el |   15 +--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 8824b08..68c344e 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -31,6 +31,14 @@
   :group 'notmuch
   :type 'hook)

+(defcustom notmuch-mua-switch-function nil
+  "Function used to switch to and display a new mail buffer."
+  :group 'notmuch
+  :type 'function
+  :options '(nil
+switch-to-buffer-other-frame
+switch-to-buffer-other-window))
+
 (defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full
   "Function used to generate a `User-Agent:' string. If this is
 `nil' then no `User-Agent:' will be generated."
@@ -99,7 +107,8 @@ list."
((same-window-regexps '("\\*mail .*")))
   (notmuch-mua-mail (mail-header 'to headers)
(mail-header 'subject headers)
-   (message-headers-to-generate headers t '(to subject
+   (message-headers-to-generate headers t '(to subject))
+   nil notmuch-mua-switch-function))
 ;; insert the message body - but put it in front of the signature
 ;; if one is present
 (goto-char (point-max))
@@ -112,6 +121,8 @@ list."
   (message-goto-body))

 (defun notmuch-mua-forward-message ()
+  (when notmuch-mua-switch-function
+(funcall notmuch-mua-switch-function (current-buffer)))
   (message-forward)

   (when notmuch-mua-user-agent-function
@@ -199,7 +210,7 @@ the From: address first."
   (let ((other-headers
 (when (or prompt-for-sender notmuch-always-prompt-for-sender)
   (list (cons 'from (notmuch-mua-prompt-for-sender))
-(notmuch-mua-mail nil nil other-headers)))
+(notmuch-mua-mail nil nil other-headers nil notmuch-mua-switch-function)))

 (defun notmuch-mua-new-forward-message ( prompt-for-sender)
   "Invoke the notmuch message forwarding window.
-- 
1.7.6.4



[PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua

2011-10-03 Thread Thomas Jost
---
 emacs/notmuch-mua.el |   15 +--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 8824b08..68c344e 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -31,6 +31,14 @@
   :group 'notmuch
   :type 'hook)
 
+(defcustom notmuch-mua-switch-function nil
+  Function used to switch to and display a new mail buffer.
+  :group 'notmuch
+  :type 'function
+  :options '(nil
+switch-to-buffer-other-frame
+switch-to-buffer-other-window))
+
 (defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full
   Function used to generate a `User-Agent:' string. If this is
 `nil' then no `User-Agent:' will be generated.
@@ -99,7 +107,8 @@ list.
((same-window-regexps '(\\*mail .*)))
   (notmuch-mua-mail (mail-header 'to headers)
(mail-header 'subject headers)
-   (message-headers-to-generate headers t '(to subject
+   (message-headers-to-generate headers t '(to subject))
+   nil notmuch-mua-switch-function))
 ;; insert the message body - but put it in front of the signature
 ;; if one is present
 (goto-char (point-max))
@@ -112,6 +121,8 @@ list.
   (message-goto-body))
 
 (defun notmuch-mua-forward-message ()
+  (when notmuch-mua-switch-function
+(funcall notmuch-mua-switch-function (current-buffer)))
   (message-forward)
 
   (when notmuch-mua-user-agent-function
@@ -199,7 +210,7 @@ the From: address first.
   (let ((other-headers
 (when (or prompt-for-sender notmuch-always-prompt-for-sender)
   (list (cons 'from (notmuch-mua-prompt-for-sender))
-(notmuch-mua-mail nil nil other-headers)))
+(notmuch-mua-mail nil nil other-headers nil notmuch-mua-switch-function)))
 
 (defun notmuch-mua-new-forward-message (optional prompt-for-sender)
   Invoke the notmuch message forwarding window.
-- 
1.7.6.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch