Function: edt-define-key

edt-define-key is an interactive and byte-compiled function defined in edt.el.gz.

Signature

(edt-define-key)

Documentation

Assign an interactively-callable function to a specified key sequence.

The current key definition is saved in edt-last-replaced-key-definition. Use edt-restore-key to restore last replaced key definition.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/edt.el.gz
;;;
;;; DEFINE KEY
;;;

(defun edt-define-key ()
  "Assign an interactively-callable function to a specified key sequence.
The current key definition is saved in `edt-last-replaced-key-definition'.
Use `edt-restore-key' to restore last replaced key definition."
  (interactive)
  (let (edt-function
	edt-key-definition)
    (setq edt-key-definition
	  (read-key-sequence "Press the key to be defined: "))
    (if (string-equal "\C-m" edt-key-definition)
        (message "Key not defined")
      (progn
	(setq edt-function (read-command "Enter command name: "))
	(if (string-equal "" edt-function)
	    (message "Key not defined")
	  (progn
	    (setq edt-last-replaced-key-definition
		  (lookup-key (current-global-map) edt-key-definition))
	    (define-key (current-global-map)
	      edt-key-definition edt-function)))))))