comparison lisp/subr.el @ 43158:43607fa60102

(global-set-key, local-set-key): Accept a symbol for the KEY argument (like define-key).
author Kim F. Storm <storm@cua.dk>
date Wed, 06 Feb 2002 23:05:44 +0000
parents 2c6477a9d9d5
children c7aaafe7f385
comparison
equal deleted inserted replaced
43157:c72ba425c038 43158:43607fa60102
1667 1667
1668 Note that if KEY has a local binding in the current buffer, 1668 Note that if KEY has a local binding in the current buffer,
1669 that local binding will continue to shadow any global binding 1669 that local binding will continue to shadow any global binding
1670 that you make with this function." 1670 that you make with this function."
1671 (interactive "KSet key globally: \nCSet key %s to command: ") 1671 (interactive "KSet key globally: \nCSet key %s to command: ")
1672 (or (vectorp key) (stringp key) 1672 (or (vectorp key) (stringp key) (symbolp key)
1673 (signal 'wrong-type-argument (list 'arrayp key))) 1673 (signal 'wrong-type-argument (list 'arrayp key)))
1674 (define-key (current-global-map) key command)) 1674 (define-key (current-global-map) key command))
1675 1675
1676 (defun local-set-key (key command) 1676 (defun local-set-key (key command)
1677 "Give KEY a local binding as COMMAND. 1677 "Give KEY a local binding as COMMAND.
1685 which in most cases is shared with all other buffers in the same major mode." 1685 which in most cases is shared with all other buffers in the same major mode."
1686 (interactive "KSet key locally: \nCSet key %s locally to command: ") 1686 (interactive "KSet key locally: \nCSet key %s locally to command: ")
1687 (let ((map (current-local-map))) 1687 (let ((map (current-local-map)))
1688 (or map 1688 (or map
1689 (use-local-map (setq map (make-sparse-keymap)))) 1689 (use-local-map (setq map (make-sparse-keymap))))
1690 (or (vectorp key) (stringp key) 1690 (or (vectorp key) (stringp key) (symbolp key)
1691 (signal 'wrong-type-argument (list 'arrayp key))) 1691 (signal 'wrong-type-argument (list 'arrayp key)))
1692 (define-key map key command))) 1692 (define-key map key command)))
1693 1693
1694 (defun global-unset-key (key) 1694 (defun global-unset-key (key)
1695 "Remove global binding of KEY. 1695 "Remove global binding of KEY.