Xref: utzoo gnu.emacs:3796 comp.emacs:9034 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!davis From: davis@pacific.mps.ohio-state.edu ("John E. Davis") Newsgroups: gnu.emacs,comp.emacs Subject: tricky elisp question?? Message-ID: Date: 9 Sep 90 00:43:29 GMT Sender: news@pacific.mps.ohio-state.edu Reply-To: davis@pacific.mps.ohio-state.edu (John E. Davis) Followup-To: gnu.emacs Organization: "Dept. of Physics, The Ohio State University" Lines: 30 Hi, Although I have been able to do simple things in emacs lisp I am now stuck with the following problem. I have a key bound to a function with the name, say, 'some_function'. Now I have another similar function called 'some-function'. What I want is a function called 'toggle-key' so that when I do 'M-x toggle-key' then enter the key, the key-definition toggles back and forth between the functions 'some-function' and 'some_function'. Note that I have about twenty functions of the form xxx-yyy-zzz and the same number of the form xxx_yyy_zzz. So the function 'toggle-key' will have to be very generic. ie, 1. find current function binding for key. 2. if the name of the function has -'s then rebind the key to the function with the same name but _'s changed to -'s and visa-versa. Note that -'s and _'s are never mixed. That is I do not have functions named xxx_yyy-zz. Also there are a varying number of -'s and _'s in the names as well as the length of the name (ie. x-y and xx-y-z). 3. rebind the key to the new function. Can this be done? Thanks again, -- John bitnet: davis@ohstpy internet: davis@pacific.mps.ohio-state.edu