evan@plx.UUCP (Evan Bigall) (05/26/89)
Only 6 lines, but I like it enough to share it (little things satisfy me) 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. A possible enhancement would be to make it refuse to execute somthing which has a binding. There is a bug, that it does not properly handle prefix arguments. I dont have the e-lisp manual or enough expericance to fix that, can anyone help? ;;;; cut here (defun execute-extended-for-dummys (fun) "Execute a command by name, then tell me where it was" (interactive "aM-x ") (command-execute fun) (where-is fun) ) ;;;; cut here -- Evan Bigall, Plexus Computers, San Jose, CA (408)943-2283 ...!sun!plx!evan "I barely have the authority to speak for myself, certainly not anybody else"
kjones@talos.UUCP (Kyle Jones) (05/31/89)
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 <kyle@cs.odu.edu> ...!uunet!talos!kjones