davis@pacific.mps.ohio-state.edu ("John E. Davis") (09/09/90)
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