Re: Multiple sender identities (composing)
On 1 June 2011 16:42, Thomas Jost wrote: > There's a function that changes the signature according to the From > header in the message I sent on this list yesterday > (id:"87pqmznczk@thor.loria.fr", near the end of the message). > > Thanks for the pointer, it seems to work fine. -- Brian May ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Multiple sender identities (composing)
On Wed, 1 Jun 2011 15:53:18 +1000, Brian May wrote: > On 16 May 2011 19:29, Stewart Smith wrote: > > > Thought I'd share this bit of my .emacs snippet that may be useful to go > > on the emacs tips page. > > > > This does the following: > > - sets up a list of possible identities to have mail From > > - on composing mail, it prompts you for who you want to send mail from > > - pressing enter will give you the default (first in the list) > > - otherwise you have tab completion > > > > Is it possible to have it change the signature per identity also? There's a function that changes the signature according to the From header in the message I sent on this list yesterday (id:"87pqmznczk@thor.loria.fr", near the end of the message). Regards, -- Thomas/Schnouki pgpkXiMXyteq3.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Multiple sender identities (composing)
On 16 May 2011 19:29, Stewart Smith wrote: > Thought I'd share this bit of my .emacs snippet that may be useful to go > on the emacs tips page. > > This does the following: > - sets up a list of possible identities to have mail From > - on composing mail, it prompts you for who you want to send mail from > - pressing enter will give you the default (first in the list) > - otherwise you have tab completion > Is it possible to have it change the signature per identity also? -- Brian May ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Multiple sender identities (composing)
On Tue, 24 May 2011 14:54:37 -0700, Carl Worth wrote: > I've wanted something like this, but I'm extremely reluctant to put > fancy things like this in my .emacs file. The problem I have is that I > don't want to restrict nice features to the people who manage to > configure their emacs "just so". I completely agree - and am rather glad that there's a proper solution now. > I'll reply with a patch I just wrote attempting to implement that. By > default, it generates the list of addresses by looking in your notmuch > configuration file. It also provides a customizable list of addresses > that the user can provide (notmuch-identities). I'll try trunk with the patches as soon as I get home from travel and am somewhat remotely close to not being a zombie. > I don't know what trouble you had with ido on Ubuntu, but hopefully you > can work that out. I hope so too... it could just be how I was trying to use it or user ignorance or something like that. -- Stewart Smith ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Multiple sender identities (composing)
On Mon, 16 May 2011 19:29:07 +1000, Stewart Smith wrote: > Thought I'd share this bit of my .emacs snippet that may be useful to go > on the emacs tips page. Hi Stewart, Thanks for sharing this functionality. I've wanted something like this, but I'm extremely reluctant to put fancy things like this in my .emacs file. The problem I have is that I don't want to restrict nice features to the people who manage to configure their emacs "just so". I'd much rather have this functionality inside notmuch itself, and without requiring any configuration (by default). I'll reply with a patch I just wrote attempting to implement that. By default, it generates the list of addresses by looking in your notmuch configuration file. It also provides a customizable list of addresses that the user can provide (notmuch-identities). The patch doesn't make all new composition buffers prompt for the address. Instead, the original 'm' key does no prompting as its always done. And a new 'M' key prompts. I did use ido-completing-read rather than completing-read. I did that because otherwise it's a pain to complete addresses. For example, imagine I have the following: Carl Worth Carl Worth Carl Worth To select my intel address hit "C [TAB]", "a [TAB]", "i [TAB]" which is random enough that I can't memorize it but have to instead slowly watch. With ido I can just type "intel [ENTER]" which is nice and quick (and I can get trained to type less if sufficient. One thing I don't like about ido is that the input area is extremely cluttered from the beginning with all the possible inputs. I wish it instead waiting for some explicit keypress (such as pressing ENTER while the input is still ambiguous) before displaying possible matches. I don't know what trouble you had with ido on Ubuntu, but hopefully you can work that out. I did implement support for completion history. I did not implement support for doing completion when forwarding. A nice addition would be an easy keybinding for doing the same completion to change the From header while composing a message. Anyway, I'm throwing this out for feedback, testing, and suggestions. Please let me know if you try and out and if you think we should push this code. -Carl pgpzPE712iFHg.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Multiple sender identities (composing)
Jameson Graef Rollins writes: > This is great, guys. I've been wanting to get something like this > working for a while now. Agreed. Would be awesome if someone could post it to the Wiki... ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Multiple sender identities (composing)
Jameson Graef Rollins wrote at 2011-05-16 11:52 -0500: > This is great, guys. I've been wanting to get something like this > working for a while now. Yes; thanks Stewart, Thomas. This is one thing that has slowed my transition to notmuch (from Mutt). Perhaps some of this or links to it could be added to the wiki? signature.asc Description: Digital signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Multiple sender identities (composing)
On Mon, 16 May 2011 20:03:34 +0200, Thomas Jost wrote: > Nice idea, I like that. However this way you can only get the address > part, not the username part. And when using some addresses I want to put > a nickname instead of my full name, so just using a default user name is > not very convenient. > Or is it possible to put things like "User Name " in the > notmuch config? notmuch config get user.name jamie. pgp7B54MQ4yAB.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Multiple sender identities (composing)
On Mon, 16 May 2011 09:52:32 -0700, Jameson Graef Rollins wrote: > On Mon, 16 May 2011 11:52:43 +0200, Thomas Jost wrote: > > On Mon, 16 May 2011 19:29:07 +1000, Stewart Smith > > wrote: > > > Thought I'd share this bit of my .emacs snippet that may be useful to go > > > on the emacs tips page. > > > > > > This does the following: > > > - sets up a list of possible identities to have mail From > > > - on composing mail, it prompts you for who you want to send mail from > > > - pressing enter will give you the default (first in the list) > > > - otherwise you have tab completion > > This is great, guys. I've been wanting to get something like this > working for a while now. > > Have you guys looked at home message-mode does bbdb address completion > in the To: and From: headers? It has the nice benefit of being able to > tab through all full addresses for a bbdb entry. It would be nice to > have this function fill in a default address, with the cursor at the end > of the address, and then just tab through all the options without having > to type in anything. ido is pretty cool, though, and accomplishes a > similar effect. I don't know much about bbdb; right now I'm completing addresses with notmuch-address.el and a little Python script that I wrote [1]. It can complete the From header too, although I had never tried that before writing this mail :) > It would be nice to pull the addresses from the notmuch config, eg: > > notmuch config get user.primary_email > notmuch config get user.other_email Nice idea, I like that. However this way you can only get the address part, not the username part. And when using some addresses I want to put a nickname instead of my full name, so just using a default user name is not very convenient. Or is it possible to put things like "User Name " in the notmuch config? > I would ideally like to be able to choose the From: address right before > sending, as opposed to right before composing. Has anyone tried to get > that working? I was not having much luck with send-hooks, since it > looks like it expects the message to be complete at that point. I haven't tried that, but it would indeed be nice to be able to do that at send time. The message-seend-hook doc states that "this hook is run quite early when sending", so I would expect that to be the best solution. However, if for some reason it doesn't work, it's probably possible to write a little function around message-send (...or even to advise it) to do whatever you want before it is actually executed. I'll try to have a look at this tomorrow. Regards, Thomas [1] https://github.com/Schnouki/dotfiles/blob/master/notmuch/addrbook.py -- Thomas/Schnouki pgpo7HMjRGfGm.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Multiple sender identities (composing)
On Mon, 16 May 2011 11:52:43 +0200, Thomas Jost wrote: > On Mon, 16 May 2011 19:29:07 +1000, Stewart Smith > wrote: > > Thought I'd share this bit of my .emacs snippet that may be useful to go > > on the emacs tips page. > > > > This does the following: > > - sets up a list of possible identities to have mail From > > - on composing mail, it prompts you for who you want to send mail from > > - pressing enter will give you the default (first in the list) > > - otherwise you have tab completion This is great, guys. I've been wanting to get something like this working for a while now. Have you guys looked at home message-mode does bbdb address completion in the To: and From: headers? It has the nice benefit of being able to tab through all full addresses for a bbdb entry. It would be nice to have this function fill in a default address, with the cursor at the end of the address, and then just tab through all the options without having to type in anything. ido is pretty cool, though, and accomplishes a similar effect. It would be nice to pull the addresses from the notmuch config, eg: notmuch config get user.primary_email notmuch config get user.other_email I would ideally like to be able to choose the From: address right before sending, as opposed to right before composing. Has anyone tried to get that working? I was not having much luck with send-hooks, since it looks like it expects the message to be complete at that point. jamie. pgp8iUw0vKzKI.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Multiple sender identities (composing)
On Mon, 16 May 2011 11:52:43 +0200, Thomas Jost wrote: > On Mon, 16 May 2011 19:29:07 +1000, Stewart Smith > wrote: > (people who don't use or like ido may want to replace > ido-completing-read with completing-read) I couldn't get ido to work at all (Ubuntu Natty). It would just prompt and not tab complete or even accept enter (it would insert a newline in minibuffer) - which is why I just ended up using completing-read. > - function to change the SMTP server that will be used for sending the > mail according to the From header I actually just do this via postfix sender_dependent_relayhost_maps which ends up working quite nicely. -- Stewart Smith ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Multiple sender identities (composing)
On Mon, 16 May 2011 19:29:07 +1000, Stewart Smith wrote: > Thought I'd share this bit of my .emacs snippet that may be useful to go > on the emacs tips page. > > This does the following: > - sets up a list of possible identities to have mail From > - on composing mail, it prompts you for who you want to send mail from > - pressing enter will give you the default (first in the list) > - otherwise you have tab completion And here's the same for choosing the identity when forwarding a mail: ;; Choose the identity used to forward a mail (defun schnouki/notmuch-mua-forward-message () (interactive) (let* ((from (ido-completing-read "Sender identity: " schnouki/mua-identities nil nil nil nil (car schnouki/mua-identities))) (address-components (mail-extract-address-components from)) (user-full-name (car address-components)) (user-mail-address (cadr address-components))) (notmuch-mua-forward-message))) (people who don't use or like ido may want to replace ido-completing-read with completing-read) If anyone is interested, I have some more useful snippets available on https://github.com/Schnouki/dotfiles/blob/master/emacs/init-50-mail.el#L232: - function to choose a signature according to the From header - function to choose the sender identity according to the To header (useful for replying to work e-mails using your work address, or for replying to a ML with a subscribed address that won't be rejected) - function to change the SMTP server that will be used for sending the mail according to the From header It seriously lacks documentation so don't hesitate to ask if you have any problem with it :) Regards, -- Thomas/Schnouki pgpzZnFZb3DRW.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch