Hellow! i am beginner at elisp. as far as i write-up below code. ===> references: emacs wiki [multiple smtp gnus] #+begin_src emacs lisp (setq user-full-name "Byung-Hee HWANG") (setq sendmail-program "/usr/sbin/ssmtp") (defun setHome () (interactive) (message "from home -- soyeomul@doraji.xyz") (setq user-mail-address "soyeomul@doraji.xyz") (setq message-sendmail-extra-arguments '("-C" "/etc/ssmtp/ssmtp-yw.conf"))) (defun setWork () (interactive) (message "from work -- soyeomul@gmail.com") (setq user-mail-address "soyeomul@gmail.com") (setq message-sendmail-extra-arguments '("-C" "/etc/ssmtp/ssmtp-gmail.conf"))) (add-hook 'message-mode-hook '(lambda () (if (y-or-n-p "at home?") (progn (setHome)) (progn (setWork))))) #+end_src at then, question... how can i enable the above rule only when i hit `m' key? i try to google and emacs manual etc... but failed.. Sincerely, Gnus fan Byung-Hee -- ^고맙습니다 _地平天成_ 감사합니다_^))//
Thanks!!! Sincerely, Byung-Hee -- ^고맙습니다 _和合團結_ 감사합니다_^))//
Byung-Hee HWANG writes:
[...]
>
> (add-hook 'message-mode-hook
> '(lambda ()
> (if (y-or-n-p "at home?")
> (progn (setHome))
> (progn (setWork)))))
> #+end_src
>
> at then, question...
>
> how can i enable the above rule only when i hit `m' key?
>
> i try to google and emacs manual etc... but failed..
Hi, I guess you don't want a hook here, but to bind a keypress to your
function inside the hook. Something along the lines of:
(add-hook 'message-mode-hook
'(local-set-key (kbd "M-m") '(lambda ()
(if (y-or-n-p "at home?")
(progn (setHome))
(progn (setWork))))))
I have binded to M-m instead of just "m", otherwise you couldn't type
the letter "m" in a message.
--
Alberto
Byung-Hee, I use gnus posting styles for this and gnus-alias-use-identity to switch identities. Not quite what you wanted, as it's not tied to the m key but is instead something you do once you are in the message buffer, but it does work well. -- Eric S Fraga via Emacs 28.0.50 & org 9.4 on Debian bullseye/sid
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> Byung-Hee,
>
> I use gnus posting styles for this and gnus-alias-use-identity to switch
> identities. Not quite what you wanted, as it's not tied to the m key
> but is instead something you do once you are in the message buffer, but
> it does work well.
Hmm.. interesting about gnus-alias-use-identity. I will study it
gnus-alias-use-identity. Because i love the word "identity".
Sincerely, Byung-Hee
--
^고맙습니다 _地平天成_ 감사합니다_^))//
gnus-alias-use-identity takes a little setting up (not too much though) but is much more flexible. I probably have 20 contexts set up and in the end it makes switching among them very easy. For instance, sometimes I want to be a clueless AOL user, sometimes I want to be an alum of my undergrad university, and sometimes I even just want to be myself. Take the time to set up gnus-alias-identity list to suit your needs and wishes, and when you're comfortable with that go to the next level with gnus-alias-identity-rules, which allows for some automated identity selection. For instance certain "friends" always get mail from my netzero identity; if someone writes to a deprecated address they weill get a reply from my preferred identity. -- Bob Newell Honolulu, Hawai`i - Via GNU/Linux/Emacs/Gnus/BBDB
Alberto Luaces <aluaces@udc.es> writes:
> Byung-Hee HWANG writes:
>
> [...]
>
>>
>> (add-hook 'message-mode-hook
>> '(lambda ()
>> (if (y-or-n-p "at home?")
>> (progn (setHome))
>> (progn (setWork)))))
>> #+end_src
>>
>> at then, question...
>>
>> how can i enable the above rule only when i hit `m' key?
>>
>> i try to google and emacs manual etc... but failed..
>
> Hi, I guess you don't want a hook here, but to bind a keypress to your
> function inside the hook. Something along the lines of:
>
> (add-hook 'message-mode-hook
> '(local-set-key (kbd "M-m") '(lambda ()
> (if (y-or-n-p "at home?")
> (progn (setHome))
> (progn (setWork))))))
>
> I have binded to M-m instead of just "m", otherwise you couldn't type
> the letter "m" in a message.
Thanks Alberto, i will study about local-set-key, thanks again^^^
Sincerely, Byung-Hee
--
^고맙습니다 _地平天成_ 감사합니다_^))//
Bob Newell <bobnewell@bobnewell.net> writes:
> gnus-alias-use-identity takes a little setting up (not too
> much though) but is much more flexible. I probably have 20
> contexts set up and in the end it makes switching among them
> very easy. For instance, sometimes I want to be a clueless AOL
> user, sometimes I want to be an alum of my undergrad
> university, and sometimes I even just want to be myself.
>
> Take the time to set up gnus-alias-identity list to suit your
> needs and wishes, and when you're comfortable with that go to
> the next level with gnus-alias-identity-rules, which allows for
> some automated identity selection. For instance certain
> "friends" always get mail from my netzero identity; if someone
> writes to a deprecated address they weill get a reply from my
> preferred identity.
Thanks Bob, your story is my story thanks again ^^^
Sincerely, Byung-Hee
--
^고맙습니다 _地平天成_ 감사합니다_^))//
On Mon, 16 Nov 2020 16:52:12 -1000 Bob Newell <bobnewell@bobnewell.net> wrote: > Take the time to set up gnus-alias-identity list to suit your > needs and wishes, and when you're comfortable with that go to > the next level with gnus-alias-identity-rules, which allows for > some automated identity selection. For instance certain > "friends" always get mail from my netzero identity; if someone > writes to a deprecated address they weill get a reply from my > preferred identity. Additionally, here is a function to cycle through the gnus-alias identities: https://github.com/vv3/gnus-alias/commit/986f3a1732362357162a8450a2250069baf02dce This can be bound to a key for quick access. -- Vennlig hilsen/Best regards Vegard Vesterheim Senior Software engineer +47 48 11 98 98 vegard.vesterheim@uninett.no
Vegard Vesterheim <vegard.vesterheim@uninett.no> writes:
>
> Additionally, here is a function to cycle through the gnus-alias
> identities:
>
> https://github.com/vv3/gnus-alias/commit/986f3a1732362357162a8450a2250069baf02dce
>
> This can be bound to a key for quick access.
I didn't know about this one, that's a great feature.
gnus-alias-identity also works well with helm, so there are
plenty of options and once set up, very good ease of use.
--
Bob Newell
Honolulu, Hawai`i
- Via GNU/Linux/Emacs/Gnus/BBDB
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> Byung-Hee,
>
> I use gnus posting styles for this and gnus-alias-use-identity
> to switch
> identities. Not quite what you wanted, as it's not tied to the
> m key
> but is instead something you do once you are in the message
> buffer, but
> it does work well.
I decided to try gnus-alias-use-identity based on this
recommendation, and I have it in place and functioning. But I’m
running into a small but irritating problem that seems likely to
be related.
I’ve set From to be my address and done the other default
settings, nothing interesting there as far as I know, plus I’ve
added a Gcc header that points to the Sent Mail on my IMAP server.
(That same Gcc header has been working fine in the past, and in
fact it is still working.) But now, every time I send an email,
I see a message complaining that the function
"nnnil-request-create-group" doesn’t exist, and the status line
claims that the message is still unsent. However, in every case
the message HAS been sent, including showing up correctly in the
Sent Mail on the server. If I delete the buffer containing the
so-called unsent message, then all the expected copies are already
in the right place.
I don’t know where the request for nnnil-request-create-group is
coming from, and I don’t know how to discover that. My guess is
that I have some outdated and/or incorrect setting that conflicts
with gnus-alias-use-identity - does anyone here have experience or
suggestions?
Do I need to de-duplicate settings that are currently duplicated
between posting styles and gnus-alias-use-identity? Or will
overlapping settings just be harmlessly re-applied?
--
David Rogers