Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!think!barmar From: barmar@think.COM (Barry Margolin) Newsgroups: comp.emacs Subject: Re: User defined functions Message-ID: <7480@think.UUCP> Date: Wed, 12-Aug-87 15:22:49 EDT Article-I.D.: think.7480 Posted: Wed Aug 12 15:22:49 1987 Date-Received: Sat, 15-Aug-87 01:41:21 EDT References: <8708121417.AA19618@ucbvax.Berkeley.EDU> Sender: news@think.UUCP Reply-To: barmar@godot.think.com.UUCP (Barry Margolin) Distribution: world Organization: Thinking Machines Corporation, Cambridge, MA Lines: 40 In article <8708121417.AA19618@ucbvax.Berkeley.EDU> dsill@NSWC-OAS.ARPA (Dave Sill) writes: >I've been toying around with the idea of extending the macro concept. >What I envision is a facility whereby one could define a function in >the same manner as a macro. This function could be given an >associated name like any other Emacs command, e.g. daves-foo-command. >In addition, there should be a facility for saving these definitions >in a file. Multics Emacs has two things along these lines. One is the ability to save keyboard macros into a text file and later load the macro back into Emacs. You can also manually edit a macro this way (don't you hate it when you finish creating a keyboard macro and then realize that you forgot to make it go to the next line at the end, and have to redo it?). The other facility it has is a keyboard macro compiler. It takes a keyboard macro in a buffer and converts it to Lisp. It works by simply replacing each key with the corresponding (function) call. It doesn't work really well, though; for example, it translates the macro sequence ^X^F "filename" into (find-file) (insert-string "filename") because the compiler doesn't realize that "filename" is actually a parameter to find-file. It knows about a few special case (I think it knows about ^S, since that is used very frequently in macros). Another bug in the macro compiler is that it uses the key bindings in effect in the macro editing buffer, not the buffer where the macro was created. --- Barry Margolin Thinking Machines Corp. barmar@think.com seismo!think!barmar