ljdickey@water.UUCP (10/20/87)
I have been experimenting with three different versions of EMACS on my ST, one is called simply EMACS.PRG, one is called MG, and the third is called microEMACS and comes as a part of the Gulam shell. So far, I feel that I have not progressed very far on the learning curve. because I can not make any of them do much more than some primitive word processors. (I have used and written about two powerful programmable editors, and am looking for some of the same capabilities.) I have a few questions that maybe someone can help me with, please :-) . I know that I am revealing my ignorance here, but that is exactly what it is, ignorance. How can I read a file into an existing buffer? (This is what VI users do by typing the command ".r file".) How do I change in lines with "exp1", all instance of "exp2" to "text3". (This is what VI users by typing the command "1,$ g/exp1/ s/exp2/text3/". ) How do I define a macro when starting the editor? Can I define a macros from a text file after the editor is running? Thanks! -- L. J. Dickey, Faculty of Mathematics, University of Waterloo. ljdickey@watmath.UUCP UUCP: ...!uunet!watmath!ljdickey ljdickey%water@waterloo.edu ljdickey@watdcs.BITNET ljdickey%water%waterloo.csnet@csnet-relay.ARPA
nwd@j.cc.purdue.edu (Daniel Lawrence) (10/21/87)
In article <1180@water.waterloo.edu> ljdickey@water.waterloo.edu (Lee Dickey) writes: >I have been experimenting with three different versions of EMACS >on my ST, >one is called simply EMACS.PRG, one is called MG, and the third is >called microEMACS and comes as a part of the Gulam shell. > MG is Micro GNU Emacs, ie it is an emacs which is very compatable with GNU Emacs on many UNIX mainframes. EMACS.PRG is actually MicroEMACS 3.x (7 or 8 or 9) and is an extensive emacs with a macro language and a lot of features. All three of the above EMACS were originally derived from Dave Conroy's microEMACS (which is essentially what is inside GULAM) written in 1984/1985. >So far, I feel that I have not progressed very far on the learning curve. >because I can not make any of them do much more than some primitive >word processors. > >(I have used and written about two powerful programmable editors, and >am looking for some of the same capabilities.) > Since I have been programming MicroEMACS 3.x for a couple of years, I can only answer your questions for that one. >I have a few questions that maybe someone can help me with, please :-) . >I know that I am revealing my ignorance here, but that is exactly >what it is, ignorance. > > How can I read a file into an existing buffer? > (This is what VI users do by typing > the command ".r file".) > ^X ^I (insert-file) inserts a disk file into the current buffer at the location of the cursor. ^X ^R (read-file) reads a file into a buffer replacing its original contents ^X ^F (find-file) finds a file already in a buffer and switches to it, or creates a new buffer and reads the file in. > How do I change in lines with "exp1", all instance of "exp2" > to "text3". (This is what VI users by typing > the command "1,$ g/exp1/ s/exp2/text3/". ) > This one is difficult..... 30 store-macro set %savebuf $cbufname set %exp1 @"Selection string: " set %exp2 @"Search string: " set %text3 @"Replacement String: " *nexts search-forward %exp1 ;when this fails, the macro aborts... beginning-of-line 1 kill-to-end-of-line ;grab the line select-buffer "[temp]" ;stash it... yank beginning-of-file ;do the replacement (ignoring a failure) !force replace-string %exp2 %text3 beginning-of-file ;grab it again 1 kill-to-end-of-line select-buffer %savebuf ;and put it back yank ;we are now positioned at the next line !goto nexts !endm bind-to-key execute-macro-30 M-S ;bind this to Meta-S (too pick one) now the META-S keystroke will do what you ask from the current cursor in the current buffer to the end of that buffer. > How do I define a macro when starting the editor? > Place it in your emacs.rc file (or .emacsrc on UNIX or the AMIGA) > Can I define a macros from a text file after the editor > is running? > Yes, the execute-file command executes a file of macros A close look at the emacs.mss file that comes in the standard distribution package should answer most of your questions. >Thanks! > >-- > L. J. Dickey, Faculty of Mathematics, University of Waterloo. > ljdickey@watmath.UUCP UUCP: ...!uunet!watmath!ljdickey > ljdickey%water@waterloo.edu ljdickey@watdcs.BITNET > ljdickey%water%waterloo.csnet@csnet-relay.ARPA Daniel Lawrence (317) 742-5153 UUCP: {ihnp4!pur-ee!}j.cc.purdue.edu!nwd ARPA: nwd@j.cc.purdue.edu FIDO: 201/2 The Programmer's Room (317) 742-5533