Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
baed0109
Commit
baed0109
authored
Feb 25, 1995
by
Richard M. Stallman
Browse files
(global_set_key, local_set_key, global_unset_key)
(local_unset_key): Functions moved here from keyboard.c.
parent
b0347178
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
lisp/subr.el
lisp/subr.el
+45
-0
No files found.
lisp/subr.el
View file @
baed0109
...
...
@@ -932,7 +932,52 @@ syntax table; other characters are copied from the standard syntax table."
(
aset
table
i
13
)
(
setq
i
(
1+
i
)))
table
)))
(
defun
global-set-key
(
key
command
)
"Give KEY a global binding as COMMAND.
COMMAND is a symbol naming an interactively-callable function.
KEY is a key sequence (a string or vector of characters or event types).
Non-ASCII characters with codes above 127 (such as ISO Latin-1)
can be included if you use a vector.
Note that if KEY has a local binding in the current buffer
that local binding will continue to shadow any global binding."
(
interactive
"KSet key globally: \nCSet key %s to command: "
)
(
or
(
vectorp
key
)
(
stringp
key
)
(
signal
'wrong-type-argument
(
list
'arrayp
key
)))
(
define-key
(
current-global-map
)
key
command
)
nil
)
(
defun
local-set-key
(
key
command
)
"Give KEY a local binding as COMMAND.
COMMAND is a symbol naming an interactively-callable function.
KEY is a key sequence (a string or vector of characters or event types).
Non-ASCII characters with codes above 127 (such as ISO Latin-1)
can be included if you use a vector.
The binding goes in the current buffer's local map,
which in most cases is shared with all other buffers in the same major mode."
(
interactive
"KSet key locally: \nCSet key %s locally to command: "
)
(
let
((
map
(
current-local-map
)))
(
or
map
(
use-local-map
(
setq
map
(
make-sparse-keymap
))))
(
or
(
vectorp
key
)
(
stringp
key
)
(
signal
'wrong-type-argument
(
list
'arrayp
key
)))
(
define-key
map
key
command
))
nil
)
(
defun
global-unset-key
(
key
)
"Remove global binding of KEY.
KEY is a string representing a sequence of keystrokes."
(
interactive
"kUnset key globally: "
)
(
global-set-key
key
nil
))
(
defun
local-unset-key
"Remove local binding of KEY.
KEY is a string representing a sequence of keystrokes."
(
interactive
"kUnset key locally: "
)
(
if
(
current-local-map
)
(
local-set-key
(
current-local-map
)
key
nil
))
nil
)
;; now in fns.c
;(defun nth (n list)
; "Returns the Nth element of LIST.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment