* Gnus: How to easily change "From:" from the default to a second account's address? @ 2011-11-23 16:24 Marius Hofert 2011-11-23 16:35 ` Tassilo Horn ` (2 more replies) 0 siblings, 3 replies; 16+ messages in thread From: Marius Hofert @ 2011-11-23 16:24 UTC (permalink / raw) To: Emacs help Hi, If I want to create a new message with "m", it shows my default email address in "From:" I specified with (setq user-mail-address "my.name@uni.edu") Since I have a second account (googlemail), every once in a while I would like to hav "From: my.name@googlemail.com" instead of "From: my.name@uni.edu". So far, I deleted the entry and typed in my gmail account's address. Is there a simpler way? I also tried to hit "m" when the point is on my gmail account in the *Group* buffer, but that did not open a new message with the corresponding "From:" address... Cheers, Marius ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-11-23 16:24 Gnus: How to easily change "From:" from the default to a second account's address? Marius Hofert @ 2011-11-23 16:35 ` Tassilo Horn 2011-11-23 22:17 ` Marius Hofert 2011-11-27 19:03 ` Memnon Anon 2011-12-03 19:17 ` Teemu Likonen 2 siblings, 1 reply; 16+ messages in thread From: Tassilo Horn @ 2011-11-23 16:35 UTC (permalink / raw) To: help-gnu-emacs Marius Hofert <marius.hofert@math.ethz.ch> writes: Hi Marius, > If I want to create a new message with "m", it shows my default email > address in "From:" I specified with (setq user-mail-address > "my.name@uni.edu") Since I have a second account (googlemail), every > once in a while I would like to hav "From: my.name@googlemail.com" > instead of "From: my.name@uni.edu". So far, I deleted the entry and > typed in my gmail account's address. Is there a simpler way? Yep, posting styles. ,----[ (info "(gnus)Posting Styles") ] | So what if you want a different `Organization' and signature based | on what groups you post to? And you post both from your home machine | and your work machine, and you want different `From' lines, and so on? `---- > I also tried to hit "m" when the point is on my gmail account in the > *Group* buffer, but that did not open a new message with the > corresponding "From:" address... ,----[ C-h k m (in *Group*) ] | m runs the command gnus-group-mail, which is an interactive compiled Lisp | function in `gnus-msg.el'. | | It is bound to m, <menu-bar> <Gnus> <Send a mail>. | | (gnus-group-mail &optional ARG) | | Start composing a mail. | If ARG, use the group under the point to find a posting style. | If ARG is 1, prompt for a group name to find the posting style. `---- The way to set the ARG when invoking a commant with M-x or a key binding is to prefix it with `C-u'. So if you already have a posting style defined for the group point is on, `C-u m' will use that for the new mail. Bye, Tassilo -- (What the world needs (I think) is not (a Lisp (with fewer parentheses)) but (an English (with more.))) Brian Hayes, http://tinyurl.com/3y9l2kf ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-11-23 16:35 ` Tassilo Horn @ 2011-11-23 22:17 ` Marius Hofert 2011-11-25 2:17 ` Philipp Haselwarter 0 siblings, 1 reply; 16+ messages in thread From: Marius Hofert @ 2011-11-23 22:17 UTC (permalink / raw) To: Tassilo Horn; +Cc: Emacs help Hi Tassilo, works flawlessly, many thanks (once again). Cheers, Marius On 2011-11-23, at 17:35 , Tassilo Horn wrote: > Marius Hofert <marius.hofert@math.ethz.ch> writes: > > Hi Marius, > >> If I want to create a new message with "m", it shows my default email >> address in "From:" I specified with (setq user-mail-address >> "my.name@uni.edu") Since I have a second account (googlemail), every >> once in a while I would like to hav "From: my.name@googlemail.com" >> instead of "From: my.name@uni.edu". So far, I deleted the entry and >> typed in my gmail account's address. Is there a simpler way? > > Yep, posting styles. > > ,----[ (info "(gnus)Posting Styles") ] > | So what if you want a different `Organization' and signature based > | on what groups you post to? And you post both from your home machine > | and your work machine, and you want different `From' lines, and so on? > `---- > >> I also tried to hit "m" when the point is on my gmail account in the >> *Group* buffer, but that did not open a new message with the >> corresponding "From:" address... > > ,----[ C-h k m (in *Group*) ] > | m runs the command gnus-group-mail, which is an interactive compiled Lisp > | function in `gnus-msg.el'. > | > | It is bound to m, <menu-bar> <Gnus> <Send a mail>. > | > | (gnus-group-mail &optional ARG) > | > | Start composing a mail. > | If ARG, use the group under the point to find a posting style. > | If ARG is 1, prompt for a group name to find the posting style. > `---- > > The way to set the ARG when invoking a commant with M-x or a key binding > is to prefix it with `C-u'. So if you already have a posting style > defined for the group point is on, `C-u m' will use that for the new > mail. > > Bye, > Tassilo > -- > (What the world needs (I think) is not > (a Lisp (with fewer parentheses)) > but (an English (with more.))) > Brian Hayes, http://tinyurl.com/3y9l2kf > > ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-11-23 22:17 ` Marius Hofert @ 2011-11-25 2:17 ` Philipp Haselwarter 2011-11-25 3:12 ` Eric Abrahamsen 0 siblings, 1 reply; 16+ messages in thread From: Philipp Haselwarter @ 2011-11-25 2:17 UTC (permalink / raw) To: help-gnu-emacs I often find myself wanting to change the From: after opening the message; this allows picking one of your accounts: #+begin_src emacs-lisp (defcustom my-smtp-accounts nil "*list of available smtp accounts" :group 'smtpmail :type '(repeat alist)) (defun my-pick-smtp () (interactive) (setq user-mail-address (let ((f (if (functionp 'ido-completing-read) 'ido-completing-read completing-read))) (funcall f "Which smtp acc:" (mapcar 'cadr my-smtp-accounts)))) (save-excursion (save-restriction (message-narrow-to-headers-or-head) (message-remove-header "From") (goto-char (point-max)) (insert "From: " (message-make-from) "\n")))) #+end_src -- Philipp Haselwarter ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-11-25 2:17 ` Philipp Haselwarter @ 2011-11-25 3:12 ` Eric Abrahamsen 2011-11-26 12:03 ` Philipp Haselwarter 0 siblings, 1 reply; 16+ messages in thread From: Eric Abrahamsen @ 2011-11-25 3:12 UTC (permalink / raw) To: help-gnu-emacs On Fri, Nov 25 2011, Philipp Haselwarter wrote: > I often find myself wanting to change the From: after opening the > message; this allows picking one of your accounts: Is this much different from `message-alternative-emails'? I think that's what I use to set my possible From addresses, and then TAB at the end of the address will cycle through the possible addresses. Eric > #+begin_src emacs-lisp > (defcustom my-smtp-accounts nil > "*list of available smtp accounts" > :group 'smtpmail > :type '(repeat alist)) > > (defun my-pick-smtp () > (interactive) > (setq user-mail-address > (let ((f (if (functionp 'ido-completing-read) > 'ido-completing-read > completing-read))) > (funcall f "Which smtp acc:" (mapcar 'cadr my-smtp-accounts)))) > (save-excursion > (save-restriction > (message-narrow-to-headers-or-head) > (message-remove-header "From") > (goto-char (point-max)) > (insert "From: " (message-make-from) "\n")))) > > #+end_src -- GNU Emacs 24.0.91.1 (i686-pc-linux-gnu, GTK+ Version 2.24.6) of 2011-11-07 on pellet ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-11-25 3:12 ` Eric Abrahamsen @ 2011-11-26 12:03 ` Philipp Haselwarter 2011-11-27 1:52 ` Eric Abrahamsen 0 siblings, 1 reply; 16+ messages in thread From: Philipp Haselwarter @ 2011-11-26 12:03 UTC (permalink / raw) To: help-gnu-emacs Eric Abrahamsen <eric@ericabrahamsen.net> writes: > On Fri, Nov 25 2011, Philipp Haselwarter wrote: > >> I often find myself wanting to change the From: after opening the >> message; this allows picking one of your accounts: > > Is this much different from `message-alternative-emails'? I think that's > what I use to set my possible From addresses, and then TAB at the end of > the address will cycle through the possible addresses. > > Eric > ---8<---[snipped 21 lines]---8<--- I didn't know about `message-alternative-emails', and setting From: from To: or Cc: works nicely :) ! But I can't seem to cycle. Is that something that's supposed to work in plain gnus (tried it without all my configs) or do I need to set up something else? -- Philipp Haselwarter ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-11-26 12:03 ` Philipp Haselwarter @ 2011-11-27 1:52 ` Eric Abrahamsen 2011-12-03 21:10 ` Johnny 0 siblings, 1 reply; 16+ messages in thread From: Eric Abrahamsen @ 2011-11-27 1:52 UTC (permalink / raw) To: help-gnu-emacs On Sat, Nov 26 2011, Philipp Haselwarter wrote: > Eric Abrahamsen <eric@ericabrahamsen.net> writes: > >> On Fri, Nov 25 2011, Philipp Haselwarter wrote: >> >>> I often find myself wanting to change the From: after opening the >>> message; this allows picking one of your accounts: >> >> Is this much different from `message-alternative-emails'? I think that's >> what I use to set my possible From addresses, and then TAB at the end of >> the address will cycle through the possible addresses. >> >> Eric >> > ---8<---[snipped 21 lines]---8<--- > > I didn't know about `message-alternative-emails', and setting From: from > To: or Cc: works nicely :) ! > > But I can't seem to cycle. Is that something that's supposed to work in > plain gnus (tried it without all my configs) or do I need to set up > something else? Hmm, I'm not quite sure about this one, and it's hard to get a plain config. As all the other message buffer cycling is provided by BBDB in my case, it's possible that that's what's doing it for me. After I set `message-alternative-emails' in my gnus.el, I also do this: (setq bbdb-user-mail-address-re message-alternative-emails gnus-ignored-from-addresses message-alternative-emails) That basically sorts all the "own emails" issues for me. Again, I suspect it's BBDB that provides cycling. Good luck, Eric -- GNU Emacs 24.0.91.1 (i686-pc-linux-gnu, GTK+ Version 2.24.6) of 2011-11-07 on pellet ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-11-27 1:52 ` Eric Abrahamsen @ 2011-12-03 21:10 ` Johnny 2011-12-03 22:53 ` Philipp Haselwarter 0 siblings, 1 reply; 16+ messages in thread From: Johnny @ 2011-12-03 21:10 UTC (permalink / raw) To: Eric Abrahamsen; +Cc: help-gnu-emacs Eric Abrahamsen <eric@ericabrahamsen.net> writes: > On Sat, Nov 26 2011, Philipp Haselwarter wrote: > >> Eric Abrahamsen <eric@ericabrahamsen.net> writes: >> >>> On Fri, Nov 25 2011, Philipp Haselwarter wrote: >>> >>>> I often find myself wanting to change the From: after opening the >>>> message; this allows picking one of your accounts: >>> >>> Is this much different from `message-alternative-emails'? I think that's >>> what I use to set my possible From addresses, and then TAB at the end of >>> the address will cycle through the possible addresses. >>> >> I didn't know about `message-alternative-emails', and setting From: from >> To: or Cc: works nicely :) ! >> >> But I can't seem to cycle. > > [...] I suspect it's BBDB that provides cycling. I don't use the `message-alternative-emails' at all, and I am quite sure the cycling is provided by BBDB (3.02) by matching my records `mail' field. These are the likely candidates to use in your .gnus.el file: ,---- | (setq bbdb-complete-name-allow-cycling t) | (setq bbdb-complete-mail-allow-cycling t) `---- -- Johnny ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-12-03 21:10 ` Johnny @ 2011-12-03 22:53 ` Philipp Haselwarter 2011-12-04 12:58 ` Harry Putnam 0 siblings, 1 reply; 16+ messages in thread From: Philipp Haselwarter @ 2011-12-03 22:53 UTC (permalink / raw) To: help-gnu-emacs Johnny <yggdrasil@gmx.co.uk> writes: ---8<---[snipped 25 lines]---8<--- > > ,---- > | (setq bbdb-complete-name-allow-cycling t) > | (setq bbdb-complete-mail-allow-cycling t) > `---- I don't have the first one in bbdb3.02, but -mail- works like a charm :D -- Philipp Haselwarter ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-12-03 22:53 ` Philipp Haselwarter @ 2011-12-04 12:58 ` Harry Putnam 2011-12-05 19:44 ` Richard Riley 0 siblings, 1 reply; 16+ messages in thread From: Harry Putnam @ 2011-12-04 12:58 UTC (permalink / raw) To: help-gnu-emacs Philipp Haselwarter <philipp.haselwarter@gmx.de> writes: > Johnny <yggdrasil@gmx.co.uk> writes: > > ---8<---[snipped 25 lines]---8<--- >> >> ,---- >> | (setq bbdb-complete-name-allow-cycling t) >> | (setq bbdb-complete-mail-allow-cycling t) >> `---- > > I don't have the first one in bbdb3.02, but -mail- works like a charm :D After going thru this thread a few times, I still am not `getting' what you mean here. Do you mind explaining in some detail what you actually doing above? ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-12-04 12:58 ` Harry Putnam @ 2011-12-05 19:44 ` Richard Riley 2011-12-05 20:18 ` Johnny 0 siblings, 1 reply; 16+ messages in thread From: Richard Riley @ 2011-12-05 19:44 UTC (permalink / raw) To: help-gnu-emacs Harry Putnam <reader@newsguy.com> writes: > Philipp Haselwarter <philipp.haselwarter@gmx.de> writes: > >> Johnny <yggdrasil@gmx.co.uk> writes: >> >> ---8<---[snipped 25 lines]---8<--- >>> >>> ,---- >>> | (setq bbdb-complete-name-allow-cycling t) >>> | (setq bbdb-complete-mail-allow-cycling t) >>> `---- >> >> I don't have the first one in bbdb3.02, but -mail- works like a charm :D > > After going thru this thread a few times, I still am not `getting' > what you mean here. Do you mind explaining in some detail what you > actually doing above? > Q:What mechanism are you using to cycle? When I hit tab it shows my 3 or 4 emails matching the seed in another window and I have to switch to that window and select it (bbdb 3.02). ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-12-05 19:44 ` Richard Riley @ 2011-12-05 20:18 ` Johnny 2011-12-05 20:39 ` Richard Riley 0 siblings, 1 reply; 16+ messages in thread From: Johnny @ 2011-12-05 20:18 UTC (permalink / raw) To: help-gnu-emacs Richard Riley <rileyrg@gmail.com> writes: > Harry Putnam <reader@newsguy.com> writes: > >> Philipp Haselwarter <philipp.haselwarter@gmx.de> writes: >> >>> Johnny <yggdrasil@gmx.co.uk> writes: >>> >>> ---8<---[snipped 25 lines]---8<--- >>>> >>>> ,---- >>>> | (setq bbdb-complete-name-allow-cycling t) >>>> | (setq bbdb-complete-mail-allow-cycling t) >>>> `---- >>> >>> I don't have the first one in bbdb3.02, but -mail- works like a charm :D >> >> After going thru this thread a few times, I still am not `getting' >> what you mean here. Do you mind explaining in some detail what you >> actually doing above? >> > > > Q:What mechanism are you using to cycle? When I hit tab it shows my > 3 or 4 emails matching the seed in another window and I have to switch > to that window and select it (bbdb 3.02). > I am using TAB to cycle. Maybe the following line that I have in my .gnus.el is suppressing the popup behaviour you describe? ,---- | (setq bbdb-use-pop-up nil) `---- -- Johnny ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-12-05 20:18 ` Johnny @ 2011-12-05 20:39 ` Richard Riley 2011-12-05 20:58 ` Johnny 0 siblings, 1 reply; 16+ messages in thread From: Richard Riley @ 2011-12-05 20:39 UTC (permalink / raw) To: help-gnu-emacs Johnny <yggdrasil@gmx.co.uk> writes: > Richard Riley <rileyrg@gmail.com> writes: > >> Harry Putnam <reader@newsguy.com> writes: >> >>> Philipp Haselwarter <philipp.haselwarter@gmx.de> writes: >>> >>>> Johnny <yggdrasil@gmx.co.uk> writes: >>>> >>>> ---8<---[snipped 25 lines]---8<--- >>>>> >>>>> ,---- >>>>> | (setq bbdb-complete-name-allow-cycling t) >>>>> | (setq bbdb-complete-mail-allow-cycling t) >>>>> `---- >>>> >>>> I don't have the first one in bbdb3.02, but -mail- works like a charm :D >>> >>> After going thru this thread a few times, I still am not `getting' >>> what you mean here. Do you mind explaining in some detail what you >>> actually doing above? >>> >> >> >> Q:What mechanism are you using to cycle? When I hit tab it shows my >> 3 or 4 emails matching the seed in another window and I have to switch >> to that window and select it (bbdb 3.02). >> > > I am using TAB to cycle. Maybe the following line that I have in my > .gnus.el is suppressing the popup behaviour you describe? > > ,---- > | (setq bbdb-use-pop-up nil) > `---- Unfortunately not and its not documented as a variable either. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-12-05 20:39 ` Richard Riley @ 2011-12-05 20:58 ` Johnny 0 siblings, 0 replies; 16+ messages in thread From: Johnny @ 2011-12-05 20:58 UTC (permalink / raw) To: help-gnu-emacs Richard Riley <rileyrg@gmail.com> writes: > Johnny <yggdrasil@gmx.co.uk> writes: > >> I am using TAB to cycle. Maybe the following line that I have in my >> .gnus.el is suppressing the popup behaviour you describe? >> >> ,---- >> | (setq bbdb-use-pop-up nil) >> `---- > > Unfortunately not and its not documented as a variable either. Yes, I noticed as well as I was trying to trace as to why I put it there in the first place! I know I struggled for a long time going between BBDB 2.35 and 3. intitially to avoid the popup that asks to add /all/ unknown recepients into BBDB. I got rid of that behaviour and am not sure why, but haven't got around to cleanse my .gnus.el since! Another candidate could be (sorry, I know I should try myself, but...) ,---- | (setq message-setup-hook | '(lambda () | (define-key message-mode-map "\M-\t" 'mail-abbrev-complete-alias))) `---- -- Johnny ^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: Gnus: How to easily change "From:" from the default to a second account's address? 2011-11-23 16:24 Gnus: How to easily change "From:" from the default to a second account's address? Marius Hofert 2011-11-23 16:35 ` Tassilo Horn @ 2011-11-27 19:03 ` Memnon Anon 2011-12-03 19:17 ` Teemu Likonen 2 siblings, 0 replies; 16+ messages in thread From: Memnon Anon @ 2011-11-27 19:03 UTC (permalink / raw) To: help-gnu-emacs Marius Hofert <marius.hofert@math.ethz.ch> writes: [...] > Since I have a second account (googlemail), every once in a while I > would like to hav "From: my.name@googlemail.com" instead of "From: > my.name@uni.edu". So far, I deleted the entry and typed in my gmail > account's address. Is there a simpler way? [...] A little late, but I've been using gnus-pers for this for quite some time. http://www.emacswiki.org/emacs/GnusPers Part of debians gnus-bonus-el. hth Memnon ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Gnus: How to easily change "From:" from the default to a second account's address? 2011-11-23 16:24 Gnus: How to easily change "From:" from the default to a second account's address? Marius Hofert 2011-11-23 16:35 ` Tassilo Horn 2011-11-27 19:03 ` Memnon Anon @ 2011-12-03 19:17 ` Teemu Likonen 2 siblings, 0 replies; 16+ messages in thread From: Teemu Likonen @ 2011-12-03 19:17 UTC (permalink / raw) To: Marius Hofert; +Cc: Emacs help * 2011-11-23T17:24:49+01:00 * Marius Hofert wrote: > If I want to create a new message with "m", it shows my default email > address in "From:" [...] every once in a while I would like to hav > "From: my.name@googlemail.com" instead of "From: my.name@uni.edu". So > far, I deleted the entry and typed in my gmail account's address. Is > there a simpler way? Here's my solution for (1) setting up Gnus for several mail addresses and (2) cycling them easily in a message-mode buffer (using F9 key). (setq user-full-name "User Name") (defvar my-email-addresses '("primary.address@internet.invalid" "other.address@somewhere.invalid" "yet.another@invalid")) ;; Set important variables (let ((addr my-email-addresses)) (setq-default user-mail-address (car addr) message-alternative-emails (regexp-opt (cdr addr) 'words) message-dont-reply-to-names (regexp-opt addr 'words) gnus-ignored-from-addresses message-dont-reply-to-names)) ;; The cycling functionality (add-hook 'message-mode-hook 'my-message-mode-hook) (defun my-message-mode-hook () (define-key message-mode-map (kbd "<f9>") 'my-message-toggle-from)) (defun my-message-toggle-from () (interactive) (require 'mail-extr) (let* ((current (nth 1 (mail-extract-address-components (message-fetch-field "From")))) (next (or (nth 1 (member current my-email-addresses)) (nth 0 my-email-addresses)))) (when (and current next) (save-excursion (save-restriction (message-narrow-to-head) (save-match-data (when (re-search-forward "^From: " nil t) (message-narrow-to-field) (delete-region (point-min) (point-max)) (insert "From: " user-full-name " <" next ">\n")))))))) ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2011-12-05 20:58 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-11-23 16:24 Gnus: How to easily change "From:" from the default to a second account's address? Marius Hofert 2011-11-23 16:35 ` Tassilo Horn 2011-11-23 22:17 ` Marius Hofert 2011-11-25 2:17 ` Philipp Haselwarter 2011-11-25 3:12 ` Eric Abrahamsen 2011-11-26 12:03 ` Philipp Haselwarter 2011-11-27 1:52 ` Eric Abrahamsen 2011-12-03 21:10 ` Johnny 2011-12-03 22:53 ` Philipp Haselwarter 2011-12-04 12:58 ` Harry Putnam 2011-12-05 19:44 ` Richard Riley 2011-12-05 20:18 ` Johnny 2011-12-05 20:39 ` Richard Riley 2011-12-05 20:58 ` Johnny 2011-11-27 19:03 ` Memnon Anon 2011-12-03 19:17 ` Teemu Likonen
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).