Gnus development mailing list
 help / color / mirror / Atom feed
From: Alberto Luaces <aluaces@udc.es>
To: ding@gnus.org
Subject: Re: i would like to select one mail address at prompt when i hit `m' key in keyboard...
Date: Mon, 16 Nov 2020 16:41:57 +0100	[thread overview]
Message-ID: <87sg99tika.fsf@eps142.cdf.udc.es> (raw)
In-Reply-To: <871rgvibgq.fsf@delta.birch.chromebook>

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



  parent reply	other threads:[~2020-11-16 16:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-15  2:46 Byung-Hee HWANG
2020-11-16 10:43 ` Solved problem (Was: Re: i would like to select one mail address at prompt when i hit `m' key in keyboard...) 황병희
2020-11-16 15:41 ` Alberto Luaces [this message]
2020-11-17  3:00   ` i would like to select one mail address at prompt when i hit `m' key in keyboard 황병희
2020-11-16 16:06 ` Eric S Fraga
2020-11-17  2:08   ` 황병희
2020-11-17  2:52     ` Bob Newell
2020-11-17  3:09       ` 황병희
2020-11-17  7:14       ` Vegard Vesterheim
2020-11-17 16:34         ` Bob Newell
2020-11-30 23:31   ` David Rogers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sg99tika.fsf@eps142.cdf.udc.es \
    --to=aluaces@udc.es \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).