frede@hpwale.HP.COM (Fred Ehrhardt) (07/14/87)
I have an Emacs Lisp question, which I can't answer by examining the *.el files that came with Gnu 18.36, the version we're running. Since we're using HP terminals [big surprise], some of us want to use define-key to bind \eS to (scroll-down 1). Since several popular major modes (text-mode, nroff-mode) define this escape sequence as part of a local key map, we lose the original binding. Is there a way, in the mode *.el files, to prevent *conditionally* the re-binding of a key sequence, in the event that key is already bound? Such as [pardon my ELisp]: (if (not (is-bound "\eS")) (define-key etc.... This or more-elegant solutions gratefully accepted. Fred Ehrhardt HP-Waltham (MA)
matt@oddjob.UChicago.EDU (Matt Crawford) (07/15/87)
In article <760002@hpwale.HP.COM> frede@hpwale.HP.COM (Fred Ehrhardt) writes:
) Is there a way, in the mode *.el files, to prevent *conditionally* the
) re-binding of a key sequence, in the event that key is already bound?
) Such as [pardon my ELisp]:
) (if (not (is-bound "\eS"))
) (define-key etc....
I do this in my setup file for tvi-955 terminals:
;; move the old function of C-A
(define-key esc-map "I" (key-binding "\^A")) ; BACK TAB
(define-key global-map "\^A" 'funct-key)
It moves whatever the old definition of C-A is to M-I.
I have this in my text-mode-hook:
(let ((k (where-is-internal 'fill-paragraph nil t)))
(and k (global-set-key k 'fill-paragraph-cleverly)))
It replaces fill-paragraph with fill-paragraph-cleverly on the
first key it is found to be bound to.
You probably want to use:
(or (key-binding "\eS") (global-set-key "\eS" 'your-fun))
________________________________________________________
Matt University matt@oddjob.uchicago.edu
Crawford of Chicago {astrovax,ihnp4}!oddjob!matt