Path: utzoo!attcan!utgpu!utstat!jarvis.csri.toronto.edu!rutgers!mcnc!rti!talos!kjones From: kjones@talos.UUCP (Kyle Jones) Newsgroups: comp.emacs Subject: Re: execute-extended-for-dummys Message-ID: <546@talos.UUCP> Date: 30 May 89 20:26:57 GMT References: <1947@plx.UUCP> Organization: Philip Morris Research Center, Richmond, VA Lines: 32 Evan Bigall writes: > The idea is, that I frequently forget where I bound functions. Being > the lazy person I am, I always just Meta-X it, instead of doing a > where-is and then using the binding. Its a vicious circle, and > eventually I never remember the binding because I never use it. This > function which I bind to esc-x executes a command by name, and then > tells me where it was. > [ function omitted ] I like this idea! I can imagine execute-extended-command telling me the key bindings of commands I didn't even know were bound to keys. Here's a rewrite of Evan's function that: * handles prefix args * says nothing if the command is not bound to a key * tries to echo the keys that actually invoked it instead of blindly writing "M-x " (defun execute-extended-command (&optional command prefix-argument) (interactive (list (read-command (concat (key-description (this-command-keys)) " ")) current-prefix-arg )) (let (prefix-arg prefix-argument) (call-interactively command)) (if (and (interactive-p) (sit-for 1)) (let ((keys (append (where-is-internal command (current-local-map))))) (if keys (message "%s is on %s" command (mapconcat 'key-description keys " , ")))))) kyle jones ...!uunet!talos!kjones