* [PATCH] Change From and Bcc when creating reply draft buffer @ 2010-03-09 19:40 James Vasile 2010-03-11 13:00 ` Michal Sojka 0 siblings, 1 reply; 9+ messages in thread From: James Vasile @ 2010-03-09 19:40 UTC (permalink / raw) To: notmuch When notmuch creates a reply buffer, it guesses the From and Bcc addresses. The client is in a better position to guess these, and this patch adjusts notmuch-reply accordingly. diff --git a/notmuch.el b/notmuch.el index ab56f48..07f957e 100644 --- a/notmuch.el +++ b/notmuch.el @@ -436,10 +436,20 @@ buffer." (message "Done")) (defun notmuch-reply (query-string) + "Prepare a reply draft buffer. + +Have notmuch create a reply buffer, then adjust the from and bcc +headers to match our current user-full-name and +user-mail-address." (switch-to-buffer (generate-new-buffer "notmuch-draft")) (call-process notmuch-command nil t nil "reply" query-string) (message-insert-signature) (goto-char (point-min)) + (kill-line) + (insert (format "From: %s <%s>" user-full-name user-mail-address)) + (re-search-forward "^Bcc: " nil t) + (kill-line) + (insert (format "%s <%s>" user-full-name user-mail-address)) (if (re-search-forward "^$" nil t) (progn (insert "--text follows this line--") ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] Change From and Bcc when creating reply draft buffer 2010-03-09 19:40 [PATCH] Change From and Bcc when creating reply draft buffer James Vasile @ 2010-03-11 13:00 ` Michal Sojka 2010-03-11 14:45 ` James Vasile 0 siblings, 1 reply; 9+ messages in thread From: Michal Sojka @ 2010-03-11 13:00 UTC (permalink / raw) To: James Vasile, notmuch Hi James, On Tue, 09 Mar 2010, James Vasile wrote: > When notmuch creates a reply buffer, it guesses the From and Bcc > addresses. The client is in a better position to guess these, and this > patch adjusts notmuch-reply accordingly. > > diff --git a/notmuch.el b/notmuch.el > index ab56f48..07f957e 100644 > --- a/notmuch.el > +++ b/notmuch.el > @@ -436,10 +436,20 @@ buffer." > (message "Done")) > > (defun notmuch-reply (query-string) > + "Prepare a reply draft buffer. > + > +Have notmuch create a reply buffer, then adjust the from and bcc > +headers to match our current user-full-name and > +user-mail-address." > (switch-to-buffer (generate-new-buffer "notmuch-draft")) > (call-process notmuch-command nil t nil "reply" query-string) > (message-insert-signature) > (goto-char (point-min)) > + (kill-line) > + (insert (format "From: %s <%s>" user-full-name user-mail-address)) Notmuch reply contains From: address which is based on the addresses in .notmuch-config and the replied message. When you use multiple addresses (e.g. home and work address), notmuch puts there the one used in the replied message. It seems that your patch would break this feature. -Michal ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Change From and Bcc when creating reply draft buffer 2010-03-11 13:00 ` Michal Sojka @ 2010-03-11 14:45 ` James Vasile 2010-03-11 16:22 ` Michal Sojka 0 siblings, 1 reply; 9+ messages in thread From: James Vasile @ 2010-03-11 14:45 UTC (permalink / raw) To: Michal Sojka, notmuch On Thu, 11 Mar 2010 14:00:08 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote: > Hi James, > > On Tue, 09 Mar 2010, James Vasile wrote: > > When notmuch creates a reply buffer, it guesses the From and Bcc > > addresses. The client is in a better position to guess these, and this > > patch adjusts notmuch-reply accordingly. > > > > diff --git a/notmuch.el b/notmuch.el > > index ab56f48..07f957e 100644 > > --- a/notmuch.el > > +++ b/notmuch.el > > @@ -436,10 +436,20 @@ buffer." > > (message "Done")) > > > > (defun notmuch-reply (query-string) > > + "Prepare a reply draft buffer. > > + > > +Have notmuch create a reply buffer, then adjust the from and bcc > > +headers to match our current user-full-name and > > +user-mail-address." > > (switch-to-buffer (generate-new-buffer "notmuch-draft")) > > (call-process notmuch-command nil t nil "reply" query-string) > > (message-insert-signature) > > (goto-char (point-min)) > > + (kill-line) > > + (insert (format "From: %s <%s>" user-full-name user-mail-address)) > > Notmuch reply contains From: address which is based on the addresses in > .notmuch-config and the replied message. When you use multiple addresses > (e.g. home and work address), notmuch puts there the one used in the > replied message. It seems that your patch would break this feature. > > -Michal Yes, it does break that feature, and intentionally so. The MUA should select the From: address. I have profile selection code that sets my user-full-name and user-mail-address based on some context. When I reply to somebody, the correct From: address is not who they think I am but rather who *I* think I am. Here's my use case: I have a job in the free software world. There's an email address attached to that. I also serve on the board of a free software project. There's another email for that. People email me about the project using my work email, but I always reply using the project email, and my MUA knows that. Notmuch doesn't. Also: my girlfriend's family sometimes emails me at work. I don't want personal email at my work address, so I always reply using a personal address. Also: I have an old email address that I've deprecated, but old friends still use it. I always reply with my newer address and they eventually start using the new one. My profile code is usable but not complete. It looks at folder contents to pick the correct From: address automatically (you can override the choice, of course), which is good when you have 400+ folders. If anybody wants it before it's done, I can put it in a public branch. -J ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Change From and Bcc when creating reply draft buffer 2010-03-11 14:45 ` James Vasile @ 2010-03-11 16:22 ` Michal Sojka 2010-03-11 19:45 ` James Vasile 0 siblings, 1 reply; 9+ messages in thread From: Michal Sojka @ 2010-03-11 16:22 UTC (permalink / raw) To: James Vasile, notmuch On Thu, 11 Mar 2010, James Vasile wrote: > On Thu, 11 Mar 2010 14:00:08 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote: > > Hi James, > > > > On Tue, 09 Mar 2010, James Vasile wrote: > > > When notmuch creates a reply buffer, it guesses the From and Bcc > > > addresses. The client is in a better position to guess these, and this > > > patch adjusts notmuch-reply accordingly. > > > > > > diff --git a/notmuch.el b/notmuch.el > > > index ab56f48..07f957e 100644 > > > --- a/notmuch.el > > > +++ b/notmuch.el > > > @@ -436,10 +436,20 @@ buffer." > > > (message "Done")) > > > > > > (defun notmuch-reply (query-string) > > > + "Prepare a reply draft buffer. > > > + > > > +Have notmuch create a reply buffer, then adjust the from and bcc > > > +headers to match our current user-full-name and > > > +user-mail-address." > > > (switch-to-buffer (generate-new-buffer "notmuch-draft")) > > > (call-process notmuch-command nil t nil "reply" query-string) > > > (message-insert-signature) > > > (goto-char (point-min)) > > > + (kill-line) > > > + (insert (format "From: %s <%s>" user-full-name user-mail-address)) > > > > Notmuch reply contains From: address which is based on the addresses in > > .notmuch-config and the replied message. When you use multiple addresses > > (e.g. home and work address), notmuch puts there the one used in the > > replied message. It seems that your patch would break this feature. > > > > -Michal > > Yes, it does break that feature, and intentionally so. The MUA should > select the From: address. I have profile selection code that sets my > user-full-name and user-mail-address based on some context. When I > reply to somebody, the correct From: address is not who they think I am > but rather who *I* think I am. > > Here's my use case: I have a job in the free software world. There's an > email address attached to that. I also serve on the board of a free > software project. There's another email for that. People email me > about the project using my work email, but I always reply using the > project email, and my MUA knows that. Notmuch doesn't. > > Also: my girlfriend's family sometimes emails me at work. I don't want > personal email at my work address, so I always reply using a personal > address. > > Also: I have an old email address that I've deprecated, but old friends > still use it. I always reply with my newer address and they eventually > start using the new one. > > My profile code is usable but not complete. It looks at folder contents > to pick the correct From: address automatically (you can override the > choice, of course), which is good when you have 400+ folders. If > anybody wants it before it's done, I can put it in a public branch. Hi, thanks for clarification. It all sounds reasonable. The only problem I can see now is that if I create a new account on my machine and run emacs there, then the value of user-mail-address is <login>@<hostname> which doesn't refer to existing mailbox. I think that the header should only be rewritten if these variables are known to have valid values. Do you know how to do this? -Michal ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Change From and Bcc when creating reply draft buffer 2010-03-11 16:22 ` Michal Sojka @ 2010-03-11 19:45 ` James Vasile 2010-03-12 7:49 ` Michal Sojka 0 siblings, 1 reply; 9+ messages in thread From: James Vasile @ 2010-03-11 19:45 UTC (permalink / raw) To: Michal Sojka, notmuch On Thu, 11 Mar 2010 17:22:41 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote: > thanks for clarification. It all sounds reasonable. The only problem I > can see now is that if I create a new account on my machine and run > emacs there, then the value of user-mail-address is <login>@<hostname> > which doesn't refer to existing mailbox. I think that the header should > only be rewritten if these variables are known to have valid values. Do > you know how to do this? > I explicitly set these in my .emacs file, so I don't do any detection. If you could define "valid" I suppose you could test for such things. Something like the following works for me. I run mail-profile-foo with M-x or run it automatically with profile-guessing/setting routines. When I get the system ironed out, I'll emit patches and a wiki entry. (defun message-mode-set-profile () (save-excursion (when (string= "message-mode" major-mode) (goto-char (point-min)) (when (re-search-forward "^From: " nil t) (kill-line) (insert (format "%s <%s>" user-full-name user-mail-address))) (goto-char (point-min)) (when (re-search-forward "^Bcc: " nil t) (kill-line) (insert (format "%s <%s>" user-full-name user-mail-address)))))) (defun mail-profile-hv () (interactive) (setq mail-host-address "hackervisions.org" user-full-name "James Vasile" message-sendmail-extra-arguments '("-a" "hv") user-mail-address "james@hackervisions.org") (message-mode-set-profile) user-mail-address) (mail-profile-hv) <other mail-profile-foo functions> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Change From and Bcc when creating reply draft buffer 2010-03-11 19:45 ` James Vasile @ 2010-03-12 7:49 ` Michal Sojka 2010-03-12 15:01 ` James Vasile 2010-03-12 15:22 ` Jameson Rollins 0 siblings, 2 replies; 9+ messages in thread From: Michal Sojka @ 2010-03-12 7:49 UTC (permalink / raw) To: James Vasile, notmuch On Thu, 11 Mar 2010, James Vasile wrote: > On Thu, 11 Mar 2010 17:22:41 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote: > > thanks for clarification. It all sounds reasonable. The only problem I > > can see now is that if I create a new account on my machine and run > > emacs there, then the value of user-mail-address is <login>@<hostname> > > which doesn't refer to existing mailbox. I think that the header should > > only be rewritten if these variables are known to have valid values. Do > > you know how to do this? > > > > I explicitly set these in my .emacs file, so I don't do any detection. > If you could define "valid" I suppose you could test for such things. > > Something like the following works for me. I run mail-profile-foo with > M-x or run it automatically with profile-guessing/setting routines. > When I get the system ironed out, I'll emit patches and a wiki entry. > > (defun message-mode-set-profile () > (save-excursion > (when (string= "message-mode" major-mode) > (goto-char (point-min)) > (when (re-search-forward "^From: " nil t) > (kill-line) > (insert (format "%s <%s>" user-full-name user-mail-address))) > > (goto-char (point-min)) > (when (re-search-forward "^Bcc: " nil t) > (kill-line) > (insert (format "%s <%s>" user-full-name user-mail-address)))))) > > (defun mail-profile-hv () > (interactive) > (setq mail-host-address "hackervisions.org" > user-full-name "James Vasile" > message-sendmail-extra-arguments '("-a" "hv") > user-mail-address "james@hackervisions.org") > (message-mode-set-profile) > user-mail-address) > (mail-profile-hv) > > <other mail-profile-foo functions> Hmm, I understand. My worry about this approach is the following: Now it is very straightforward to start using notmuch. You only answer a few questions when you run notmuch for the first time and then it works. If we apply your patch, some additional configuration is needed and a novice might not know how to do it. So at least notmuch should tell the user what and where needs to be configured. Or better, provide some sane default which can be overridden in a way you want it. That's only my opinion. I personally would have no problem with additional configuration, but on the other side I like programs which do not steel my time if it is not necessary. Bye -Michal ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Change From and Bcc when creating reply draft buffer 2010-03-12 7:49 ` Michal Sojka @ 2010-03-12 15:01 ` James Vasile 2010-03-12 15:22 ` Jameson Rollins 1 sibling, 0 replies; 9+ messages in thread From: James Vasile @ 2010-03-12 15:01 UTC (permalink / raw) To: Michal Sojka, notmuch On Fri, 12 Mar 2010 08:49:35 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote: > On Thu, 11 Mar 2010, James Vasile wrote: > > On Thu, 11 Mar 2010 17:22:41 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote: > > > thanks for clarification. It all sounds reasonable. The only problem I > > > can see now is that if I create a new account on my machine and run > > > emacs there, then the value of user-mail-address is <login>@<hostname> > > > which doesn't refer to existing mailbox. I think that the header should > > > only be rewritten if these variables are known to have valid values. Do > > > you know how to do this? > > > > > > > I explicitly set these in my .emacs file, so I don't do any detection. > > If you could define "valid" I suppose you could test for such things. > > > > Something like the following works for me. I run mail-profile-foo with > > M-x or run it automatically with profile-guessing/setting routines. > > When I get the system ironed out, I'll emit patches and a wiki entry. > > > > (defun message-mode-set-profile () > > (save-excursion > > (when (string= "message-mode" major-mode) > > (goto-char (point-min)) > > (when (re-search-forward "^From: " nil t) > > (kill-line) > > (insert (format "%s <%s>" user-full-name user-mail-address))) > > > > (goto-char (point-min)) > > (when (re-search-forward "^Bcc: " nil t) > > (kill-line) > > (insert (format "%s <%s>" user-full-name user-mail-address)))))) > > > > (defun mail-profile-hv () > > (interactive) > > (setq mail-host-address "hackervisions.org" > > user-full-name "James Vasile" > > message-sendmail-extra-arguments '("-a" "hv") > > user-mail-address "james@hackervisions.org") > > (message-mode-set-profile) > > user-mail-address) > > (mail-profile-hv) > > > > <other mail-profile-foo functions> > > Hmm, I understand. My worry about this approach is the following: Now it > is very straightforward to start using notmuch. You only answer a few > questions when you run notmuch for the first time and then it works. If > we apply your patch, some additional configuration is needed and a > novice might not know how to do it. I disagree as to how much time notmuch currently takes. To get a workable setup, you need to answer a few questions, setup offlineimap, write a tagging script, setup up folders, apply a bunch of patches, etc. I've been telling people to wait 6 months instead of trying notmuch. That's based on how much work it is to setup, incomplete MUA, bugs, etc. > So at least notmuch should tell the user what and where needs to be > configured. Or better, provide some sane default which can be overridden > in a way you want it. > > That's only my opinion. I personally would have no problem with > additional configuration, but on the other side I like programs which do > not steel my time if it is not necessary. That's a fair point. I hope notmuch gets easier over time, and one of the things I'd like to implement is sane defaults. As notmuch gets more user friendly, I'd like to make the pieces I write less onerous to configure. For example, I have some stub code for a default profile that pulls values from ~/.notmuch. Then if the user doesn't do the setup, things should be not much different than they are now. -J ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Change From and Bcc when creating reply draft buffer 2010-03-12 7:49 ` Michal Sojka 2010-03-12 15:01 ` James Vasile @ 2010-03-12 15:22 ` Jameson Rollins 2010-03-12 16:00 ` Sebastian Spaeth 1 sibling, 1 reply; 9+ messages in thread From: Jameson Rollins @ 2010-03-12 15:22 UTC (permalink / raw) To: Michal Sojka, James Vasile, notmuch [-- Attachment #1: Type: text/plain, Size: 1147 bytes --] On Fri, 12 Mar 2010 08:49:35 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote: > Hmm, I understand. My worry about this approach is the following: Now it > is very straightforward to start using notmuch. You only answer a few > questions when you run notmuch for the first time and then it works. If > we apply your patch, some additional configuration is needed and a > novice might not know how to do it. To me it seems the issue here is the distinction between the notmuch CLI, and any other reader UI that uses it. AFAICT, the CLI actually has no need to know what "your" email address is, so I don't see why it should be configured in the notmuch config. Your reader on the other hand does need to know, so it should be set there. This is related to another current pet peeve of mine which is that notmuch puts my email address in the Bcc: field in my response template. I do not want to bcc myself on my responses. Generally, I don't think it should be the business of the CLI to set any of the header fields in mail that I send out. In short, the CLI should deal with indexing my mail. It really has no need to know who I am. jamie. [-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Change From and Bcc when creating reply draft buffer 2010-03-12 15:22 ` Jameson Rollins @ 2010-03-12 16:00 ` Sebastian Spaeth 0 siblings, 0 replies; 9+ messages in thread From: Sebastian Spaeth @ 2010-03-12 16:00 UTC (permalink / raw) To: Jameson Rollins, Michal Sojka, James Vasile, notmuch On Fri, 12 Mar 2010 10:22:09 -0500, Jameson Rollins <jrollins@finestructure.net> wrote: > To me it seems the issue here is the distinction between the notmuch > CLI, and any other reader UI that uses it. AFAICT, the CLI actually has > no need to know what "your" email address is, so I don't see why it > should be configured in the notmuch config. Your reader on the other > hand does need to know, so it should be set there. +1. Except for making the "from:~me" synonym available for searches :) > This is related to another current pet peeve of mine which is that > notmuch puts my email address in the Bcc: field in my response template. > I do not want to bcc myself on my responses. Generally, I don't think > it should be the business of the CLI to set any of the header fields in > mail that I send out. +1 I agree. The mailer should be putting a BCC in, if that is what the user wants, not notmuch Sebastian ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-03-12 16:00 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-03-09 19:40 [PATCH] Change From and Bcc when creating reply draft buffer James Vasile 2010-03-11 13:00 ` Michal Sojka 2010-03-11 14:45 ` James Vasile 2010-03-11 16:22 ` Michal Sojka 2010-03-11 19:45 ` James Vasile 2010-03-12 7:49 ` Michal Sojka 2010-03-12 15:01 ` James Vasile 2010-03-12 15:22 ` Jameson Rollins 2010-03-12 16:00 ` Sebastian Spaeth
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).