Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site utah-gr.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!utah-cs!utah-gr!thomas From: thomas@utah-gr.UUCP (Spencer W. Thomas) Newsgroups: net.emacs Subject: Re: Mlisp Function Inquiry Message-ID: <1337@utah-gr.UUCP> Date: Fri, 8-Feb-85 15:42:32 EST Article-I.D.: utah-gr.1337 Posted: Fri Feb 8 15:42:32 1985 Date-Received: Sun, 10-Feb-85 04:00:51 EST References: <382@isrnix.UUCP> <3084@umcp-cs.UUCP> Reply-To: thomas@utah-gr.UUCP (Spencer W. Thomas) Organization: Univ of Utah CS Dept Lines: 48 Summary: In article <3084@umcp-cs.UUCP> chris@umcp-cs.UUCP (Chris Torek) writes: >First define "the last command". In a moded editor it is relatively clear >that the last command is the last single operation done while in command >mode; since Emacs is (mostly) modeless, this definition cannot apply. > >Spencer Thomas has an MLisp function (in C; i.e., it's a "wired function") >that returns the last 100 keystrokes, which could be used to construct a >command-repeating function, but I haven't yet come up with a really good >way to decide how much to repeat.... I've thought about this some, but never started to implement anything. Here are my thoughts so far: - It is probably the case that any sequence of self-inserting characters constitutes a "single command". - Should ^H (or rubout) be included in the above? - Also, probably any sequence of the same key repeated constitutes a single command (e.g. ^D^D^D^D). - Argument prefixes should be included in the command (so ^U^D is the same as above). - Cursor motion is probably not considered a "command" (so you can move to a new location, then execute repeat-command). - You have to be careful about command-prefixes (e.g., ^X, ESC, and any other keys that are bound to keymaps -- we have ^Z bound bound to a keymap, for example). - The real killer, though, is commands that read arguments by prompting in the minibuffer. I don't think you can easily determine, just by looking at what was typed, where the command begins. (^Q is another insidious one.) So, it begins to look as if just knowing the last N keystrokes is insufficient to determine the "last command". One could easily provide a facility to edit the string of keystrokes, then turn it into a keyboard macro, though. (Let human intelligence do the hard part.) Further discussion is welcomed (especially if it leads to a good solution of the problem). Another idea: perhaps something based on the "generate" facility would work better. (BTW - the last-N-keystrokes facility is really nice when you type something random, and you want to see what damage you might have done to your buffer.) -- =Spencer ({ihnp4,decvax}!utah-cs!thomas, thomas@utah-cs.ARPA) <<< "Humor is the poetry of ideas that do not match." - Leonard Feeney >>>