help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to bind keys in emacs?


From: Pascal Bourguignon
Subject: Re: How to bind keys in emacs?
Date: Fri, 23 Dec 2005 09:24:34 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"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 via email to

[Prev in Thread] Current Thread [Next in Thread]