* [PATCH 0/4] Several minor Emacs enhancements
@ 2011-10-03 12:03 Thomas Jost
2011-10-03 12:03 ` [PATCH 1/4] emacs: Add a face for crypto parts headers Thomas Jost
` (4 more replies)
0 siblings, 5 replies; 65+ messages in thread
From: Thomas Jost @ 2011-10-03 12:03 UTC (permalink / raw)
To: notmuch
Hello,
This is a little series of 4 patches to the Emacs interfaces. They are quite
small, independent from each other, and should be harmless.
- The first one adds a face for crypto parts headers, because a hardcoded blue
foreground looks quite ugly with my color theme.
- The second one creates a customizable notmuch-mua-switch-function, which is
then passed to message-mail as switch-function. Using this, you can choose to
always compose new mails in new frames or new windows.
- The third one renames notmuch-decimal-separator to
notmuch-thousands-separator, because that's what it really is.
- The last one creates a hook run after notmuch-hello, just like there are hooks
run after notmuch-search and notmuch-show.
Regards,
Thomas
Thomas Jost (4):
emacs: Add a face for crypto parts headers
emacs: Support a message-mode switch function in notmuch-mua
emacs: rename notmuch-decimal-separator to
notmuch-thousands-separator
emacs: add notmuch-hello-hook
emacs/notmuch-crypto.el | 5 +++++
emacs/notmuch-hello.el | 17 ++++++++++++-----
emacs/notmuch-mua.el | 15 +++++++++++++--
emacs/notmuch-show.el | 4 ++--
4 files changed, 32 insertions(+), 9 deletions(-)
--
1.7.6.4
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH 1/4] emacs: Add a face for crypto parts headers
2011-10-03 12:03 [PATCH 0/4] Several minor Emacs enhancements Thomas Jost
@ 2011-10-03 12:03 ` Thomas Jost
2011-10-03 12:03 ` [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua Thomas Jost
` (3 subsequent siblings)
4 siblings, 0 replies; 65+ messages in thread
From: Thomas Jost @ 2011-10-03 12:03 UTC (permalink / raw)
To: notmuch
---
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 f03266f..673ebb8 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -36,6 +36,11 @@ search."
: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 90f9af7..6b3b042 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -446,7 +446,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* ((headers (plist-get msg :headers))
@@ -469,7 +469,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.6.4
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua
2011-10-03 12:03 [PATCH 0/4] Several minor Emacs enhancements Thomas Jost
2011-10-03 12:03 ` [PATCH 1/4] emacs: Add a face for crypto parts headers Thomas Jost
@ 2011-10-03 12:03 ` Thomas Jost
2011-10-10 15:50 ` Jameson Graef Rollins
2011-10-03 12:03 ` [PATCH 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator Thomas Jost
` (2 subsequent siblings)
4 siblings, 1 reply; 65+ messages in thread
From: Thomas Jost @ 2011-10-03 12:03 UTC (permalink / raw)
To: notmuch
---
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
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator
2011-10-03 12:03 [PATCH 0/4] Several minor Emacs enhancements Thomas Jost
2011-10-03 12:03 ` [PATCH 1/4] emacs: Add a face for crypto parts headers Thomas Jost
2011-10-03 12:03 ` [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua Thomas Jost
@ 2011-10-03 12:03 ` Thomas Jost
2011-10-03 12:03 ` [PATCH 4/4] emacs: add notmuch-hello-hook Thomas Jost
2011-11-12 16:39 ` [PATCH 0/4] Several minor Emacs enhancements David Bremner
4 siblings, 0 replies; 65+ messages in thread
From: Thomas Jost @ 2011-10-03 12:03 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 65fde75..1cf95d7 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -111,10 +111,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)
@@ -139,7 +139,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.6.4
^ permalink raw reply related [flat|nested] 65+ messages in thread
* [PATCH 4/4] emacs: add notmuch-hello-hook
2011-10-03 12:03 [PATCH 0/4] Several minor Emacs enhancements Thomas Jost
` (2 preceding siblings ...)
2011-10-03 12:03 ` [PATCH 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator Thomas Jost
@ 2011-10-03 12:03 ` Thomas Jost
2011-11-12 16:39 ` [PATCH 0/4] Several minor Emacs enhancements David Bremner
4 siblings, 0 replies; 65+ messages in thread
From: Thomas Jost @ 2011-10-03 12:03 UTC (permalink / raw)
To: notmuch
---
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 1cf95d7..00bb5ce 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -111,6 +111,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.
@@ -551,7 +556,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.6.4
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua
2011-10-03 12:03 ` [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua Thomas Jost
@ 2011-10-10 15:50 ` Jameson Graef Rollins
2011-10-10 18:25 ` Jameson Graef Rollins
2011-10-11 19:49 ` Thomas Jost
0 siblings, 2 replies; 65+ messages in thread
From: Jameson Graef Rollins @ 2011-10-10 15:50 UTC (permalink / raw)
To: Thomas Jost, notmuch
[-- Attachment #1: Type: text/plain, Size: 871 bytes --]
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.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua
2011-10-10 15:50 ` Jameson Graef Rollins
@ 2011-10-10 18:25 ` Jameson Graef Rollins
2011-10-11 19:49 ` Thomas Jost
1 sibling, 0 replies; 65+ messages in thread
From: Jameson Graef Rollins @ 2011-10-10 18:25 UTC (permalink / raw)
To: Thomas Jost, notmuch
[-- Attachment #1: Type: text/plain, Size: 113 bytes --]
Another question about this feature: how do you make the window (frame)
go away after the email is sent?
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua
2011-10-10 15:50 ` Jameson Graef Rollins
2011-10-10 18:25 ` Jameson Graef Rollins
@ 2011-10-11 19:49 ` Thomas Jost
2011-10-11 19:51 ` [PATCH v2] " Thomas Jost
2011-10-18 14:46 ` [PATCH 2/4] " Jameson Graef Rollins
1 sibling, 2 replies; 65+ messages in thread
From: Thomas Jost @ 2011-10-11 19:49 UTC (permalink / raw)
To: Jameson Graef Rollins, notmuch
[-- Attachment #1: Type: text/plain, Size: 1433 bytes --]
On Mon, 10 Oct 2011 08:50:52 -0700, Jameson Graef Rollins <jrollins@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
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2] emacs: Support a message-mode switch function in notmuch-mua
2011-10-11 19:49 ` Thomas Jost
@ 2011-10-11 19:51 ` Thomas Jost
2011-10-18 18:58 ` Jani Nikula
2011-10-18 14:46 ` [PATCH 2/4] " Jameson Graef Rollins
1 sibling, 1 reply; 65+ messages in thread
From: Thomas Jost @ 2011-10-11 19:51 UTC (permalink / raw)
To: notmuch
---
emacs/notmuch-mua.el | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 8824b08..639407f 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -31,6 +31,20 @@
:group 'notmuch
:type 'hook)
+(defcustom notmuch-mua-switch-function nil
+ "Function used to switch to and display a new mail buffer. If
+this is `nil' then the buffer will be displayed in the current
+window. Other common values are `switch-to-buffer-other-frame'
+and `switch-to-buffer-other-window'. If you change this, you may
+also want to change `message-sent-hook' accordingly:
+ (setq notmuch-muas-witch-function 'switch-to-buffer-other-frame)
+ (add-hook 'message-sent-hook '(delete-frame))"
+ :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 +113,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 +127,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 +216,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.7
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua
2011-10-11 19:49 ` Thomas Jost
2011-10-11 19:51 ` [PATCH v2] " Thomas Jost
@ 2011-10-18 14:46 ` Jameson Graef Rollins
2011-10-25 7:39 ` Thomas Jost
1 sibling, 1 reply; 65+ messages in thread
From: Jameson Graef Rollins @ 2011-10-18 14:46 UTC (permalink / raw)
To: Thomas Jost, notmuch
[-- Attachment #1: Type: text/plain, Size: 586 bytes --]
On Tue, 11 Oct 2011 21:49:48 +0200, Thomas Jost <schnouki@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.
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2] emacs: Support a message-mode switch function in notmuch-mua
2011-10-11 19:51 ` [PATCH v2] " Thomas Jost
@ 2011-10-18 18:58 ` Jani Nikula
0 siblings, 0 replies; 65+ messages in thread
From: Jani Nikula @ 2011-10-18 18:58 UTC (permalink / raw)
To: Thomas Jost; +Cc: notmuch
Hi Thomas -
AFAICT :options is not meaningful for a function type. I think you should
use choice type for this instead. This allows sensible documentation for
the choices in the customization interface too.
I sent a patch earlier to fix a similar issue [1], please have a look at
that for an example. (Unfortunately, it hasn't been applied, like many
other emacs patches by me and others. I hope yours will make it. I've
given up trying until I see some progress in that front.)
[1] http://permalink.gmane.org/gmane.mail.notmuch.general/5602
BR,
Jani.
On Tue, 11 Oct 2011, Thomas Jost wrote:
> ---
> emacs/notmuch-mua.el | 21 +++++++++++++++++++--
> 1 files changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 8824b08..639407f 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -31,6 +31,20 @@
> :group 'notmuch
> :type 'hook)
>
> +(defcustom notmuch-mua-switch-function nil
> + "Function used to switch to and display a new mail buffer. If
> +this is `nil' then the buffer will be displayed in the current
> +window. Other common values are `switch-to-buffer-other-frame'
> +and `switch-to-buffer-other-window'. If you change this, you may
> +also want to change `message-sent-hook' accordingly:
> + (setq notmuch-muas-witch-function 'switch-to-buffer-other-frame)
> + (add-hook 'message-sent-hook '(delete-frame))"
> + :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 +113,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 +127,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 +216,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.
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua
2011-10-18 14:46 ` [PATCH 2/4] " Jameson Graef Rollins
@ 2011-10-25 7:39 ` Thomas Jost
2011-10-25 7:41 ` [PATCH] emacs: Let the user choose where to compose new mails Thomas Jost
0 siblings, 1 reply; 65+ messages in thread
From: Thomas Jost @ 2011-10-25 7:39 UTC (permalink / raw)
To: Jameson Graef Rollins, notmuch
[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]
On Tue, 18 Oct 2011 07:46:48 -0700, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> On Tue, 11 Oct 2011 21:49:48 +0200, Thomas Jost <schnouki@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
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH] emacs: Let the user choose where to compose new mails
2011-10-25 7:39 ` Thomas Jost
@ 2011-10-25 7:41 ` Thomas Jost
2011-11-05 3:51 ` Austin Clements
0 siblings, 1 reply; 65+ messages in thread
From: Thomas Jost @ 2011-10-25 7:41 UTC (permalink / raw)
To: notmuch
---
emacs/notmuch-mua.el | 37 +++++++++++++++++++++++++++++++++++--
1 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 8824b08..ebc922f 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -31,6 +31,34 @@
:group 'notmuch
:type 'hook)
+(defvar notmuch-mua-switch-function nil
+ "Function used to switch and display the mail buffer. This is
+ normally set by `notmuch-mua-compose-in'.")
+(defvar notmuch-mua-dedicated-flag nil
+ "Flag to pass to `set-window-dedicated-p' in the mail buffer.
+ This is normally set by `notmuch-mua-compose-in'.")
+(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 `new-window' or `new-frame', the
+ mail buffer will be displayer 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 'symbol
+ :set (lambda (sym val)
+ (cond ((eq val 'current-window)
+ (setq notmuch-mua-switch-function nil
+ notmuch-mua-dedicated-flag nil))
+ ((eq val 'new-window)
+ (setq notmuch-mua-switch-function 'switch-to-buffer-other-window
+ notmuch-mua-dedicated-flag 1))
+ ((eq val 'new-frame)
+ (setq notmuch-mua-switch-function 'switch-to-buffer-other-frame
+ notmuch-mua-dedicated-flag 1))
+ (t (error (concat "Bad value for notmuch-mua-compose-in: "
+ (symbol-value val)))))))
+
(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 +127,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 +141,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
@@ -121,6 +152,7 @@ list."
(message-sort-headers)
(message-hide-headers)
(set-buffer-modified-p nil)
+ (set-window-dedicated-p (selected-window) notmuch-mua-dedicated-flag)
(message-goto-to))
@@ -143,6 +175,7 @@ list."
(message-sort-headers)
(message-hide-headers)
(set-buffer-modified-p nil)
+ (set-window-dedicated-p (selected-window) notmuch-mua-dedicated-flag)
(message-goto-to))
@@ -199,7 +232,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.7
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH] emacs: Let the user choose where to compose new mails
2011-10-25 7:41 ` [PATCH] emacs: Let the user choose where to compose new mails Thomas Jost
@ 2011-11-05 3:51 ` Austin Clements
2011-11-09 18:50 ` Thomas Jost
0 siblings, 1 reply; 65+ messages in thread
From: Austin Clements @ 2011-11-05 3:51 UTC (permalink / raw)
To: Thomas Jost; +Cc: notmuch
This seems like a good option to have, but your approach seems
unnecessarily complicated. I'm always wary of defcustom's :set because
it means you can't just setq the variable, which defeats the
underlying beauty of the customize system. You could eliminate the
other two variables and compute them on the fly, or, if you really
feel they may need to be controlled independently, make the custom
variable a pair or alist (which you can hide behind a few const
choices). Alternatively, it seems like the variable could instead
take a single function (basically what notmuch-mua-switch-function is
now) and you could provide two new functions that simply combine
switch-to-buffer-other-x and set-window-dedicated-p.
On Oct 25, 2011 3:41 AM, "Thomas Jost" <schnouki@schnouki.net> wrote:
>
> ---
> emacs/notmuch-mua.el | 37 +++++++++++++++++++++++++++++++++++--
> 1 files changed, 35 insertions(+), 2 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 8824b08..ebc922f 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -31,6 +31,34 @@
> :group 'notmuch
> :type 'hook)
>
> +(defvar notmuch-mua-switch-function nil
> + "Function used to switch and display the mail buffer. This is
> + normally set by `notmuch-mua-compose-in'.")
> +(defvar notmuch-mua-dedicated-flag nil
> + "Flag to pass to `set-window-dedicated-p' in the mail buffer.
> + This is normally set by `notmuch-mua-compose-in'.")
> +(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 `new-window' or `new-frame', the
> + mail buffer will be displayer in a new window/frame that will
s/displayer/displayed/
> + be destroyed when the buffer is killed. You may want to
> + customize `message-kill-buffer-on-exit' accordingly."
You should also describe 'current-window' in the defcustom docstring.
(Currently you describe the effect of the other two, but not
current-window.)
> + :group 'notmuch
> + :type 'symbol
> + :set (lambda (sym val)
> + (cond ((eq val 'current-window)
> + (setq notmuch-mua-switch-function nil
> + notmuch-mua-dedicated-flag nil))
> + ((eq val 'new-window)
> + (setq notmuch-mua-switch-function 'switch-to-buffer-other-window
> + notmuch-mua-dedicated-flag 1))
> + ((eq val 'new-frame)
> + (setq notmuch-mua-switch-function 'switch-to-buffer-other-frame
> + notmuch-mua-dedicated-flag 1))
> + (t (error (concat "Bad value for notmuch-mua-compose-in: "
> + (symbol-value val)))))))
> +
The defcustom would be more user-friendly if it gave a choice between
const values, rather than requiring the user to enter a symbol value
(and then possibly rejecting it on validation). Something like
: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."
> @@ -99,7 +127,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 +141,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
> @@ -121,6 +152,7 @@ list."
> (message-sort-headers)
> (message-hide-headers)
> (set-buffer-modified-p nil)
> + (set-window-dedicated-p (selected-window) notmuch-mua-dedicated-flag)
>
> (message-goto-to))
>
> @@ -143,6 +175,7 @@ list."
> (message-sort-headers)
> (message-hide-headers)
> (set-buffer-modified-p nil)
> + (set-window-dedicated-p (selected-window) notmuch-mua-dedicated-flag)
>
> (message-goto-to))
>
> @@ -199,7 +232,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.7
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH] emacs: Let the user choose where to compose new mails
2011-11-05 3:51 ` Austin Clements
@ 2011-11-09 18:50 ` Thomas Jost
2011-11-09 20:06 ` [PATCH v2] " Thomas Jost
0 siblings, 1 reply; 65+ messages in thread
From: Thomas Jost @ 2011-11-09 18:50 UTC (permalink / raw)
To: Austin Clements; +Cc: notmuch
[-- Attachment #1: Type: text/plain, Size: 2061 bytes --]
On Fri, 4 Nov 2011 23:51:55 -0400, Austin Clements <amdragon@mit.edu> wrote:
> This seems like a good option to have, but your approach seems
> unnecessarily complicated. I'm always wary of defcustom's :set because
> it means you can't just setq the variable, which defeats the
> underlying beauty of the customize system.
Actually I use it with setq without any problem. But yes, it's too
complicated...
> You could eliminate the other two variables and compute them on the
> fly, or, if you really feel they may need to be controlled
> independently, make the custom variable a pair or alist (which you can
> hide behind a few const choices).
Computing them on the fly is probably cleaner. But I'm not sure if the
switch-function and dedicated flag must be independent or not. From what
I've tested it's *much* more pleasant to use with the dedicated flag,
but I don't know how other people feel about this...
> Alternatively, it seems like the variable could instead
> take a single function (basically what notmuch-mua-switch-function is
> now) and you could provide two new functions that simply combine
> switch-to-buffer-other-x and set-window-dedicated-p.
I've tried that, but for some reason it doesn't work when forwarding a
message: the dedicated flag is reset somewhere inside message-forward,
but I don't know where nor why. (I haven't investigated much though.)
> The defcustom would be more user-friendly if it gave a choice between
> const values, rather than requiring the user to enter a symbol value
> (and then possibly rejecting it on validation). Something like
> :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))
Yep, that's much better. I'll try to rewrite this patch using this and
on-the-fly computations of the switch-function and dedicated flag.
Thank you for the review!
Regards,
--
Thomas/Schnouki
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2] emacs: Let the user choose where to compose new mails
2011-11-09 18:50 ` Thomas Jost
@ 2011-11-09 20:06 ` Thomas Jost
2011-11-13 21:41 ` Jameson Graef Rollins
0 siblings, 1 reply; 65+ messages in thread
From: Thomas Jost @ 2011-11-09 20:06 UTC (permalink / raw)
To: notmuch
---
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.7.3
^ permalink raw reply related [flat|nested] 65+ messages in thread
* Re: [PATCH 0/4] Several minor Emacs enhancements
2011-10-03 12:03 [PATCH 0/4] Several minor Emacs enhancements Thomas Jost
` (3 preceding siblings ...)
2011-10-03 12:03 ` [PATCH 4/4] emacs: add notmuch-hello-hook Thomas Jost
@ 2011-11-12 16:39 ` David Bremner
2011-12-13 17:32 ` [PATCH v3 " Thomas Jost
4 siblings, 1 reply; 65+ messages in thread
From: David Bremner @ 2011-11-12 16:39 UTC (permalink / raw)
To: Thomas Jost, notmuch
On Mon, 3 Oct 2011 14:03:54 +0200, Thomas Jost <schnouki@schnouki.net> wrote:
> - The first one adds a face for crypto parts headers, because a hardcoded blue
> foreground looks quite ugly with my color theme.
> - The second one creates a customizable notmuch-mua-switch-function, which is
> then passed to message-mail as switch-function. Using this, you can choose to
> always compose new mails in new frames or new windows.
> - The third one renames notmuch-decimal-separator to
> notmuch-thousands-separator, because that's what it really is.
> - The last one creates a hook run after notmuch-hello, just like there are hooks
> run after notmuch-search and notmuch-show.
Hi Thomas, Hi All.
I wonder if some of this commentary belongs in commit messages? It seems
the commit messages here are all rather terse.
d
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2] emacs: Let the user choose where to compose new mails
2011-11-09 20:06 ` [PATCH v2] " Thomas Jost
@ 2011-11-13 21:41 ` Jameson Graef Rollins
0 siblings, 0 replies; 65+ messages in thread
From: Jameson Graef Rollins @ 2011-11-13 21:41 UTC (permalink / raw)
To: Thomas Jost, notmuch
[-- Attachment #1: Type: text/plain, Size: 363 bytes --]
Hey, Thomas et. al. I've tested this patch and it works great! The
customization interface is very clean now, and the newly created
windows/frames close automatically when the message is sent. Very
nice.
Thanks so much, Thomas, for this nice ui feature. The commit message is
a little sparse, but other than that I definitely support it's
inclusion.
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v3 0/4] Several minor Emacs enhancements
2011-11-12 16:39 ` [PATCH 0/4] Several minor Emacs enhancements David Bremner
@ 2011-12-13 17:32 ` Thomas Jost
2011-12-13 17:32 ` [PATCH v3 1/4] emacs: Let the user choose where to compose new mails Thomas Jost
` (4 more replies)
0 siblings, 5 replies; 65+ messages in thread
From: Thomas Jost @ 2011-12-13 17:32 UTC (permalink / raw)
To: notmuch
Hi David et al.,
Here is a rebased version of this patch series, with more descriptive
commit messages.
Please tell me if there are still ways to enhance them. English is not
my native language and it's sometimes hard to figure out what's relevant
and how to word it :)
Best regards,
Thomas
Thomas Jost (4):
emacs: Let the user choose where to compose new mails
emacs: Add a face for crypto parts headers
emacs: rename notmuch-decimal-separator to
notmuch-thousands-separator
emacs: add notmuch-hello-hook
emacs/notmuch-crypto.el | 5 +++++
emacs/notmuch-hello.el | 17 ++++++++++++-----
emacs/notmuch-mua.el | 40 ++++++++++++++++++++++++++++++++++++++--
emacs/notmuch-show.el | 4 ++--
4 files changed, 57 insertions(+), 9 deletions(-)
--
1.7.8
^ permalink raw reply [flat|nested] 65+ messages in thread
* [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
* [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
* [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
* [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 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
* 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 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 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 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
* 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 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
* 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
* [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
* 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
* [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
* 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
* Re: [PATCH] emacs: add notmuch-hello-refresh-hook
2011-12-21 1:28 ` Thomas Jost
@ 2011-12-21 12:03 ` David Bremner
2011-12-21 12:17 ` David Bremner
1 sibling, 0 replies; 65+ messages in thread
From: David Bremner @ 2011-12-21 12:03 UTC (permalink / raw)
To: Thomas Jost, notmuch
On Wed, 21 Dec 2011 02:28:14 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
> This hook is called every time a notmuch-hello buffer is updated.
> ---
pushed
d
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH] emacs: add notmuch-hello-refresh-hook
2011-12-21 1:28 ` Thomas Jost
2011-12-21 12:03 ` David Bremner
@ 2011-12-21 12:17 ` David Bremner
1 sibling, 0 replies; 65+ messages in thread
From: David Bremner @ 2011-12-21 12:17 UTC (permalink / raw)
To: Thomas Jost, notmuch
On Wed, 21 Dec 2011 02:28:14 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
> This hook is called every time a notmuch-hello buffer is updated.
> ---
pushed.
^ 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
* [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 2/2] emacs: Change the default thousands separator to a space
2011-12-21 13:44 ` [PATCH 2/2] emacs: Change the default thousands separator to a space Thomas Jost
@ 2011-12-21 14:12 ` Tomi Ollila
0 siblings, 0 replies; 65+ messages in thread
From: Tomi Ollila @ 2011-12-21 14:12 UTC (permalink / raw)
To: Thomas Jost; +Cc: notmuch
On Wed, 21 Dec 2011 14:44:19 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
Both patches LGTM.
Tomi
^ 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 ` 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] 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 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
* 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 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] 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-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
end of thread, other threads:[~2012-05-06 12:21 UTC | newest]
Thread overview: 65+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-03 12:03 [PATCH 0/4] Several minor Emacs enhancements Thomas Jost
2011-10-03 12:03 ` [PATCH 1/4] emacs: Add a face for crypto parts headers Thomas Jost
2011-10-03 12:03 ` [PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua Thomas Jost
2011-10-10 15:50 ` Jameson Graef Rollins
2011-10-10 18:25 ` Jameson Graef Rollins
2011-10-11 19:49 ` Thomas Jost
2011-10-11 19:51 ` [PATCH v2] " Thomas Jost
2011-10-18 18:58 ` Jani Nikula
2011-10-18 14:46 ` [PATCH 2/4] " Jameson Graef Rollins
2011-10-25 7:39 ` Thomas Jost
2011-10-25 7:41 ` [PATCH] emacs: Let the user choose where to compose new mails Thomas Jost
2011-11-05 3:51 ` Austin Clements
2011-11-09 18:50 ` Thomas Jost
2011-11-09 20:06 ` [PATCH v2] " Thomas Jost
2011-11-13 21:41 ` Jameson Graef Rollins
2011-10-03 12:03 ` [PATCH 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator Thomas Jost
2011-10-03 12:03 ` [PATCH 4/4] emacs: add notmuch-hello-hook Thomas Jost
2011-11-12 16:39 ` [PATCH 0/4] Several minor Emacs enhancements David Bremner
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-15 11:27 ` David Bremner
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-17 1:19 ` David Bremner
2011-12-17 1:35 ` Jameson Graef Rollins
2011-12-18 18:46 ` Tom Prince
2011-12-26 4:54 ` Aaron Ecay
2011-12-26 11:38 ` David Bremner
2012-01-06 16:45 ` Thomas Jost
2012-04-14 19:36 ` Jameson Graef Rollins
2012-04-14 20:20 ` [PATCH] " 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
2012-04-22 22:25 ` Thomas Jost
2012-04-29 19:12 ` David Bremner
2012-05-04 10:37 ` [PATCH v6] " Thomas Jost
2012-05-05 23:20 ` Jameson Graef Rollins
2012-05-06 12:21 ` David Bremner
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
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
2011-12-16 12:34 ` Dmitry Kurochkin
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
2011-12-21 13:44 ` [PATCH 2/2] emacs: Change the default thousands separator to a space 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
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
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
2011-12-21 13:13 ` [PATCH] test: add tests for `notmuch-hello-refresh-hook' Thomas Jost
2011-12-21 18:26 ` Dmitry Kurochkin
2011-12-13 18:16 ` [PATCH v3 0/4] Several minor Emacs enhancements Jameson Graef Rollins
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).