unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Pascal Bourguignon <spam@mouse-potato.com>
Subject: Re: How to bind keys in emacs?
Date: Fri, 23 Dec 2005 09:24:34 +0100	[thread overview]
Message-ID: <87psnodxvh.fsf@thalassa.informatimago.com> (raw)
In-Reply-To: 1135323536.675947.257490@o13g2000cwo.googlegroups.com

"zelzel.zsu@gmail.com" <zelzel.zsu@gmail.com> writes:
> Subject: How to bind keys in emacs?
>
> hi, I am new to emacs.
> can anyone wrote some code for me?
>
> I want to bind some functions to F5, F6 keys.
>
> I want to use F5 keys to serve as C-x C-s [save buffer].
> and  use F5 keys to serve as C-z [suspend].
>
> What should i write in my ~/.emacs?

If find it strange that you have non-deterministics wants, but here you are:

(global-set-key (kbd "<f5>") (lambda () 
                                (interactive)
                                (if (oddp (random 2)) 
                                    (save-buffer 0) 
                                    (if window-system
                                       (iconify-or-deiconify-frame)
                                       (suspend-emacs)))))

                                
-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

In a World without Walls and Fences, 
who needs Windows and Gates?

  reply	other threads:[~2005-12-23  8:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-23  7:38 How to bind keys in emacs? zelzel.zsu
2005-12-23  8:24 ` Pascal Bourguignon [this message]
2005-12-23 18:18   ` Cameron Desautels
     [not found]   ` <mailman.20269.1135361990.20277.help-gnu-emacs@gnu.org>
2005-12-23 23:13     ` B. T. Raven
2005-12-23 23:28       ` Pascal Bourguignon
2005-12-24  6:16         ` B. T. Raven
2005-12-24  7:11           ` Pascal Bourguignon
2005-12-24  8:13         ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87psnodxvh.fsf@thalassa.informatimago.com \
    --to=spam@mouse-potato.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).