This section describes some convenient interactive interfaces for
changing key bindings. They work by calling define-key
.
People often use global-set-key
in their `.emacs' file for
simple customization. For example,
(global-set-key "\C-x\C-\\" 'next-line)
or
(global-set-key [?\C-x ?\C-\\] 'next-line)
or
(global-set-key [(control ?x) (control ?\\)] 'next-line)
redefines C-x C-\ to move down a line.
(global-set-key [M-mouse-1] 'mouse-set-point)
redefines the first (leftmost) mouse button, typed with the Meta key, to set point where you click.
(global-set-key key definition) == (define-key (current-global-map) key definition)
One use of this function is in preparation for defining a longer key that uses key as a prefix--which would not be allowed if key has a non-prefix binding. For example:
(global-unset-key "\C-l") => nil (global-set-key "\C-l\C-l" 'redraw-display) => nil
This function is implemented simply using define-key
:
(global-unset-key key) == (define-key (current-global-map) key nil)
(local-set-key key definition) == (define-key (current-local-map) key definition)
(local-unset-key key) == (define-key (current-local-map) key nil)
Go to the first, previous, next, last section, table of contents.