* [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2011-12-13 17:32 ` [PATCH v3 " Thomas Jost
@ 2011-12-13 17:32 ` Thomas Jost
2011-12-15 11:27 ` David Bremner
2012-04-14 19:36 ` Jameson Graef Rollins
2011-12-13 17:32 ` [PATCH v3 2/4] emacs: Add a face for crypto parts headers Thomas Jost
` (3 subsequent siblings)
4 siblings, 2 replies; 65+ messages in thread
From: Thomas Jost @ 2011-12-13 17:32 UTC (permalink / raw)
To: notmuch
Reusing the current window to compose a new mail may be troublesome for the
user. This patch introduces a new customizable variable, notmuch-mua-compose-in,
which lets the user choose where to create the mail buffer: in the current
window (current and default behaviour), in a new window, or in a new frame.
---
emacs/notmuch-mua.el | 40 ++++++++++++++++++++++++++++++++++++++--
1 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 8824b08..90834d6 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -31,6 +31,21 @@
:group 'notmuch
:type 'hook)
+(defcustom notmuch-mua-compose-in 'current-window
+ "Where to create the mail buffer used to compose a new message.
+ Possible values are `current-window' (default), `new-window'
+ and `new-frame'. If set to `current-window', the mail buffer
+ will be displayed in the current window, so the old buffer will
+ be restored when the mail buffer is killed. If set to
+ `new-window' or `new-frame', the mail buffer will be displayed
+ in a new window/frame that will be destroyed when the buffer is
+ killed. You may want to customize `message-kill-buffer-on-exit'
+ accordingly."
+ :group 'notmuch
+ :type '(choice (const :tag "Compose in the current window" current-window)
+ (const :tag "Compose mail in a new window" new-window)
+ (const :tag "Compose mail in a new frame" new-frame)))
+
(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."
@@ -48,6 +63,23 @@ list."
;;
+(defun notmuch-mua-get-switch-function ()
+ "Get a switch function according to `notmuch-mua-compose-in'."
+ (cond ((eq notmuch-mua-compose-in 'current-window)
+ 'switch-to-buffer)
+ ((eq notmuch-mua-compose-in 'new-window)
+ 'switch-to-buffer-other-window)
+ ((eq notmuch-mua-compose-in 'new-frame)
+ 'switch-to-buffer-other-frame)
+ (t (error "Invalid value for `notmuch-mua-compose-in'"))))
+
+(defun notmuch-mua-maybe-set-window-dedicated ()
+ "Set the selected window as dedicated according to
+`notmuch-mua-compose-in'."
+ (when (or (eq notmuch-mua-compose-in 'new-frame)
+ (eq notmuch-mua-compose-in 'new-window))
+ (set-window-dedicated-p (selected-window) t)))
+
(defun notmuch-mua-user-agent-full ()
"Generate a `User-Agent:' string suitable for notmuch."
(concat (notmuch-mua-user-agent-notmuch)
@@ -99,7 +131,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-get-switch-function)))
;; insert the message body - but put it in front of the signature
;; if one is present
(goto-char (point-max))
@@ -112,6 +145,7 @@ list."
(message-goto-body))
(defun notmuch-mua-forward-message ()
+ (funcall (notmuch-mua-get-switch-function) (current-buffer))
(message-forward)
(when notmuch-mua-user-agent-function
@@ -121,6 +155,7 @@ list."
(message-sort-headers)
(message-hide-headers)
(set-buffer-modified-p nil)
+ (notmuch-mua-maybe-set-window-dedicated)
(message-goto-to))
@@ -143,6 +178,7 @@ list."
(message-sort-headers)
(message-hide-headers)
(set-buffer-modified-p nil)
+ (notmuch-mua-maybe-set-window-dedicated)
(message-goto-to))
@@ -199,7 +235,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-get-switch-function))))
(defun notmuch-mua-new-forward-message (&optional prompt-for-sender)
"Invoke the notmuch message forwarding window.
--
1.7.8
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2011-12-13 17:32 ` [PATCH v3 1/4] emacs: Let the user choose where to compose new mails Thomas Jost
@ 2011-12-15 11:27 ` David Bremner
2011-12-15 17:18 ` Jameson Graef Rollins
2012-04-14 19:36 ` Jameson Graef Rollins
1 sibling, 1 reply; 65+ messages in thread
From: David Bremner @ 2011-12-15 11:27 UTC (permalink / raw)
To: Thomas Jost, notmuch
On Tue, 13 Dec 2011 18:32:09 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
> Reusing the current window to compose a new mail may be troublesome for the
> user. This patch introduces a new customizable variable, notmuch-mua-compose-in,
> which lets the user choose where to create the mail buffer: in the current
> window (current and default behaviour), in a new window, or in a new frame.
There is something odd about the compose-in-new-frame support. If I run
M-x notmuch-mua-mail from within an initial frame, it doesn't create a
new frame but splits the current one. If I then run M-x notmuch, _that_
creates the new frame.
d
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2011-12-15 11:27 ` David Bremner
@ 2011-12-15 17:18 ` Jameson Graef Rollins
2011-12-15 23:50 ` David Bremner
0 siblings, 1 reply; 65+ messages in thread
From: Jameson Graef Rollins @ 2011-12-15 17:18 UTC (permalink / raw)
To: David Bremner, Thomas Jost, notmuch
[-- Attachment #1: Type: text/plain, Size: 617 bytes --]
On Thu, 15 Dec 2011 07:27:24 -0400, David Bremner <david@tethera.net> wrote:
> There is something odd about the compose-in-new-frame support. If I run
> M-x notmuch-mua-mail from within an initial frame, it doesn't create a
> new frame but splits the current one. If I then run M-x notmuch, _that_
> creates the new frame.
Hey, David. I think that notmuch-mua-mail is not the correct function.
It works fine if you just use 'm' to invoke a new mail compose, which
actually calls notmuch-mua-new-mail.
I've been using this patch and it works quite well, particularly if you
set message-kill-buffer-on-exit.
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2011-12-15 17:18 ` Jameson Graef Rollins
@ 2011-12-15 23:50 ` David Bremner
2011-12-16 23:45 ` Jameson Graef Rollins
2011-12-26 4:54 ` Aaron Ecay
0 siblings, 2 replies; 65+ messages in thread
From: David Bremner @ 2011-12-15 23:50 UTC (permalink / raw)
To: Jameson Graef Rollins, Thomas Jost, notmuch
On Thu, 15 Dec 2011 09:18:00 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
>
> Hey, David. I think that notmuch-mua-mail is not the correct function.
> It works fine if you just use 'm' to invoke a new mail compose, which
> actually calls notmuch-mua-new-mail.
>
I think the problem is related to emacsclient.
With 'm' I have the following behaviour:
emacs -q --daemon
M-x notmuch (to load variable definitions)
M-x customize-variable notmuch-mua-compose-in
(select compose in new window, save for current session)
M-x notmuch
m ;; new window is opened as it should be
C-c C-c ;; frame is closed.
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2011-12-15 23:50 ` David Bremner
@ 2011-12-16 23:45 ` Jameson Graef Rollins
2011-12-17 1:19 ` David Bremner
2011-12-26 4:54 ` Aaron Ecay
1 sibling, 1 reply; 65+ messages in thread
From: Jameson Graef Rollins @ 2011-12-16 23:45 UTC (permalink / raw)
To: David Bremner, Thomas Jost, notmuch
[-- Attachment #1: Type: text/plain, Size: 815 bytes --]
On Thu, 15 Dec 2011 19:50:36 -0400, David Bremner <david@tethera.net> wrote:
> I think the problem is related to emacsclient.
>
> With 'm' I have the following behaviour:
>
> emacs -q --daemon
> M-x notmuch (to load variable definitions)
> M-x customize-variable notmuch-mua-compose-in
> (select compose in new window, save for current session)
> M-x notmuch
> m ;; new window is opened as it should be
> C-c C-c ;; frame is closed.
Hey, David. What exactly is the problem here? These seems like it's
actually reasonable behavior when you're using emacs in daemon mode,
yes? I don't actually use notmuch with emacs daemon/client, so I'm not
sure what behavior is expected.
If this is an emacsclient issue, should that prevent the patch from
going through?
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2011-12-16 23:45 ` Jameson Graef Rollins
@ 2011-12-17 1:19 ` David Bremner
2011-12-17 1:35 ` Jameson Graef Rollins
2011-12-18 18:46 ` Tom Prince
0 siblings, 2 replies; 65+ messages in thread
From: David Bremner @ 2011-12-17 1:19 UTC (permalink / raw)
To: Jameson Graef Rollins, Thomas Jost, notmuch
On Fri, 16 Dec 2011 15:45:26 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> Hey, David. What exactly is the problem here? These seems like it's
> actually reasonable behavior when you're using emacs in daemon mode,
> yes? I don't actually use notmuch with emacs daemon/client, so I'm not
> sure what behavior is expected.
The frame started by "emacsclient -c" is no different than a frame
started with "emacs". It closes when you type C-x C-c. In particular
killing an emacs window should not kill the frame. With this patch, and
notmuch-mua-compose-in set to new-window, notmuch does this.
> If this is an emacsclient issue, should that prevent the patch from
> going through?
It is pretty disruptive to have a frame closed unexpectedly, and I think
enough people use 'emacsclient -c' that this is not a use case we can
dismiss.
In any event, I just checked with 'emacs -q', no emacsclient, and the
behaviour of 'new-window is strange there too, since it buries the
notmuch window, and leaves the window containing the sent message
displayed.
d
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2011-12-17 1:19 ` David Bremner
@ 2011-12-17 1:35 ` Jameson Graef Rollins
2011-12-18 18:46 ` Tom Prince
1 sibling, 0 replies; 65+ messages in thread
From: Jameson Graef Rollins @ 2011-12-17 1:35 UTC (permalink / raw)
To: David Bremner, Thomas Jost, notmuch
[-- Attachment #1: Type: text/plain, Size: 984 bytes --]
On Fri, 16 Dec 2011 21:19:37 -0400, David Bremner <david@tethera.net> wrote:
> The frame started by "emacsclient -c" is no different than a frame
> started with "emacs". It closes when you type C-x C-c. In particular
> killing an emacs window should not kill the frame. With this patch, and
> notmuch-mua-compose-in set to new-window, notmuch does this.
I'm worried that this is because the behavior emacs' "dedicated" windows
is a little flaky. I've experimented with it before and noticed some
weirdnesses.
It's been working for me perfectly in this context, though. I would
hate to see this patch not go through, cause I'm totally addicted to
this behavior at this point.
What if we just added a warning to the help message for the
customization variable that says the behavior with emacsclient might be
a little flaky? Obviously people don't have to use this functionality,
so in that sense it doesn't hurt anyone to have it there if they just
don't use it, right?
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2011-12-17 1:19 ` David Bremner
2011-12-17 1:35 ` Jameson Graef Rollins
@ 2011-12-18 18:46 ` Tom Prince
1 sibling, 0 replies; 65+ messages in thread
From: Tom Prince @ 2011-12-18 18:46 UTC (permalink / raw)
To: David Bremner, Jameson Graef Rollins, Thomas Jost, notmuch
On Fri, 16 Dec 2011 21:19:37 -0400, David Bremner <david@tethera.net> wrote:
> On Fri, 16 Dec 2011 15:45:26 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
>
> > Hey, David. What exactly is the problem here? These seems like it's
> > actually reasonable behavior when you're using emacs in daemon mode,
> > yes? I don't actually use notmuch with emacs daemon/client, so I'm not
> > sure what behavior is expected.
>
> The frame started by "emacsclient -c" is no different than a frame
> started with "emacs". It closes when you type C-x C-c. In particular
> killing an emacs window should not kill the frame. With this patch, and
> notmuch-mua-compose-in set to new-window, notmuch does this.
So long as it is the only window in the frame, that is the behavior I
want. So it is certainly a matter of taste. I thought I had to add code
to emacs to make that happen by default though.
Tom
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2011-12-15 23:50 ` David Bremner
2011-12-16 23:45 ` Jameson Graef Rollins
@ 2011-12-26 4:54 ` Aaron Ecay
2011-12-26 11:38 ` David Bremner
2012-01-06 16:45 ` Thomas Jost
1 sibling, 2 replies; 65+ messages in thread
From: Aaron Ecay @ 2011-12-26 4:54 UTC (permalink / raw)
To: David Bremner, Jameson Graef Rollins, Thomas Jost, notmuch
On Thu, 15 Dec 2011 19:50:36 -0400, David Bremner <david@tethera.net> wrote:
> I think the problem is related to emacsclient.
>
> With 'm' I have the following behaviour:
>
> emacs -q --daemon
> M-x notmuch (to load variable definitions)
> M-x customize-variable notmuch-mua-compose-in
> (select compose in new window, save for current session)
> M-x notmuch
> m ;; new window is opened as it should be
> C-c C-c ;; frame is closed.
I just tried, and I cannot reproduce this behavior. IIUC, here is what
happened to you: you set nm-mua-compose-in to 'new-window. You began a
new message, this opened a new window as expected. Your emacs frame now
has two windows in it. You sent this message, which deleted the window
showing it. Your emacs frame was deleted as well, which made the other
window, showing notmuch-hello (or some other notmuch buffer, from which
you began writing the email message) disappear as well, unexpectedly.
Is this a correct description of what happened?
Here’s the recipe I used for replicating:
emacs -q --daemon
emacsclient -c
C-x b *scratch*
(add-to-list 'load-path "/path/to/notmuch/emacs/") C-j
(load-library "notmuch") C-j
C-x C-f /path/to/notmuch/emacs/notmuch-mua.el
M-x eval-buffer (in order to pick up changes not in byte-compiled file)
M-x customize-variable notmuch-mua-compose-in (set to 'new-window, save for session)
M-x notmuch
m (new window is created in current frame, below the window showing notmuch-hello)
(type mail)
C-c C-c (enter smtp settings, since emacs doesn’t know them)
(new window disappears, the window with notmuch-hello fills whole frame)
I also tried with notmuch-mua-compose-in set to 'new-frame, and got the
expected behavior (m -> create new frame, C-c C-c -> new frame is
deleted)
What version of emacs did you have this problem with? The window/frame
handling code has undergone several intrusive rewrites post-v.23, each
of which fixed some bugs and introduced others. The version I used is a
trunk build from Dec. 12-ish. It would be nice to pinpoint which emacs
versions/configurations show undesired behavior – this is a useful patch
and it should be included once we can be sure it will work correctly.
Thanks,
--
Aaron Ecay
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2011-12-26 4:54 ` Aaron Ecay
@ 2011-12-26 11:38 ` David Bremner
2012-01-06 16:45 ` Thomas Jost
1 sibling, 0 replies; 65+ messages in thread
From: David Bremner @ 2011-12-26 11:38 UTC (permalink / raw)
To: Aaron Ecay, Jameson Graef Rollins, Thomas Jost, notmuch
[-- Attachment #1: Type: text/plain, Size: 2054 bytes --]
On Sun, 25 Dec 2011 23:54:41 -0500, Aaron Ecay <aaronecay@gmail.com> wrote:
> I just tried, and I cannot reproduce this behavior. IIUC, here is what
> happened to you: you set nm-mua-compose-in to 'new-window. You began a
> new message, this opened a new window as expected. Your emacs frame now
> has two windows in it. You sent this message, which deleted the window
> showing it. Your emacs frame was deleted as well, which made the other
> window, showing notmuch-hello (or some other notmuch buffer, from which
> you began writing the email message) disappear as well, unexpectedly.
> Is this a correct description of what happened?
Yes, although it happened quickly enough I'm not sure the window was
deleted before the frame.
> Here’s the recipe I used for replicating:
>
> emacs -q --daemon
> emacsclient -c
> C-x b *scratch*
> (add-to-list 'load-path "/path/to/notmuch/emacs/") C-j
> (load-library "notmuch") C-j
> C-x C-f /path/to/notmuch/emacs/notmuch-mua.el
> M-x eval-buffer (in order to pick up changes not in byte-compiled file)
> M-x customize-variable notmuch-mua-compose-in (set to 'new-window, save for session)
> M-x notmuch
> m (new window is created in current frame, below the window showing notmuch-hello)
> (type mail)
> C-c C-c (enter smtp settings, since emacs doesn’t know them)
> (new window disappears, the window with notmuch-hello fills whole frame)
>
It sounds plausible. On Debian I was a bit lazy and relied on the Debian
site startup file, which I attach. Note that the setting of 'new-window
seems broken to me without emacsclient as well. In this case it buries
the notmuch-hello buffer that the compose window was launched from.
> I also tried with notmuch-mua-compose-in set to 'new-frame, and got the
> expected behavior (m -> create new frame, C-c C-c -> new frame is
> deleted)
Yes, that one seems fine; perhaps because deleting the frame is the
desired outcome in this case.
> What version of emacs did you have this problem with?
23.3.1
[-- Attachment #2: site startup for notmuch. --]
[-- Type: application/emacs-lisp, Size: 1302 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2011-12-26 4:54 ` Aaron Ecay
2011-12-26 11:38 ` David Bremner
@ 2012-01-06 16:45 ` Thomas Jost
1 sibling, 0 replies; 65+ messages in thread
From: Thomas Jost @ 2012-01-06 16:45 UTC (permalink / raw)
To: Aaron Ecay, David Bremner, Jameson Graef Rollins, notmuch
[-- Attachment #1: Type: text/plain, Size: 3318 bytes --]
On Sun, 25 Dec 2011 23:54:41 -0500, Aaron Ecay <aaronecay@gmail.com> wrote:
> On Thu, 15 Dec 2011 19:50:36 -0400, David Bremner <david@tethera.net> wrote:
> > I think the problem is related to emacsclient.
> >
> > With 'm' I have the following behaviour:
> >
> > emacs -q --daemon
> > M-x notmuch (to load variable definitions)
> > M-x customize-variable notmuch-mua-compose-in
> > (select compose in new window, save for current session)
> > M-x notmuch
> > m ;; new window is opened as it should be
> > C-c C-c ;; frame is closed.
>
> I just tried, and I cannot reproduce this behavior. IIUC, here is what
> happened to you: you set nm-mua-compose-in to 'new-window. You began a
> new message, this opened a new window as expected. Your emacs frame now
> has two windows in it. You sent this message, which deleted the window
> showing it. Your emacs frame was deleted as well, which made the other
> window, showing notmuch-hello (or some other notmuch buffer, from which
> you began writing the email message) disappear as well, unexpectedly.
> Is this a correct description of what happened?
>
> Here’s the recipe I used for replicating:
>
> emacs -q --daemon
> emacsclient -c
> C-x b *scratch*
> (add-to-list 'load-path "/path/to/notmuch/emacs/") C-j
> (load-library "notmuch") C-j
> C-x C-f /path/to/notmuch/emacs/notmuch-mua.el
> M-x eval-buffer (in order to pick up changes not in byte-compiled file)
> M-x customize-variable notmuch-mua-compose-in (set to 'new-window, save for session)
> M-x notmuch
> m (new window is created in current frame, below the window showing notmuch-hello)
> (type mail)
> C-c C-c (enter smtp settings, since emacs doesn’t know them)
> (new window disappears, the window with notmuch-hello fills whole frame)
I've used something like this (+setting message-send-mail-function,
sendmail-program, sendmail extra arguments, message-signature and
notmuch-fcc-dirs) and done the following tests:
- Emacs 23.3 vs Emacs 24.0.92 (23.3 from Arch [extra] repo, 24.0.92
compiled from AUR emacs-pretest package)
- with and without --daemon
- setting message-kill-buffer-on-exit to nil and t
In every case, the new mail composition window opened correctly next to
the notmuch-hello window. Here is what I got after successfully sending
a test mail in every situation:
- when message-kill-buffer-on-exit is "t":
* E23: mail buffer killed, window closed, frame still there (OK)
* E23 daemon: same thing (OK)
* E24: same thing (OK)
* E24 daemon: same thing (OK)
- when message-kill-buffer-on-exit is "nil":
* E23: mail buffer buried, window still there, frame still there
* E23 daemon: frame was killed after sending. When restarting
emacsclient: buffer buried but still there
* E24: mail buffer buried, window closed, frame still there (OK)
* E24 daemon: same thing (OK)
So basically everything works as expected when mkboe is "t", and there
are issues with Emacs 23 when mkboe is "nil".
I'm very sorry for these issues, I should have done more testing with
mkboe set to "nil", and I don't think I tested Emacs 23 at all with the
latest versions of this patch. I'll try to fix that and post a new patch
in a few days.
Best regards,
--
Thomas/Schnouki
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2011-12-13 17:32 ` [PATCH v3 1/4] emacs: Let the user choose where to compose new mails Thomas Jost
2011-12-15 11:27 ` David Bremner
@ 2012-04-14 19:36 ` Jameson Graef Rollins
2012-04-14 20:20 ` [PATCH] " Jameson Graef Rollins
2012-04-15 14:52 ` [PATCH v3 1/4] " David Bremner
1 sibling, 2 replies; 65+ messages in thread
From: Jameson Graef Rollins @ 2012-04-14 19:36 UTC (permalink / raw)
To: Thomas Jost, notmuch
[-- Attachment #1: Type: text/plain, Size: 745 bytes --]
On Tue, Dec 13 2011, Thomas Jost <schnouki@schnouki.net> wrote:
> Reusing the current window to compose a new mail may be troublesome for the
> user. This patch introduces a new customizable variable, notmuch-mua-compose-in,
> which lets the user choose where to create the mail buffer: in the current
> window (current and default behaviour), in a new window, or in a new frame.
Hi. I have been using this patch for many months now with no problems.
I really depend on it's functionality now, so I would really like to see
it pushed so that I don't have to keep maintaining it on my own personal
branch.
I think the issues that David was experiencing have to do with flakiness
in emacs's dedicated windows, not in this patch itself.
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH] emacs: Let the user choose where to compose new mails
2012-04-14 19:36 ` Jameson Graef Rollins
@ 2012-04-14 20:20 ` Jameson Graef Rollins
2012-04-14 20:42 ` [PATCH v5] " Jameson Graef Rollins
2012-04-28 7:23 ` [PATCH] " Tomi Ollila
2012-04-15 14:52 ` [PATCH v3 1/4] " David Bremner
1 sibling, 2 replies; 65+ messages in thread
From: Jameson Graef Rollins @ 2012-04-14 20:20 UTC (permalink / raw)
To: Notmuch Mail
From: Thomas Jost <schnouki@schnouki.net>
Introduce a new defcustom notmuch-mua-compose-in that allows users to
specify where new mails are composed., either in the current window or
in a new window or frame.
Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
---
This is a rebase of this original patch against the current master,
with an expanded commit message.
emacs/notmuch-mua.el | 42 +++++++++++++++++++++++++++++++++++++++---
1 file changed, 39 insertions(+), 3 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 87bd88d..a96ac3d 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -36,6 +36,21 @@
:group 'notmuch-send
:group 'notmuch-hooks)
+(defcustom notmuch-mua-compose-in 'current-window
+ "Where to create the mail buffer used to compose a new message.
+ Possible values are `current-window' (default), `new-window'
+ and `new-frame'. If set to `current-window', the mail buffer
+ will be displayed in the current window, so the old buffer will
+ be restored when the mail buffer is killed. If set to
+ `new-window' or `new-frame', the mail buffer will be displayed
+ in a new window/frame that will be destroyed when the buffer is
+ killed. You may want to customize `message-kill-buffer-on-exit'
+ accordingly."
+ :group 'notmuch
+ :type '(choice (const :tag "Compose in the current window" current-window)
+ (const :tag "Compose mail in a new window" new-window)
+ (const :tag "Compose mail in a new frame" new-frame)))
+
(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."
@@ -55,6 +70,23 @@ list."
;;
+(defun notmuch-mua-get-switch-function ()
+ "Get a switch function according to `notmuch-mua-compose-in'."
+ (cond ((eq notmuch-mua-compose-in 'current-window)
+ 'switch-to-buffer)
+ ((eq notmuch-mua-compose-in 'new-window)
+ 'switch-to-buffer-other-window)
+ ((eq notmuch-mua-compose-in 'new-frame)
+ 'switch-to-buffer-other-frame)
+ (t (error "Invalid value for `notmuch-mua-compose-in'"))))
+
+(defun notmuch-mua-maybe-set-window-dedicated ()
+ "Set the selected window as dedicated according to
+`notmuch-mua-compose-in'."
+ (when (or (eq notmuch-mua-compose-in 'new-frame)
+ (eq notmuch-mua-compose-in 'new-window))
+ (set-window-dedicated-p (selected-window) t)))
+
(defun notmuch-mua-user-agent-full ()
"Generate a `User-Agent:' string suitable for notmuch."
(concat (notmuch-mua-user-agent-notmuch)
@@ -148,7 +180,8 @@ list."
collect pair)))
(notmuch-mua-mail (plist-get reply-headers :To)
(plist-get reply-headers :Subject)
- (notmuch-headers-plist-to-alist reply-headers))))
+ (notmuch-headers-plist-to-alist reply-headers)
+ nil (notmuch-mua-get-switch-function))))
;; Insert the message body - but put it in front of the signature
;; if one is present
@@ -186,6 +219,7 @@ list."
(set-buffer-modified-p nil))
(defun notmuch-mua-forward-message ()
+ (funcall (notmuch-mua-get-switch-function) (current-buffer))
(message-forward)
(when notmuch-mua-user-agent-function
@@ -195,6 +229,7 @@ list."
(message-sort-headers)
(message-hide-headers)
(set-buffer-modified-p nil)
+ (notmuch-mua-maybe-set-window-dedicated)
(message-goto-to))
@@ -217,6 +252,7 @@ OTHER-ARGS are passed through to `message-mail'."
(message-sort-headers)
(message-hide-headers)
(set-buffer-modified-p nil)
+ (notmuch-mua-maybe-set-window-dedicated)
(message-goto-to))
@@ -272,8 +308,8 @@ the From: address first."
(interactive "P")
(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)))
+ (list (cons "From" (notmuch-mua-prompt-for-sender))))))
+ (notmuch-mua-mail nil nil other-headers nil (notmuch-mua-get-switch-function))))
(defun notmuch-mua-new-forward-message (&optional prompt-for-sender)
"Invoke the notmuch message forwarding window.
--
1.7.9.5
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH v5] emacs: Let the user choose where to compose new mails
2012-04-14 20:20 ` [PATCH] " Jameson Graef Rollins
@ 2012-04-14 20:42 ` Jameson Graef Rollins
2012-04-28 7:23 ` [PATCH] " Tomi Ollila
1 sibling, 0 replies; 65+ messages in thread
From: Jameson Graef Rollins @ 2012-04-14 20:42 UTC (permalink / raw)
To: Notmuch Mail
From: Thomas Jost <schnouki@schnouki.net>
Introduce a new defcustom notmuch-mua-compose-in that allows users to
specify where new mails are composed, either in the current window or
in a new window or frame.
Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
---
There was a small bug in the previous rebased version of this patch
that this new version fixes. Sorry about the noise.
I also updated the subject line to indicate that this is in fact the
fifth version of this patch.
emacs/notmuch-mua.el | 40 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 87bd88d..1fb59de 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -36,6 +36,21 @@
:group 'notmuch-send
:group 'notmuch-hooks)
+(defcustom notmuch-mua-compose-in 'current-window
+ "Where to create the mail buffer used to compose a new message.
+ Possible values are `current-window' (default), `new-window'
+ and `new-frame'. If set to `current-window', the mail buffer
+ will be displayed in the current window, so the old buffer will
+ be restored when the mail buffer is killed. If set to
+ `new-window' or `new-frame', the mail buffer will be displayed
+ in a new window/frame that will be destroyed when the buffer is
+ killed. You may want to customize `message-kill-buffer-on-exit'
+ accordingly."
+ :group 'notmuch
+ :type '(choice (const :tag "Compose in the current window" current-window)
+ (const :tag "Compose mail in a new window" new-window)
+ (const :tag "Compose mail in a new frame" new-frame)))
+
(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."
@@ -55,6 +70,23 @@ list."
;;
+(defun notmuch-mua-get-switch-function ()
+ "Get a switch function according to `notmuch-mua-compose-in'."
+ (cond ((eq notmuch-mua-compose-in 'current-window)
+ 'switch-to-buffer)
+ ((eq notmuch-mua-compose-in 'new-window)
+ 'switch-to-buffer-other-window)
+ ((eq notmuch-mua-compose-in 'new-frame)
+ 'switch-to-buffer-other-frame)
+ (t (error "Invalid value for `notmuch-mua-compose-in'"))))
+
+(defun notmuch-mua-maybe-set-window-dedicated ()
+ "Set the selected window as dedicated according to
+`notmuch-mua-compose-in'."
+ (when (or (eq notmuch-mua-compose-in 'new-frame)
+ (eq notmuch-mua-compose-in 'new-window))
+ (set-window-dedicated-p (selected-window) t)))
+
(defun notmuch-mua-user-agent-full ()
"Generate a `User-Agent:' string suitable for notmuch."
(concat (notmuch-mua-user-agent-notmuch)
@@ -148,7 +180,8 @@ list."
collect pair)))
(notmuch-mua-mail (plist-get reply-headers :To)
(plist-get reply-headers :Subject)
- (notmuch-headers-plist-to-alist reply-headers))))
+ (notmuch-headers-plist-to-alist reply-headers)
+ nil (notmuch-mua-get-switch-function))))
;; Insert the message body - but put it in front of the signature
;; if one is present
@@ -186,6 +219,7 @@ list."
(set-buffer-modified-p nil))
(defun notmuch-mua-forward-message ()
+ (funcall (notmuch-mua-get-switch-function) (current-buffer))
(message-forward)
(when notmuch-mua-user-agent-function
@@ -195,6 +229,7 @@ list."
(message-sort-headers)
(message-hide-headers)
(set-buffer-modified-p nil)
+ (notmuch-mua-maybe-set-window-dedicated)
(message-goto-to))
@@ -217,6 +252,7 @@ OTHER-ARGS are passed through to `message-mail'."
(message-sort-headers)
(message-hide-headers)
(set-buffer-modified-p nil)
+ (notmuch-mua-maybe-set-window-dedicated)
(message-goto-to))
@@ -273,7 +309,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-get-switch-function))))
(defun notmuch-mua-new-forward-message (&optional prompt-for-sender)
"Invoke the notmuch message forwarding window.
--
1.7.9.5
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH] emacs: Let the user choose where to compose new mails
2012-04-14 20:20 ` [PATCH] " Jameson Graef Rollins
2012-04-14 20:42 ` [PATCH v5] " Jameson Graef Rollins
@ 2012-04-28 7:23 ` Tomi Ollila
1 sibling, 0 replies; 65+ messages in thread
From: Tomi Ollila @ 2012-04-28 7:23 UTC (permalink / raw)
To: Jameson Graef Rollins, Notmuch Mail
On Sat, Apr 14 2012, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> From: Thomas Jost <schnouki@schnouki.net>
>
> Introduce a new defcustom notmuch-mua-compose-in that allows users to
> specify where new mails are composed., either in the current window or
> in a new window or frame.
>
> Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
> ---
> This is a rebase of this original patch against the current master,
> with an expanded commit message.
+1
Tomi
>
> emacs/notmuch-mua.el | 42 +++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 39 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 87bd88d..a96ac3d 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -36,6 +36,21 @@
> :group 'notmuch-send
> :group 'notmuch-hooks)
>
> +(defcustom notmuch-mua-compose-in 'current-window
> + "Where to create the mail buffer used to compose a new message.
> + Possible values are `current-window' (default), `new-window'
> + and `new-frame'. If set to `current-window', the mail buffer
> + will be displayed in the current window, so the old buffer will
> + be restored when the mail buffer is killed. If set to
> + `new-window' or `new-frame', the mail buffer will be displayed
> + in a new window/frame that will be destroyed when the buffer is
> + killed. You may want to customize `message-kill-buffer-on-exit'
> + accordingly."
> + :group 'notmuch
> + :type '(choice (const :tag "Compose in the current window" current-window)
> + (const :tag "Compose mail in a new window" new-window)
> + (const :tag "Compose mail in a new frame" new-frame)))
> +
> (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."
> @@ -55,6 +70,23 @@ list."
>
> ;;
>
> +(defun notmuch-mua-get-switch-function ()
> + "Get a switch function according to `notmuch-mua-compose-in'."
> + (cond ((eq notmuch-mua-compose-in 'current-window)
> + 'switch-to-buffer)
> + ((eq notmuch-mua-compose-in 'new-window)
> + 'switch-to-buffer-other-window)
> + ((eq notmuch-mua-compose-in 'new-frame)
> + 'switch-to-buffer-other-frame)
> + (t (error "Invalid value for `notmuch-mua-compose-in'"))))
> +
> +(defun notmuch-mua-maybe-set-window-dedicated ()
> + "Set the selected window as dedicated according to
> +`notmuch-mua-compose-in'."
> + (when (or (eq notmuch-mua-compose-in 'new-frame)
> + (eq notmuch-mua-compose-in 'new-window))
> + (set-window-dedicated-p (selected-window) t)))
> +
> (defun notmuch-mua-user-agent-full ()
> "Generate a `User-Agent:' string suitable for notmuch."
> (concat (notmuch-mua-user-agent-notmuch)
> @@ -148,7 +180,8 @@ list."
> collect pair)))
> (notmuch-mua-mail (plist-get reply-headers :To)
> (plist-get reply-headers :Subject)
> - (notmuch-headers-plist-to-alist reply-headers))))
> + (notmuch-headers-plist-to-alist reply-headers)
> + nil (notmuch-mua-get-switch-function))))
>
> ;; Insert the message body - but put it in front of the signature
> ;; if one is present
> @@ -186,6 +219,7 @@ list."
> (set-buffer-modified-p nil))
>
> (defun notmuch-mua-forward-message ()
> + (funcall (notmuch-mua-get-switch-function) (current-buffer))
> (message-forward)
>
> (when notmuch-mua-user-agent-function
> @@ -195,6 +229,7 @@ list."
> (message-sort-headers)
> (message-hide-headers)
> (set-buffer-modified-p nil)
> + (notmuch-mua-maybe-set-window-dedicated)
>
> (message-goto-to))
>
> @@ -217,6 +252,7 @@ OTHER-ARGS are passed through to `message-mail'."
> (message-sort-headers)
> (message-hide-headers)
> (set-buffer-modified-p nil)
> + (notmuch-mua-maybe-set-window-dedicated)
>
> (message-goto-to))
>
> @@ -272,8 +308,8 @@ the From: address first."
> (interactive "P")
> (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)))
> + (list (cons "From" (notmuch-mua-prompt-for-sender))))))
> + (notmuch-mua-mail nil nil other-headers nil (notmuch-mua-get-switch-function))))
>
> (defun notmuch-mua-new-forward-message (&optional prompt-for-sender)
> "Invoke the notmuch message forwarding window.
> --
> 1.7.9.5
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2012-04-14 19:36 ` Jameson Graef Rollins
2012-04-14 20:20 ` [PATCH] " Jameson Graef Rollins
@ 2012-04-15 14:52 ` David Bremner
2012-04-22 22:25 ` Thomas Jost
1 sibling, 1 reply; 65+ messages in thread
From: David Bremner @ 2012-04-15 14:52 UTC (permalink / raw)
To: Jameson Graef Rollins, Thomas Jost, notmuch
Jameson Graef Rollins <jrollins@finestructure.net> writes:
> I think the issues that David was experiencing have to do with flakiness
> in emacs's dedicated windows, not in this patch itself.
Thomas,
Did you have a change to investigate this as proposed in
id:"87zke0aifa.fsf@thor.loria.fr"?
d
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2012-04-15 14:52 ` [PATCH v3 1/4] " David Bremner
@ 2012-04-22 22:25 ` Thomas Jost
2012-04-29 19:12 ` David Bremner
0 siblings, 1 reply; 65+ messages in thread
From: Thomas Jost @ 2012-04-22 22:25 UTC (permalink / raw)
To: David Bremner, Jameson Graef Rollins, notmuch
[-- Attachment #1: Type: text/plain, Size: 2252 bytes --]
Le 15 avril 2012 à 16:52 CEST, David Bremner a écrit :
> Jameson Graef Rollins <jrollins@finestructure.net> writes:
>
>> I think the issues that David was experiencing have to do with flakiness
>> in emacs's dedicated windows, not in this patch itself.
>
> Thomas,
>
> Did you have a change to investigate this as proposed in
> id:"87zke0aifa.fsf@thor.loria.fr"?
David,
Sorry for the delay. I did investigate a little bit, but I did not try
to write a patch to fix the wrong behaviour in Emacs 23.
AFAICT, Emacs 23 is just buggy in this case. By reading the code of
message-send-and-exit and message-bury [1], here is what happens when
you call message-send-buffer-and-exit with message-kill-buffer-on-exit
set to nil:
- message is sent
- buffer is buried with burry-buffer
- message-bury: if the window is dedicated and its frame not the only
visible frame, then this frame is deleted
which explains what happens in Emacs 23 both in daemon and non-daemon
mode.
In Emacs 24 [2], here is what happens:
- message is sent
- message-bury: buffer is buried with bury-buffer
which is (obviously?) correct.
Really, this looks like a bug in Emacs 23 to me. Emacs 24 has been fixed
by Gnus commits [3] and [4] (maybe [3] is enough, I didn't try). Users
of Emacs 23 can probably just use an up-to-date version of Gnus to have
this issue fixed.
So I'm not sure it would make sense to try to come up with a workaround
in my patch, nor if it would be worth it. Maybe just adding a message
suggesting Emacs 23 users to enable message-kill-buffer-on-exit if they
use the Gnus version shipped with Emacs?
Other than that, Jameson's commit [5] is exactly the same as the one in
my tree with a better commit message, so I'm in favor of pulling it.
[1] http://bzr.savannah.gnu.org/lh/emacs/emacs-23/annotate/head:/lisp/gnus/message.el
[2] http://bzr.savannah.gnu.org/lh/emacs/emacs-24/annotate/head:/lisp/gnus/message.el
[3] http://git.gnus.org/cgit/gnus.git/commit/?id=30eb6d24d30bc028fce91a0c62044c5dc1fdd90e
[4] http://git.gnus.org/cgit/gnus.git/commit/?id=e3fc7cb33eb07dd3b48cfc72f0cada1f1edbcb85
[5] id:"1334436137-6099-1-git-send-email-jrollins@finestructure.net"
Regards,
--
Thomas/Schnouki
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
2012-04-22 22:25 ` Thomas Jost
@ 2012-04-29 19:12 ` David Bremner
2012-05-04 10:37 ` [PATCH v6] " Thomas Jost
0 siblings, 1 reply; 65+ messages in thread
From: David Bremner @ 2012-04-29 19:12 UTC (permalink / raw)
To: Thomas Jost, Jameson Graef Rollins, notmuch
Thomas Jost <schnouki@schnouki.net> writes:
> AFAICT, Emacs 23 is just buggy in this case. By reading the code of
> message-send-and-exit and message-bury [1], here is what happens when
> you call message-send-buffer-and-exit with message-kill-buffer-on-exit
> set to nil:
> - message is sent
> - buffer is buried with burry-buffer
> - message-bury: if the window is dedicated and its frame not the only
> visible frame, then this frame is deleted
OK, I guess I can live with the behaviour as an emacs 23 bug, but I
think we should warn the user of this bug somewhere prominently, perhaps
in the customize message. Effectively users of emacs23 and emacsclient
will probably want to avoid the "new-window" setting.
d
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v6] emacs: Let the user choose where to compose new mails
2012-04-29 19:12 ` David Bremner
@ 2012-05-04 10:37 ` Thomas Jost
2012-05-05 23:20 ` Jameson Graef Rollins
2012-05-06 12:21 ` David Bremner
0 siblings, 2 replies; 65+ messages in thread
From: Thomas Jost @ 2012-05-04 10:37 UTC (permalink / raw)
To: notmuch
Introduce a new defcustom notmuch-mua-compose-in that allows users to
specify where new mails are composed, either in the current window or
in a new window or frame.
Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
---
Hi David et al.,
Here it is again, with a warning in the customize message that only
appears in Emacs 23. The indentation is a little bit of a mess but
that's needed for the docstring to look good :)
(If you want I can remove the test and also display the Emacs 23
warning in Emacs 24.)
Does it look good to you? I'm not comfortable with writing docs in
English, so feel free to rephrase it if needed.
I also moved notmuch-mua-compose-in to the 'notmuch-send group, just
as other notmuch-mua-* variables.
Regards,
Thomas
emacs/notmuch-mua.el | 45 +++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 43 insertions(+), 2 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 87bd88d..641dae7 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -36,6 +36,26 @@
:group 'notmuch-send
:group 'notmuch-hooks)
+(defcustom notmuch-mua-compose-in 'current-window
+ (concat
+ "Where to create the mail buffer used to compose a new message.
+Possible values are `current-window' (default), `new-window' and
+`new-frame'. If set to `current-window', the mail buffer will be
+displayed in the current window, so the old buffer will be
+restored when the mail buffer is killed. If set to `new-window'
+or `new-frame', the mail buffer will be displayed in a new
+window/frame that will be destroyed when the buffer is killed.
+You may want to customize `message-kill-buffer-on-exit'
+accordingly."
+ (when (< emacs-major-version 24)
+ " Due to a known bug in Emacs 23, you should not set
+this to `new-window' if `message-kill-buffer-on-exit' is
+disabled: this would result in an incorrect behavior."))
+ :group 'notmuch-send
+ :type '(choice (const :tag "Compose in the current window" current-window)
+ (const :tag "Compose mail in a new window" new-window)
+ (const :tag "Compose mail in a new frame" new-frame)))
+
(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."
@@ -55,6 +75,23 @@ list."
;;
+(defun notmuch-mua-get-switch-function ()
+ "Get a switch function according to `notmuch-mua-compose-in'."
+ (cond ((eq notmuch-mua-compose-in 'current-window)
+ 'switch-to-buffer)
+ ((eq notmuch-mua-compose-in 'new-window)
+ 'switch-to-buffer-other-window)
+ ((eq notmuch-mua-compose-in 'new-frame)
+ 'switch-to-buffer-other-frame)
+ (t (error "Invalid value for `notmuch-mua-compose-in'"))))
+
+(defun notmuch-mua-maybe-set-window-dedicated ()
+ "Set the selected window as dedicated according to
+`notmuch-mua-compose-in'."
+ (when (or (eq notmuch-mua-compose-in 'new-frame)
+ (eq notmuch-mua-compose-in 'new-window))
+ (set-window-dedicated-p (selected-window) t)))
+
(defun notmuch-mua-user-agent-full ()
"Generate a `User-Agent:' string suitable for notmuch."
(concat (notmuch-mua-user-agent-notmuch)
@@ -148,7 +185,8 @@ list."
collect pair)))
(notmuch-mua-mail (plist-get reply-headers :To)
(plist-get reply-headers :Subject)
- (notmuch-headers-plist-to-alist reply-headers))))
+ (notmuch-headers-plist-to-alist reply-headers)
+ nil (notmuch-mua-get-switch-function))))
;; Insert the message body - but put it in front of the signature
;; if one is present
@@ -186,6 +224,7 @@ list."
(set-buffer-modified-p nil))
(defun notmuch-mua-forward-message ()
+ (funcall (notmuch-mua-get-switch-function) (current-buffer))
(message-forward)
(when notmuch-mua-user-agent-function
@@ -195,6 +234,7 @@ list."
(message-sort-headers)
(message-hide-headers)
(set-buffer-modified-p nil)
+ (notmuch-mua-maybe-set-window-dedicated)
(message-goto-to))
@@ -217,6 +257,7 @@ OTHER-ARGS are passed through to `message-mail'."
(message-sort-headers)
(message-hide-headers)
(set-buffer-modified-p nil)
+ (notmuch-mua-maybe-set-window-dedicated)
(message-goto-to))
@@ -273,7 +314,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-get-switch-function))))
(defun notmuch-mua-new-forward-message (&optional prompt-for-sender)
"Invoke the notmuch message forwarding window.
--
1.7.10.1
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH v6] emacs: Let the user choose where to compose new mails
2012-05-04 10:37 ` [PATCH v6] " Thomas Jost
@ 2012-05-05 23:20 ` Jameson Graef Rollins
2012-05-06 12:21 ` David Bremner
1 sibling, 0 replies; 65+ messages in thread
From: Jameson Graef Rollins @ 2012-05-05 23:20 UTC (permalink / raw)
To: Thomas Jost, notmuch
[-- Attachment #1: Type: text/plain, Size: 956 bytes --]
On Fri, May 04 2012, Thomas Jost <schnouki@schnouki.net> wrote:
> Here it is again, with a warning in the customize message that only
> appears in Emacs 23. The indentation is a little bit of a mess but
> that's needed for the docstring to look good :)
Great! That's a nice trick, Thomas. Thanks. This should definitely
address David's concerns.
> (If you want I can remove the test and also display the Emacs 23
> warning in Emacs 24.)
I think the included solution is perfect.
> Does it look good to you? I'm not comfortable with writing docs in
> English, so feel free to rephrase it if needed.
Yes, it is good. It reads well and includes all the relevant
information.
> I also moved notmuch-mua-compose-in to the 'notmuch-send group, just
> as other notmuch-mua-* variables.
Perfect.
I have reviewed and tested this updated version of the patch and
everything looks and works great. Thank you so much for topping this
off, Thomas.
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v6] emacs: Let the user choose where to compose new mails
2012-05-04 10:37 ` [PATCH v6] " Thomas Jost
2012-05-05 23:20 ` Jameson Graef Rollins
@ 2012-05-06 12:21 ` David Bremner
1 sibling, 0 replies; 65+ messages in thread
From: David Bremner @ 2012-05-06 12:21 UTC (permalink / raw)
To: Thomas Jost, notmuch
Thomas Jost <schnouki@schnouki.net> writes:
> Introduce a new defcustom notmuch-mua-compose-in that allows users to
> specify where new mails are composed, either in the current window or
> in a new window or frame.
>
> Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
> ---
pushed.
d
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v3 2/4] emacs: Add a face for crypto parts headers
2011-12-13 17:32 ` [PATCH v3 " Thomas Jost
2011-12-13 17:32 ` [PATCH v3 1/4] emacs: Let the user choose where to compose new mails Thomas Jost
@ 2011-12-13 17:32 ` Thomas Jost
2011-12-16 0:56 ` Dmitry Kurochkin
2011-12-16 3:04 ` David Bremner
2011-12-13 17:32 ` [PATCH v3 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator Thomas Jost
` (2 subsequent siblings)
4 siblings, 2 replies; 65+ messages in thread
From: Thomas Jost @ 2011-12-13 17:32 UTC (permalink / raw)
To: notmuch
Commit cb841878 introduced new parts handlers for crypto parts, but also
hardcoded values for their headers face. This replaces these hardcoded values
with a customizable face.
---
emacs/notmuch-crypto.el | 5 +++++
emacs/notmuch-show.el | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index 44fccae..67c26af 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -37,6 +37,11 @@ mode."
:group 'notmuch
:type 'boolean)
+(defface notmuch-crypto-part-header
+ '((t (:foreground "blue")))
+ "Face used for crypto parts headers."
+ :group 'notmuch)
+
(defface notmuch-crypto-signature-good
'((t (:background "green" :foreground "black")))
"Face used for good signatures."
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 33ee3d8..ec9c52c 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -457,7 +457,7 @@ current buffer, if possible."
(defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth declared-type)
(let ((button (notmuch-show-insert-part-header nth declared-type content-type nil)))
- (button-put button 'face '(:foreground "blue"))
+ (button-put button 'face 'notmuch-crypto-part-header)
;; add signature status button if sigstatus provided
(if (plist-member part :sigstatus)
(let* ((from (notmuch-show-get-header :From msg))
@@ -479,7 +479,7 @@ current buffer, if possible."
(defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth declared-type)
(let ((button (notmuch-show-insert-part-header nth declared-type content-type nil)))
- (button-put button 'face '(:foreground "blue"))
+ (button-put button 'face 'notmuch-crypto-part-header)
;; add encryption status button if encstatus specified
(if (plist-member part :encstatus)
(let ((encstatus (car (plist-get part :encstatus))))
--
1.7.8
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH v3 2/4] emacs: Add a face for crypto parts headers
2011-12-13 17:32 ` [PATCH v3 2/4] emacs: Add a face for crypto parts headers Thomas Jost
@ 2011-12-16 0:56 ` Dmitry Kurochkin
2011-12-16 3:04 ` David Bremner
1 sibling, 0 replies; 65+ messages in thread
From: Dmitry Kurochkin @ 2011-12-16 0:56 UTC (permalink / raw)
To: Thomas Jost, notmuch
On Tue, 13 Dec 2011 18:32:10 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
> Commit cb841878 introduced new parts handlers for crypto parts, but also
> hardcoded values for their headers face. This replaces these hardcoded values
> with a customizable face.
> ---
Looks good to me.
Regards,
Dmitry
> emacs/notmuch-crypto.el | 5 +++++
> emacs/notmuch-show.el | 4 ++--
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
> index 44fccae..67c26af 100644
> --- a/emacs/notmuch-crypto.el
> +++ b/emacs/notmuch-crypto.el
> @@ -37,6 +37,11 @@ mode."
> :group 'notmuch
> :type 'boolean)
>
> +(defface notmuch-crypto-part-header
> + '((t (:foreground "blue")))
> + "Face used for crypto parts headers."
> + :group 'notmuch)
> +
> (defface notmuch-crypto-signature-good
> '((t (:background "green" :foreground "black")))
> "Face used for good signatures."
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 33ee3d8..ec9c52c 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -457,7 +457,7 @@ current buffer, if possible."
>
> (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth declared-type)
> (let ((button (notmuch-show-insert-part-header nth declared-type content-type nil)))
> - (button-put button 'face '(:foreground "blue"))
> + (button-put button 'face 'notmuch-crypto-part-header)
> ;; add signature status button if sigstatus provided
> (if (plist-member part :sigstatus)
> (let* ((from (notmuch-show-get-header :From msg))
> @@ -479,7 +479,7 @@ current buffer, if possible."
>
> (defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth declared-type)
> (let ((button (notmuch-show-insert-part-header nth declared-type content-type nil)))
> - (button-put button 'face '(:foreground "blue"))
> + (button-put button 'face 'notmuch-crypto-part-header)
> ;; add encryption status button if encstatus specified
> (if (plist-member part :encstatus)
> (let ((encstatus (car (plist-get part :encstatus))))
> --
> 1.7.8
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 2/4] emacs: Add a face for crypto parts headers
2011-12-13 17:32 ` [PATCH v3 2/4] emacs: Add a face for crypto parts headers Thomas Jost
2011-12-16 0:56 ` Dmitry Kurochkin
@ 2011-12-16 3:04 ` David Bremner
1 sibling, 0 replies; 65+ messages in thread
From: David Bremner @ 2011-12-16 3:04 UTC (permalink / raw)
To: Thomas Jost, notmuch
On Tue, 13 Dec 2011 18:32:10 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
> Commit cb841878 introduced new parts handlers for crypto parts, but also
> hardcoded values for their headers face. This replaces these hardcoded values
> with a customizable face.
pushed. and customized ;).
d
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v3 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator
2011-12-13 17:32 ` [PATCH v3 " Thomas Jost
2011-12-13 17:32 ` [PATCH v3 1/4] emacs: Let the user choose where to compose new mails Thomas Jost
2011-12-13 17:32 ` [PATCH v3 2/4] emacs: Add a face for crypto parts headers Thomas Jost
@ 2011-12-13 17:32 ` Thomas Jost
2011-12-16 0:59 ` Dmitry Kurochkin
2011-12-13 17:32 ` [PATCH v3 4/4] emacs: add notmuch-hello-hook Thomas Jost
2011-12-13 18:16 ` [PATCH v3 0/4] Several minor Emacs enhancements Jameson Graef Rollins
4 siblings, 1 reply; 65+ messages in thread
From: Thomas Jost @ 2011-12-13 17:32 UTC (permalink / raw)
To: notmuch
In 123,456.78, "." is the decimal separator, but "," is the thousands separator.
This commit also mentions the space being used as thousands separator in several
European countries.
---
emacs/notmuch-hello.el | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 0582cae..0fe9c1d 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -131,10 +131,10 @@ So:
(integer :tag "Number of characters")
(float :tag "Fraction of window")))
-(defcustom notmuch-decimal-separator ","
- "The string used as a decimal separator.
+(defcustom notmuch-thousands-separator ","
+ "The string used as a thousands separator.
-Typically \",\" in the US and UK and \".\" in Europe."
+Typically \",\" in the US and UK and \".\" or \" \" in Europe."
:group 'notmuch
:type 'string)
@@ -159,7 +159,7 @@ Typically \",\" in the US and UK and \".\" in Europe."
(apply #'concat
(number-to-string (car result))
(mapcar (lambda (elem)
- (format "%s%03d" notmuch-decimal-separator elem))
+ (format "%s%03d" notmuch-thousands-separator elem))
(cdr result)))))
(defun notmuch-hello-trim (search)
--
1.7.8
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH v3 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator
2011-12-13 17:32 ` [PATCH v3 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator Thomas Jost
@ 2011-12-16 0:59 ` Dmitry Kurochkin
2011-12-16 12:29 ` David Bremner
0 siblings, 1 reply; 65+ messages in thread
From: Dmitry Kurochkin @ 2011-12-16 0:59 UTC (permalink / raw)
To: Thomas Jost, notmuch
On Tue, 13 Dec 2011 18:32:11 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
> In 123,456.78, "." is the decimal separator, but "," is the thousands separator.
>
> This commit also mentions the space being used as thousands separator in several
> European countries.
> ---
What do perople think about making the thousands separator a space by
default?
> emacs/notmuch-hello.el | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 0582cae..0fe9c1d 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -131,10 +131,10 @@ So:
> (integer :tag "Number of characters")
> (float :tag "Fraction of window")))
>
> -(defcustom notmuch-decimal-separator ","
> - "The string used as a decimal separator.
> +(defcustom notmuch-thousands-separator ","
> + "The string used as a thousands separator.
I suggest renaming this to notmuch-hello-thousands-separator.
Looks good otherwise.
Regards,
Dmitry
>
> -Typically \",\" in the US and UK and \".\" in Europe."
> +Typically \",\" in the US and UK and \".\" or \" \" in Europe."
> :group 'notmuch
> :type 'string)
>
> @@ -159,7 +159,7 @@ Typically \",\" in the US and UK and \".\" in Europe."
> (apply #'concat
> (number-to-string (car result))
> (mapcar (lambda (elem)
> - (format "%s%03d" notmuch-decimal-separator elem))
> + (format "%s%03d" notmuch-thousands-separator elem))
> (cdr result)))))
>
> (defun notmuch-hello-trim (search)
> --
> 1.7.8
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator
2011-12-16 0:59 ` Dmitry Kurochkin
@ 2011-12-16 12:29 ` David Bremner
2011-12-16 12:34 ` Dmitry Kurochkin
0 siblings, 1 reply; 65+ messages in thread
From: David Bremner @ 2011-12-16 12:29 UTC (permalink / raw)
To: Dmitry Kurochkin, Thomas Jost, notmuch
On Fri, 16 Dec 2011 04:59:22 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
>
> What do perople think about making the thousands separator a space by
> default?
>
Is that really good for a majority of users? I had never heard of it
until now. I know this is hardly scientific, but still...
d
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator
2011-12-16 12:29 ` David Bremner
@ 2011-12-16 12:34 ` Dmitry Kurochkin
2011-12-21 0:30 ` Thomas Jost
0 siblings, 1 reply; 65+ messages in thread
From: Dmitry Kurochkin @ 2011-12-16 12:34 UTC (permalink / raw)
To: David Bremner, Thomas Jost, notmuch
On Fri, 16 Dec 2011 08:29:00 -0400, David Bremner <david@tethera.net> wrote:
> On Fri, 16 Dec 2011 04:59:22 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> >
> > What do perople think about making the thousands separator a space by
> > default?
> >
>
> Is that really good for a majority of users? I had never heard of it
> until now. I know this is hardly scientific, but still...
>
Well, to me "1 000 000 000" looks better than "1,000,000,000". But I do
not know about the others. That is why I was asking :)
Regards,
Dmitry
> d
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator
2011-12-16 12:34 ` Dmitry Kurochkin
@ 2011-12-21 0:30 ` Thomas Jost
2011-12-21 1:41 ` Dmitry Kurochkin
0 siblings, 1 reply; 65+ messages in thread
From: Thomas Jost @ 2011-12-21 0:30 UTC (permalink / raw)
To: Dmitry Kurochkin, David Bremner, notmuch
[-- Attachment #1: Type: text/plain, Size: 1135 bytes --]
On Fri, 16 Dec 2011 16:34:03 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> On Fri, 16 Dec 2011 08:29:00 -0400, David Bremner <david@tethera.net> wrote:
> > On Fri, 16 Dec 2011 04:59:22 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> > >
> > > What do perople think about making the thousands separator a space by
> > > default?
> > >
> >
> > Is that really good for a majority of users? I had never heard of it
> > until now. I know this is hardly scientific, but still...
> >
>
> Well, to me "1 000 000 000" looks better than "1,000,000,000". But I do
> not know about the others. That is why I was asking :)
That's a complex topic unfortunately. I prefer "1 000 000" too, but many
would prefer "1,000,000", others would prefer "1'000'000", and in India
many would even prefer "1,00,0000"
(https://en.wikipedia.org/wiki/Thousands_separator#Examples_of_use).
The cleanest solution would be to use something that cares about the
LC_NUMERIC environment variable. sprintf() can do such things, but I'm
not aware of any possibility to do that in elisp.
--
Thomas/Schnouki
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator
2011-12-21 0:30 ` Thomas Jost
@ 2011-12-21 1:41 ` Dmitry Kurochkin
2011-12-21 13:44 ` [PATCH 1/2] emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator Thomas Jost
0 siblings, 1 reply; 65+ messages in thread
From: Dmitry Kurochkin @ 2011-12-21 1:41 UTC (permalink / raw)
To: Thomas Jost, David Bremner, notmuch
Hi Thomas.
On Wed, 21 Dec 2011 01:30:48 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
> On Fri, 16 Dec 2011 16:34:03 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> > On Fri, 16 Dec 2011 08:29:00 -0400, David Bremner <david@tethera.net> wrote:
> > > On Fri, 16 Dec 2011 04:59:22 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> > > >
> > > > What do perople think about making the thousands separator a space by
> > > > default?
> > > >
> > >
> > > Is that really good for a majority of users? I had never heard of it
> > > until now. I know this is hardly scientific, but still...
> > >
> >
> > Well, to me "1 000 000 000" looks better than "1,000,000,000". But I do
> > not know about the others. That is why I was asking :)
>
> That's a complex topic unfortunately. I prefer "1 000 000" too, but many
> would prefer "1,000,000", others would prefer "1'000'000", and in India
> many would even prefer "1,00,0000"
> (https://en.wikipedia.org/wiki/Thousands_separator#Examples_of_use).
>
> The cleanest solution would be to use something that cares about the
> LC_NUMERIC environment variable. sprintf() can do such things, but I'm
> not aware of any possibility to do that in elisp.
>
We discussed this on IRC. And, surprisingly, everyone agreed on
changing the default to a space in a separate patch.
But my other comment for this patch is still relevant: please rename
`notmuch-thousands-separator' to `notmuch-hello-thousands-separator'.
If you decide to make another patch that changes the default to a space,
please add this link [1] to the preamble and a citation:
Therefore the space is recommended in the SI/ISO 31-0 standard,
and the International Bureau of Weights and Measures states that "for
numbers with many digits the digits may be divided into groups of
three by a thin space, in order to facilitate reading. Neither dots
nor commas are inserted in the spaces between groups of three".
Regards,
Dmitry
[1] http://en.wikipedia.org/wiki/Decimal_separator#Digit_grouping
> --
> Thomas/Schnouki
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH 1/2] emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator
2011-12-21 1:41 ` Dmitry Kurochkin
@ 2011-12-21 13:44 ` Thomas Jost
2011-12-21 13:44 ` [PATCH 2/2] emacs: Change the default thousands separator to a space Thomas Jost
` (2 more replies)
0 siblings, 3 replies; 65+ messages in thread
From: Thomas Jost @ 2011-12-21 13:44 UTC (permalink / raw)
To: Dmitry Kurochkin; +Cc: notmuch
In 123,456.78, "." is the decimal separator, but "," is the thousands separator.
---
emacs/notmuch-hello.el | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index f892ff7..ef585ea 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -131,8 +131,8 @@ So:
(integer :tag "Number of characters")
(float :tag "Fraction of window")))
-(defcustom notmuch-decimal-separator ","
- "The string used as a decimal separator.
+(defcustom notmuch-hello-thousands-separator ","
+ "The string used as a thousands separator.
Typically \",\" in the US and UK and \".\" in Europe."
:group 'notmuch
@@ -169,7 +169,7 @@ Typically \",\" in the US and UK and \".\" in Europe."
(apply #'concat
(number-to-string (car result))
(mapcar (lambda (elem)
- (format "%s%03d" notmuch-decimal-separator elem))
+ (format "%s%03d" notmuch-hello-thousands-separator elem))
(cdr result)))))
(defun notmuch-hello-trim (search)
--
1.7.8
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH 2/2] emacs: Change the default thousands separator to a space
2011-12-21 13:44 ` [PATCH 1/2] emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator Thomas Jost
@ 2011-12-21 13:44 ` Thomas Jost
2011-12-21 14:12 ` Tomi Ollila
2011-12-21 16:37 ` [PATCH 1/2] emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator Dmitry Kurochkin
2011-12-22 11:25 ` David Bremner
2 siblings, 1 reply; 65+ messages in thread
From: Thomas Jost @ 2011-12-21 13:44 UTC (permalink / raw)
To: Dmitry Kurochkin; +Cc: notmuch
This had been discussed and decided on IRC.
Rationale:
Therefore the space is recommended in the SI/ISO 31-0 standard, and the
International Bureau of Weights and Measures states that "for numbers with
many digits the digits may be divided into groups of three by a thin space, in
order to facilitate reading. Neither dots nor commas are inserted in the
spaces between groups of three".
(http://en.wikipedia.org/wiki/Decimal_separator#Digit_grouping)
---
emacs/notmuch-hello.el | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index ef585ea..878d92a 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -131,10 +131,12 @@ So:
(integer :tag "Number of characters")
(float :tag "Fraction of window")))
-(defcustom notmuch-hello-thousands-separator ","
+(defcustom notmuch-hello-thousands-separator " "
"The string used as a thousands separator.
-Typically \",\" in the US and UK and \".\" in Europe."
+Typically \",\" in the US and UK and \".\" or \" \" in Europe.
+The latter is recommended in the SI/ISO 31-0 standard and by the
+International Bureau of Weights and Measures."
:group 'notmuch
:type 'string)
--
1.7.8
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH 1/2] emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator
2011-12-21 13:44 ` [PATCH 1/2] emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator Thomas Jost
2011-12-21 13:44 ` [PATCH 2/2] emacs: Change the default thousands separator to a space Thomas Jost
@ 2011-12-21 16:37 ` Dmitry Kurochkin
2011-12-22 11:25 ` David Bremner
2 siblings, 0 replies; 65+ messages in thread
From: Dmitry Kurochkin @ 2011-12-21 16:37 UTC (permalink / raw)
To: Thomas Jost; +Cc: notmuch
Both patches look good to me.
Thanks, Thomas!
Regards,
Dmitry
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH 1/2] emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator
2011-12-21 13:44 ` [PATCH 1/2] emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator Thomas Jost
2011-12-21 13:44 ` [PATCH 2/2] emacs: Change the default thousands separator to a space Thomas Jost
2011-12-21 16:37 ` [PATCH 1/2] emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator Dmitry Kurochkin
@ 2011-12-22 11:25 ` David Bremner
2 siblings, 0 replies; 65+ messages in thread
From: David Bremner @ 2011-12-22 11:25 UTC (permalink / raw)
To: Thomas Jost, Dmitry Kurochkin; +Cc: notmuch
On Wed, 21 Dec 2011 14:44:18 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
> In 123,456.78, "." is the decimal separator, but "," is the thousands separator.
> ---
This and the next one are both pushed.
d
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v3 4/4] emacs: add notmuch-hello-hook
2011-12-13 17:32 ` [PATCH v3 " Thomas Jost
` (2 preceding siblings ...)
2011-12-13 17:32 ` [PATCH v3 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator Thomas Jost
@ 2011-12-13 17:32 ` Thomas Jost
2011-12-13 17:49 ` Dmitry Kurochkin
2011-12-13 18:16 ` [PATCH v3 0/4] Several minor Emacs enhancements Jameson Graef Rollins
4 siblings, 1 reply; 65+ messages in thread
From: Thomas Jost @ 2011-12-13 17:32 UTC (permalink / raw)
To: notmuch
This hook is called every time the notmuch-hello buffer is updated.
---
emacs/notmuch-hello.el | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 0fe9c1d..112b40b 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -131,6 +131,11 @@ So:
(integer :tag "Number of characters")
(float :tag "Fraction of window")))
+(defcustom notmuch-hello-hook nil
+ "Functions called after populating a `notmuch-hello' buffer."
+ :type 'hook
+ :group 'notmuch)
+
(defcustom notmuch-thousands-separator ","
"The string used as a thousands separator.
@@ -579,7 +584,9 @@ Complete list of currently available key bindings:
(widget-forward 1)))
(unless (widget-at)
- (notmuch-hello-goto-search)))))
+ (notmuch-hello-goto-search))
+
+ (run-hooks 'notmuch-hello-hook))))
(defun notmuch-folder ()
"Deprecated function for invoking notmuch---calling `notmuch' is preferred now."
--
1.7.8
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH v3 4/4] emacs: add notmuch-hello-hook
2011-12-13 17:32 ` [PATCH v3 4/4] emacs: add notmuch-hello-hook Thomas Jost
@ 2011-12-13 17:49 ` Dmitry Kurochkin
2011-12-16 18:36 ` Dmitry Kurochkin
0 siblings, 1 reply; 65+ messages in thread
From: Dmitry Kurochkin @ 2011-12-13 17:49 UTC (permalink / raw)
To: Thomas Jost, notmuch
On Tue, 13 Dec 2011 18:32:12 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
> This hook is called every time the notmuch-hello buffer is updated.
> ---
> emacs/notmuch-hello.el | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 0fe9c1d..112b40b 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -131,6 +131,11 @@ So:
> (integer :tag "Number of characters")
> (float :tag "Fraction of window")))
>
> +(defcustom notmuch-hello-hook nil
> + "Functions called after populating a `notmuch-hello' buffer."
> + :type 'hook
> + :group 'notmuch)
> +
> (defcustom notmuch-thousands-separator ","
> "The string used as a thousands separator.
>
> @@ -579,7 +584,9 @@ Complete list of currently available key bindings:
> (widget-forward 1)))
>
> (unless (widget-at)
> - (notmuch-hello-goto-search)))))
> + (notmuch-hello-goto-search))
> +
> + (run-hooks 'notmuch-hello-hook))))
>
I spent some time finding out why run-hooks are not on the top level.
Turns out it is inside two let statements. Can we move to the top level
of `notmuch-hello' to make it clear that it is always run (i.e. there
are no ifs or whens)?
BTW this would replace one of the oldest custom patches which I have in
my master branch :)
Regards,
Dmitry
> (defun notmuch-folder ()
> "Deprecated function for invoking notmuch---calling `notmuch' is preferred now."
> --
> 1.7.8
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 4/4] emacs: add notmuch-hello-hook
2011-12-13 17:49 ` Dmitry Kurochkin
@ 2011-12-16 18:36 ` Dmitry Kurochkin
2011-12-21 0:21 ` [PATCH] emacs: add notmuch-hello-refresh-hook Thomas Jost
0 siblings, 1 reply; 65+ messages in thread
From: Dmitry Kurochkin @ 2011-12-16 18:36 UTC (permalink / raw)
To: Thomas Jost, notmuch
On Tue, 13 Dec 2011 21:49:00 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> On Tue, 13 Dec 2011 18:32:12 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
> > This hook is called every time the notmuch-hello buffer is updated.
> > ---
> > emacs/notmuch-hello.el | 9 ++++++++-
> > 1 files changed, 8 insertions(+), 1 deletions(-)
> >
> > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> > index 0fe9c1d..112b40b 100644
> > --- a/emacs/notmuch-hello.el
> > +++ b/emacs/notmuch-hello.el
> > @@ -131,6 +131,11 @@ So:
> > (integer :tag "Number of characters")
> > (float :tag "Fraction of window")))
> >
> > +(defcustom notmuch-hello-hook nil
> > + "Functions called after populating a `notmuch-hello' buffer."
> > + :type 'hook
> > + :group 'notmuch)
> > +
> > (defcustom notmuch-thousands-separator ","
> > "The string used as a thousands separator.
> >
> > @@ -579,7 +584,9 @@ Complete list of currently available key bindings:
> > (widget-forward 1)))
> >
> > (unless (widget-at)
> > - (notmuch-hello-goto-search)))))
> > + (notmuch-hello-goto-search))
> > +
> > + (run-hooks 'notmuch-hello-hook))))
> >
>
> I spent some time finding out why run-hooks are not on the top level.
> Turns out it is inside two let statements. Can we move to the top level
> of `notmuch-hello' to make it clear that it is always run (i.e. there
> are no ifs or whens)?
>
In addition to the above comment: I think we should rename
notmuch-hello-hook to notmuch-hello-refresh-hook. That would make it
clear that the hook runs on each notmuch-hello buffer update. And would
avoid confusion with notmuch-hello-mode-hook if we add it later.
Regards,
Dmitry
> BTW this would replace one of the oldest custom patches which I have in
> my master branch :)
>
> Regards,
> Dmitry
>
> > (defun notmuch-folder ()
> > "Deprecated function for invoking notmuch---calling `notmuch' is preferred now."
> > --
> > 1.7.8
> >
> > _______________________________________________
> > notmuch mailing list
> > notmuch@notmuchmail.org
> > http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH] emacs: add notmuch-hello-refresh-hook
2011-12-16 18:36 ` Dmitry Kurochkin
@ 2011-12-21 0:21 ` Thomas Jost
2011-12-21 1:28 ` Thomas Jost
2011-12-21 1:33 ` Dmitry Kurochkin
0 siblings, 2 replies; 65+ messages in thread
From: Thomas Jost @ 2011-12-21 0:21 UTC (permalink / raw)
To: Dmitry Kurochkin; +Cc: notmuch
This hook is called every time a notmuch-hello buffer is updated.
---
Hi Dmitry,
I like the idea of having a -mode-hook and a -refresh-hook :) Thanks for your
suggestions!
Regards,
Thomas
emacs/notmuch-hello.el | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 115f80a..9fa3137 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -143,6 +143,11 @@ Typically \",\" in the US and UK and \".\" or \" \" in Europe."
:group 'notmuch
:type 'hook)
+(defcustom notmuch-hello-refresh-hook nil
+ "Functions called after updating a `notmuch-hello' buffer."
+ :type 'hook
+ :group notmuch)
+
(defvar notmuch-hello-url "http://notmuchmail.org"
"The `notmuch' web site.")
@@ -590,7 +595,9 @@ Complete list of currently available key bindings:
(widget-forward 1)))
(unless (widget-at)
- (notmuch-hello-goto-search)))))
+ (notmuch-hello-goto-search))))
+
+ (run-hooks 'notmuch-hello-refresh-hook))
(defun notmuch-folder ()
"Deprecated function for invoking notmuch---calling `notmuch' is preferred now."
--
1.7.8
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH] emacs: add notmuch-hello-refresh-hook
2011-12-21 0:21 ` [PATCH] emacs: add notmuch-hello-refresh-hook Thomas Jost
@ 2011-12-21 1:28 ` Thomas Jost
2011-12-21 12:03 ` David Bremner
2011-12-21 12:17 ` David Bremner
2011-12-21 1:33 ` Dmitry Kurochkin
1 sibling, 2 replies; 65+ messages in thread
From: Thomas Jost @ 2011-12-21 1:28 UTC (permalink / raw)
To: notmuch
This hook is called every time a notmuch-hello buffer is updated.
---
Oops, the previous patch had a typo which prevented it to work (":group notmuch"
instead of ":group 'notmuch"). Sorry about that.
emacs/notmuch-hello.el | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 115f80a..a2b1c4c 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -143,6 +143,11 @@ Typically \",\" in the US and UK and \".\" or \" \" in Europe."
:group 'notmuch
:type 'hook)
+(defcustom notmuch-hello-refresh-hook nil
+ "Functions called after updating a `notmuch-hello' buffer."
+ :type 'hook
+ :group 'notmuch)
+
(defvar notmuch-hello-url "http://notmuchmail.org"
"The `notmuch' web site.")
@@ -590,7 +595,9 @@ Complete list of currently available key bindings:
(widget-forward 1)))
(unless (widget-at)
- (notmuch-hello-goto-search)))))
+ (notmuch-hello-goto-search))))
+
+ (run-hooks 'notmuch-hello-refresh-hook))
(defun notmuch-folder ()
"Deprecated function for invoking notmuch---calling `notmuch' is preferred now."
--
1.7.8
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH] emacs: add notmuch-hello-refresh-hook
2011-12-21 0:21 ` [PATCH] emacs: add notmuch-hello-refresh-hook Thomas Jost
2011-12-21 1:28 ` Thomas Jost
@ 2011-12-21 1:33 ` Dmitry Kurochkin
2011-12-21 13:13 ` [PATCH] test: add tests for `notmuch-hello-refresh-hook' Thomas Jost
1 sibling, 1 reply; 65+ messages in thread
From: Dmitry Kurochkin @ 2011-12-21 1:33 UTC (permalink / raw)
To: Thomas Jost; +Cc: notmuch
Hi Thomas.
Looks good to me.
We should also add tests for this, similar to those for
`notmuch-hello-mode-hook'. Thomas, do you think you can work on it?
Regards,
Dmitry
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH] test: add tests for `notmuch-hello-refresh-hook'
2011-12-21 1:33 ` Dmitry Kurochkin
@ 2011-12-21 13:13 ` Thomas Jost
2011-12-21 18:26 ` Dmitry Kurochkin
0 siblings, 1 reply; 65+ messages in thread
From: Thomas Jost @ 2011-12-21 13:13 UTC (permalink / raw)
To: Dmitry Kurochkin; +Cc: notmuch
Test that it's called once when `notmuch-hello' is called, and twice when
calling `notmuch-hello-update' after that.
---
Here it is. No broken subtest first since the first patch was already pushed
though.
Regards,
Thomas
test/emacs | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/test/emacs b/test/emacs
index dffad0f..94b9171 100755
--- a/test/emacs
+++ b/test/emacs
@@ -495,4 +495,27 @@ counter=$(test_emacs \
)
test_expect_equal "$counter" 1
+test_begin_subtest "notmuch-hello-refresh-hook is called"
+counter=$(test_emacs \
+ "(let ((refresh-hook-counter 0)
+ (notmuch-hello-refresh-hook nil))
+ (kill-buffer \"*notmuch-hello*\")
+ (add-hook 'notmuch-hello-refresh-hook (lambda () (incf refresh-hook-counter)))
+ (notmuch-hello)
+ refresh-hook-counter)"
+)
+test_expect_equal "$counter" 1
+
+test_begin_subtest "notmuch-hello-refresh-hook is called on updates"
+counter=$(test_emacs \
+ "(let ((refresh-hook-counter 0)
+ (notmuch-hello-refresh-hook nil))
+ (kill-buffer \"*notmuch-hello*\")
+ (add-hook 'notmuch-hello-refresh-hook (lambda () (incf refresh-hook-counter)))
+ (notmuch-hello)
+ (notmuch-hello-update)
+ refresh-hook-counter)"
+)
+test_expect_equal "$counter" 2
+
test_done
--
1.7.8
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH] test: add tests for `notmuch-hello-refresh-hook'
2011-12-21 13:13 ` [PATCH] test: add tests for `notmuch-hello-refresh-hook' Thomas Jost
@ 2011-12-21 18:26 ` Dmitry Kurochkin
0 siblings, 0 replies; 65+ messages in thread
From: Dmitry Kurochkin @ 2011-12-21 18:26 UTC (permalink / raw)
To: Thomas Jost; +Cc: notmuch
Hi Thomas.
I think all hook count tests must be consistent. We should either add
hook counters in test-lib.el (like it is already done for
`notmuch-hello-mode-hook') or use lambdas in individual test cases (like
you did in the patch).
I believe the former approach is better (that is why I used it in the
first place :)). So I sent patches [1] that add general hook counter to
test-lib.el and `notmuch-hello-mode-hook' tests that use it.
Regards,
Dmitry
[1] id:"1324491506-1134-1-git-send-email-dmitry.kurochkin@gmail.com"
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v3 0/4] Several minor Emacs enhancements
2011-12-13 17:32 ` [PATCH v3 " Thomas Jost
` (3 preceding siblings ...)
2011-12-13 17:32 ` [PATCH v3 4/4] emacs: add notmuch-hello-hook Thomas Jost
@ 2011-12-13 18:16 ` Jameson Graef Rollins
4 siblings, 0 replies; 65+ messages in thread
From: Jameson Graef Rollins @ 2011-12-13 18:16 UTC (permalink / raw)
To: Thomas Jost, notmuch
[-- Attachment #1: Type: text/plain, Size: 568 bytes --]
On Tue, 13 Dec 2011 18:32:08 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
> Here is a rebased version of this patch series, with more descriptive
> commit messages.
Hi, Thomas. Thanks for resending these.
To be clear, this is not really a patch series as the four patches are
completely independent, don't depend on each other, and are fairly
unrelated.
In any event, they all look good to me. I have been using the emacs
"choose where to compose new mails" patch for a couple of months now and
I love it. So that one at least gets my vote to push.
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread