Path: utzoo!attcan!uunet!ncrlnk!ncr-sd!rancho!rock From: rock@rancho.uucp (Rock Kent) Newsgroups: comp.emacs Subject: Re: .emacs files... Message-ID: <1989Oct28.055720.25486@rancho.uucp> Date: 28 Oct 89 05:57:20 GMT References: <1989Oct25.162536.4854@cec1.wustl.edu> <11095@phoenix.Princeton.EDU> Organization: Del Rayo Ranch, San Diego, CA Lines: 65 In-Reply-To: sksircar@phoenix.Princeton.EDU's message of 26 Oct 89 16:20:54 GMT >>>>> On 26 Oct 89 16:20:54 GMT, sksircar@phoenix.Princeton.EDU >>>>> (Subrata Kumar Sircar) said: SKS> I am using GNU Emacs 18.50.2 on berkely-unix (Ultrix) and want to SKS> bind the function keys to new arguments. I came up with the SKS> following code, bound it into my .emacs file, and ran it... and SKS> nothing happened. SKS> (defvar fnkey-map (make-sparse-keymap) "Keymap for function keys") SKS> (define-key esc-map "[" fnkey-map) SKS> (define-key fnkey-map "11~" 'goto-line) ; F1 SKS> (define-key fnkey-map "12~" 'compile) ; F2 SKS> (define-key fnkey-map "13~" 'next-error); F3 Hmmm. I'm not sure, but I think that your definition of [ under esc-map is getting redefined after you set it. Here's why: - emasc begins by loading loadup.el which starts off the process of initiating an emacs session and right away loads loaddefs.el. - loaddefs.el defines esc-map and further defines esc-map "[" to be backward-paragraph. - loadup.el them starts a few things before getting to loading startup.el. - startup.el then sets some variables, takes care of any command-line arguments, loads the users $HOME/.emacs and THEN LOADS THE LIBRARY FOR THE TERMINAL TYPE. - the terminal library then defines some keys. vt100.el, for instance, defines "\e[" to be the prefix invoking CSI-map and then goes on the define keys in CSI-map --- thus smashing any definition made in the .emacs init file. Realizing that a user might want to set definitions and such AFTER the terminal initialization processing had been completed, the authors of emacs have provided us with term-setup-hook which is processed after the terminal specific library is loaded. I place the following in my .emacs to do some customization: (setq term-setup-hook 'term-setup-hook-procedures) (defun term-setup-hook-procedures () " The stuff I want to run after the terminals get installed." (enable-arrow-keys) (if (or (string= (getenv "TERM") "AT386") (string= (getenv "TERM") "at386") (string= (getenv "TERM") "root_at386")) (progn (global-set-key "\eOT" 'minkey) (global-set-key "\e\e[H" 'beginning-of-buffer) (global-set-key "\e\e[Y" 'end-of-buffer))) (if (or (string= (getenv "TERM") "pro_vt100") (string= (getenv "TERM") "PRO_VT100")) (progn (global-set-key "\eOt" 'minkey) (setq meta-flag t) (global-set-key "\e\e[H" 'beginning-of-buffer) (global-set-key "\e\e[K" 'end-of-buffer))) ) Hope this helps some . . . I'll keep my fingers crossed that I didn't head off on too much of a tangent or embarrass myself too much with my (miss-)understanding of emacs. *************************************************************************** *Rock Kent rock@rancho.uucp POB 8964, Rancho Sante Fe, CA. 92067* ***************************************************************************