Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lanl!cmcl2!yale!Ram-Ashwin From: Ram-Ashwin@cs.yale.edu (Ashwin Ram) Newsgroups: comp.emacs Subject: Keyboard macros (was: Re: Copy From Above?) Message-ID: <50884@yale-celray.yale.UUCP> Date: 16 Feb 89 17:23:24 GMT References: <690026@hpsemc.HP.COM> <36077@bbn.COM> Sender: root@yale.UUCP Reply-To: Ram-Ashwin@cs.yale.edu (Ashwin Ram) Organization: Computer Science, Yale University, New Haven, CT 06520-2158 Lines: 27 In-reply-to: mesard@bbn.com (Wayne Mesard) In article <36077@bbn.COM>, mesard@bbn.com (Wayne Mesard) writes: > In article <690026@hpsemc.HP.COM> gph@hpsemc.HP.COM (Old run-down actor) writes: > >Can anyone tell me how I can get gnuemacs to (with one keystroke) copy > >the character on the line above the cursor to the current cursor > >position? > > For simple things like this, all you need is keyboard macros. [...] > To bind it to > another key, you must first name it with M-x name-last-kbd-macro. After > naming it you can insert it in, e.g., your ~/.emacs file, so it will be > available in later Emacs sessions. To do this use insert-kbd-macro. I wish there was a way of "decompiling" the macro, i.e., a function that inserted, not the raw keystrokes, but the names of the commands that those keytrokes were bound to. Keyboard macros are neat for simple things, but if you want to modify one you're out of luck. Another advantage of this is that it would be a good way to get a template of an editing function that you're planning to write, by using keystrokes to do what you want to do and then taking it from there. While we're on the subject of keyboard macros, is there a way to tell Emacs not to stop defining a macro when you do make an error? I hate it when I'm halfway through an enormously complicated keyboard macro and I have to do it all over again because I hit the wrong key. -- Ashwin.