Path: utzoo!mnetor!tmsoft!dptcdc!jarvis.csri.toronto.edu!mailrus!ames!ucsd!rutgers!cmcl2!yale!Ram-Ashwin From: Ram-Ashwin@cs.yale.edu (Ashwin Ram) Newsgroups: comp.emacs Subject: Re: How to define VT2xx or VT3xx function keys in .emacs file? Message-ID: <52705@yale-celray.yale.UUCP> Date: 4 Mar 89 16:38:51 GMT References: <36761@bbn.COM> Sender: root@yale.UUCP Reply-To: Ram-Ashwin@cs.yale.edu (Ashwin Ram) Organization: Computer Science, Yale University, New Haven, CT 06520-2158 Lines: 43 In-reply-to: DHASKIN@CLARKU.BITNET In article <36761@bbn.COM>, DHASKIN@CLARKU.BITNET writes: > I would like Emacs to start up with the Do key define as M-x > and Insert Here defined as yank. I have no problem doing it once I'm > *in* Emacs, with either global-set-key or: > > (define-key esc-map "[26~" 'execute-extended-command) > > but when I put the above line in my .emacs file, I get an "Error in Init > File" or some such thing when Emacs starts up. [Please try to specify the type and version of Emacs you're using when you report problems. I assume you're using GNU Emacs.] I think you're probably getting the error "key sequence [26~ uses illegal prefix characters". My guess is that the key sequence ESC-[ is already defined at the time the define-key is executed (I think it is bound to backward-paragraph or some such thing by default). You can't define-key a key sequence if some prefix of that key sequence is already bound to a command. The reason you don't get the error when you do it by hand is that you (or something you load) probably undefine ESC-[. Try executing the above form by hand in a fresh Emacs without loading your .emacs file and see if you get this error. Alternatively, do a (setq debug-on-error t) and try to get a backtrace. To fix the problem, move whatever undefines ESC-[ (or whatever the illegal prefix is) up in your file so that it is before whatever tries to use it as a prefix in a key sequence. In my opinion, this is a very misleading error message. Many people, including me, have been tripped up by this sort of error. I suggest that the error message be changed to "the prefix ESC [ is already bound to a command" or something similar. I also think that the "error in init file" situation is badly handled. Firstly, the error message should reflect what the error was. Secondly, Emacs should tell you where the error occurred, or better still visit the offending file and position itself at the point where the error was encountered. -- Ashwin.