Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.4 $; site duncan Path: utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!pucc-j!pucc-h!pur-phy!kran!duncan!authorplaceholder From: lawrence@duncan.UUCP Newsgroups: net.sources Subject: MicroEMACS 3.5 (1 of 7) Message-ID: <3300001@duncan> Date: Tue, 18-Mar-86 07:14:00 EST Article-I.D.: duncan.3300001 Posted: Tue Mar 18 07:14:00 1986 Date-Received: Wed, 26-Mar-86 04:10:33 EST Lines: 554 Nf-ID: #N:duncan:3300001:000:20047 Nf-From: duncan.UUCP!lawrence Mar 18 07:14:00 1986 Greetings, Not to confuse matters, but below is a posting of another version of MicroEMACS (3.5) which I have been working on for several months. It is a shell arcive file and as such should be split up on a UNIX system. If this causes problems for many, mail me and I can repost it differently. Read the README file for the new goodies, there are a lot. Also since I use this so heavaly on different machines I will be willing to maintain it. have fun! Dan Lawrence ihnp4!pur-ee!pur-phy!duncan!lawrence ----------------cut here-------------------------------------------- echo x - readme sed 's/^X//' >readme <<'*-*-END-of-readme-*-*' X MicroEMACS 3.5 X X This version of MicroEMACS is based on the version written by XDave G. Conroy, and latter modified by Steve Wilhite and George Jones. XMy thanks goes to them for writting such nice, well structured and Xdocumented code. It is nice to see that there are some people out there Xwho know how to program well. X X I intend to continue to maintain this version and will consider Xadding features and supported machines on request. Current hardware Xsupported includes: X X IBM-PC under PCDOS/MSDOS and many compatibles X Dec Rainbow X Commodore Amiga X Unix V7 X Unix and Multix BSD 4.2 X Hewlett Packard 150 and various upgrades X XFeatures added to MicroEMACS since version 2.0 include: X X- Meta repeat codes X X Striking the key followed by a numeric argument (possibly Xwith a leading minus sign) passes an argument down to a command which is Xusually used as a repeat count. This is similar to the ^U command, but Xthere is no default value. X X- Change in repositioning command X X The command to reposition the cursor now repositions it, by Xdefault, to the center of the current window, rather than the first line Xof the window. This I think is much more usefull and also consistant Xwith many other emacs'. X X- File writting message.... X X For those of us with big files, when you start a write of a file Xto disk, the message [Writing..] now appears. This is so we know the Xmachine is really still there. (Paranoids Ahead!) X X- Search strings now can have s in them X X It is very usefull to be able to have newlines in search and Xreplace strings. To do this, all text input to searching commands is now Xterminated by an . X X- Replace!!!!! X X Yes, now we can replace as well as search. There are two flavors Xof this command. R allows us to replace each occurence of a string Xwith another string from the current point to the end of the file. X ^R also queries us at each string to see if we want to replace it. XTyping a question mark here will display the options. X X- Yes/no responces X X no longer require (or want) a return typed after them. X X- Spawning X X Fixed up some MSDOS spawning messages. WARNING: If you have your Xswitchchar set to a '-' instead of a '/' Lattice C may have problems Xwhen yanking up a new command processer. It will use a line like XCOMMAND /C . You may have to rewrite this library function Xto get it to work on your system properly. X X- Suspend MicroEMACS X X Under Unix BSD 4.2 we now have code to put the editor into the Xbackground and return to the parent shell. This is initially bound to Xthe ^X D keys. X X- Function keys X X Under MSDOS on IBM-PCs and compatibles, the function keys and Xcursor arrows now do what one would expect them to. There is a new Xprefix in the editor to accodate this. (Look in MAIN.C for this) This Xcan be used to add function key support to most any machine by adding a Xsmall piece of code to reconize the keys in the getkey() routine in Xmain.c, and adding the new definitions to the ebind.h header file. For XMSDOS and the HP150, the describe-key command can be used to find out Xwhat the code for a particular key is. X X- Abort (^G) X X now prints out [Aborted] on the command line so you know what Xhappened. X X- Editor Modes X X Buffers now have modes associated with them. These modes can be Xset with the set-mode (^X M) and the delete-mode (^X ^M) commands. X X- CMODE mode X X When a file is read in with a .c or .h extention, CMODE is set Xfor that buffer. (This can also be manually set/deleted[see above]) In XCMODE, MicroEMACS attemts to be intelligent about doing automatic Xindentation for you. It will indent any line the same as the privious Xline unless the last line ended with a brace ({). Then it will indent an Xextra tab stop (which varies depending on how tabs are set). Any lines Xbegining with a close brace (}) will by undented one tab stop if possible. X X- WRAP mode X X This mode automatically wraps words onto the next line when the Xword extends beyond the current fill column. X X- VIEW mode X X This mode disables all commands that can change the current buffer. X X- EXACT mode X X Normally all searches are done ignoring case. With this mode Xset, only strings which exactly match the search string, including case, Xare matched. X X- GOTO line command X X The goto-line ( G) command will go to a specific line Xnumber of the file. For example to go to the 76th line of a file, type: X X 76 G X X- Rename buffer X X The command rename-buffer ( ^N) allows you to change the Xname of the current buffer. X X- Paragraph movement X X The forward-paragraph ( N) and previous-paragraph ( P) Xcommands allow movement from one paragraph to another. X X- nasty algorith fixed.... X X A rather nasty algorithm in the kill buffer processing got Xrewritten which ends up reducing the speed neeeded to wipe large areas Ximmensly. This may have appeared to lock up the machine on the older Xversions when a large wipe was attempted. X X- Header files rearranged X X ESTRUCT.H Structure and option declarations X EDEF.H Global and external variable declarations X EPATH.H Help and startup file paths X EFUNC.H Name binding table X EBIND.H Initial key binding tables X X- Paragraph filling!! X X The fill-paragraph ( Q) command reformats the current Xparagraph filling to the fill column as possible. Very handy.... X X- Long lines X X Lines longer than the screen now scroll right-left as you move Xthrough them. Seeing what your editing is a big improvement. X X- word move and deletes X X Due to massive demand by my users here, I have changed the way Xword move and delete work so that they are more consistant and usefull. XBut this change is configurable by changing the value of the NFWORD Xconstant in ESTRUCT.H X X- View flag on command line X X -v on the command line causes the editor to read a file in with XVIEW mode set on. -e (edit) is the opposite causing it to read in for Xediting (which is also the default). X X- Quick EXIT has done a quick change.... X X (sorry....) Quick-exit now writes out all changed buffers before Xexiting. X X- Very long file lines X X Very long lines (>255 chars) being read from a file now get Xwrapped on multiple lines (instead of simple refusing to read any more Xof the file as before) The user is warned about them with a message at Xthe end of the read. X X- Space not clearing messages X X Many of my users complained about the space not inserting itself Xafter a message (it just cleared the message line). This is now Xconfiguable in ESTRUCT.H X X- HELP commands! X X the describe-key (^X ?) command allows the user to type in one Xcommand and the editor echos back the command name bound to that key. XThe help ( ?) command grabs the top window (or splits if if not Xthere) and reads in the EMACS.HLP file. The list of places to look for Xthe help file are in EPATH.H X X- View file command X X View-file (^X ^V) is the same as find-file (old visit-file) Xexcept it leaves the found file in VIEW mode. X X- Improved updating X X On the systems that code has been written for, the screen update Xroutines will defer updating if there is type ahead present. This makes Xall movement commands much more pleasant. The code for this is in the Xfunction typahead() in TERMIO.C. This is currently implimented for XMSDOS, BSD4.2 and possible the AMIGA (Some one please check this out. I Xonly have limited access to an AMIGA) X X- Buffer lists X X are now alphabetically maintained. X X- Insert file X X Insert-file (^X ^I) allows you to insert the contents of a file Xat the current position of the current buffer. very useful X X- Scroll next window X X Scroll-next-down ( ^V) and scroll-next-up ( ^Z) allow Xyou to scroll the next window up and down by pages. X X- Arguments to searches X X All searches and replaces now take a preceding numeric argument Xto say how many times, rather than all the way to the bottom of the Xfile. X X- Binding keys X X The bind-to-key (^C) function allows you to change what Xcommand a key invokes. It will promt you for a command name, and then a Xkeystroke sequence. This is happy. Unbind-key ( ^C) allows you to Xmake a key now longer have a function. (This is good when you accidently Xbind or a letter to something) X X- Execute named command X X Will prompt you for a command name, and then execute it. This Xallows you to execute commands that are not currently bound to any keys. X X- Command name completion X X Any time you are prompted for a command, if you type in part of Xit and hit the space bar, the editor will try to finish it. If the bell Xrings, it means there is now command like what you are typing. X X- Describe bindings X X Describe-bindings (not bound) will display a list of all the Xcommands in a window (splitting if neccesary) and the keys bound with Xthem. These will reflect the current bindings and not the default ones. XThis is a good way to find out the name of a command you can't remember, Xor which I picked a bad name for. (The names have been changed to Xprotect the guilty (thats me) and are in EFUNC.H You too can change them Xif you are into it). X X- Executing stuff X X The execute-command-line command prompts you for a command line Xon the bottom of the screen in the form: X X {Numeric argument} { {}} X X (where {} are for optional stuff) and then executes it. X X Execute-buffer executes a number of these commands in a buffer. XIf any errors are found, the buffers current location will be set to the Xbegining of the line with the error in it. X X Execute-file will read a file into a buffer, execute it, and Xthen kill the buffer if it executed to completion with no errors. X X- Startup file X X MicroEMACS will attempt to execute a startup file (whose name is Xin EPATH.H) on startup. The MSDOS name is EMACS.RC and under unix it is Xusually .emacsrc X X- Multiple files on the command line X X MicroEMACS will now except a list of files on the command line. XThese files will all be assigned buffers, but will not be read in until Xthe buffer is brought up in a window. -v and -e switches affect all the Xfiles following them. X X- HP150 Function keys X X The function keys on the HP150 are now active and can be Xbound. This also works for the touchscreen areas. X X X- FILE LOCKING X X This is for people on multi-user UNIX systems. What this feature Xcan do is prevent two people from editing the same file and stomping on Xeach others edits. Unfortunatly, the actually locking mechanism used Xwhere I work is propritory so I could not send it out, but I have left Xall the code (conditionally defined by the FILOCK symbol in ESTRUCT.H) Xleading up to the actually locking routines so some one else can add it Xwith little effort. Here are the comments for the actual routines that Xneed to be added: X X/********************** X * X * dolock -- lock the file fname X * X * if successful, returns NULL X * if file locked, returns username of person locking the file X * if other error, returns "LOCK ERROR: explanation" X * X *********************/ X Xchar *dolock(fname) X Xchar *fname; /* file name to be locked */ X X Xand X X X/********************** X * X * undolock -- unlock the file fname X * X * if successful, returns NULL X * if other error, returns "LOCK ERROR: explanation" X * X *********************/ X Xchar *undolock(fname) X Xchar *fname; /* file name to unlock */ X X X If some one wants to write these functions so they can be Xdistributed publicly, please mail a separate file with them to me Xand I will include them with these sources for others to use. X X*************************** X X again, I thank the original authors of MicroEMACS for a good Xprogram that was a lot of fun to work on. I will maintain this version Xand expand it as long as there is any interest in it. Future additions Xwill probably include: X X -s on command line for alternative startup file X global default modes for buffers and a way to set/unset them X numbered kill buffers X fence matching for CMODE X sort region command X sentance movement and deletion commands X AMIGA function keys X X Send any ideas, suggestions or futher goodies to X Daniel Lawrence X ihnp4!pur-ee!pur-phy!duncan!lawrence X *-*-END-of-readme-*-* echo x - Makefile sed 's/^X//' >Makefile <<'*-*-END-of-Makefile-*-*' XCFLAGS= -O X XOFILES= ansi.o basic.o bind.o buffer.o display.o file.o \ X fileio.o hp150.o line.o lock.c main.o random.o region.o \ X search.o spawn.o tcap.o termio.o vt52.o window.o word.o X XCFILES= ansi.c basic.c bind.c buffer.c display.c file.c \ X fileio.c hp150.c line.c lock.c main.c random.c region.c \ X search.c spawn.c tcap.c termio.c vt52.c window.c word.c X XHFILES= estruct.h edef.h efunc.h epath.h ebind.h X Xemacs: $(OFILES) X $(CC) $(CFLAGS) $(OFILES) -ltermcap -lc -o emacs X X$(OFILES): $(HFILES) X Xinstall: X install -c -m 775 emacs /usr/local/emacs *-*-END-of-Makefile-*-* echo x - emacs.hlp sed 's/^X//' >emacs.hlp <<'*-*-END-of-emacs.hlp-*-*' X MicroEMACS 3.4 Help screens (03/03/86) X X M- means to use the key prior to using another key X ^A means to use the control key at the same time as the A key X X^V or [Pg Dn] Scroll down M-< or [HOME] Begining of file X^Z or [Pg Up] Scroll up M-> or [END] End of file X X----------------------------------------------------------------------- X (1) MOVING THE CURSOR X X^F Forward character M-F Forward word Keypad arrows X^B Backward character M-B Backward word are active! X^A Front of line X^E End of line X^N Next line M-N Front of paragraph X^P Previous line M-P End of paragraph X----------------------------------------------------------------------- X (2) SEARCHING X X^S Search forward from cursor position. Type in a string to be searched X for at the prompt and end it with ESC. Either case matches either X unless EXECT mode is set for the current buffer X X^R As above, but Reverse search from cursor position. X X----------------------------------------------------------------------- X (3) REPLACING X XM-R Replace all instances of first typed-in string with second X typed-in string. End each string with ESC. XM-^R Replace with query. Answer with: X ^G cancel . exit to entry point X ! replace the rest Y replace & continue X ? Get a list of options N no replacement & continue X----------------------------------------------------------------------- X (4) CAPITALIZING & TRANSPOSING X XM-U UPPERCASE word XM-C Capitalize word ^T Transpose characters XM-L lowercase word M-T Transpose words X^Q Quote next entry, so that control codes may be entered into text X X X----------------------------------------------------------------------- X (5) REGIONS & THE KILL BUFFER X XM- set MARK at current position X^X^X eXchange mark and cursor X XA REGION will then be continuously-defined as the area between the mark and Xthe current cursor position. The KILL BUFFER is the text which has been Xmost recently saved or deleted. X----------------------------------------------------------------------- X (6) DELETING & INSERTING X X<-- Delete previous character M-<-- Delete previous word X^D Delete next character M-D Delete next word X^K Close (delete) to end of line X^O Open (insert) line X^W Delete region between mark (set using M-) and cursor XM-W Copy region to kill buffer X----------------------------------------------------------------------- X (7) COPYING AND MOVING X X^W Delete (Wipe) region M-W copy region to KILL buffer X^Y Yankback save buffer at cursor XGenerally, the procedure for copying or moving text is: X 1) Mark a REGION using M- at beginning and cursor at end. X 2) Delete it (with ^W) or copy it (with M-W) into the KILL buffer. X 3) Move the cursor to the desired location and yank it back (with ^Y). X----------------------------------------------------------------------- X (8) MODES OF OPERATION X^X M Add Mode ^X ^M Delete Mode X X WRAP Turns on word wrap (automatic carraige return). X VIEW Allows viewing file without insertion and deletion. X EXACT All searches done with exact case matching X CMODE Automatic indenting for C program entry X (automatically set on any files ending with .C or .H) X----------------------------------------------------------------------- X (9) ON-SCREEN FORMATTING X X^X F Set fill column XMn- Set tab spacing to n charecters between tabs stops XM-Q Format paragraph so that text lies between margins X^X = Position report -- displays line number, char count, size X X X----------------------------------------------------------------------- X (10) MULTIPLE WINDOWS X XMany WINDOWS may be active at once on the screen. All windows may show Xdifferent parts of the same buffer, or each may display a different one. X X^X 2 Split the current window in two ^X 1 remove all but current window X^X O cursor to next window ^X ^ Enlarge current window XM-^V scroll down, other window M-^Z scroll up, other window X----------------------------------------------------------------------- X (11) MULTIPLE BUFFERS XA BUFFER is a named area containing a document being edited. Many buffers Xmay be activated at once. Each buffer has a name, which is typically the Xlowercased disk filename of the document it contains. X^X B Switch to another buffer. = use just-previous buffer X^X ^B Type buffer directory in a window X^X ^F Find file; read into a new buffer created from filename. X^X K Delete a non-displayed buffer. X----------------------------------------------------------------------- X (12) READING FROM DISK X X^X^F Find file; read into a new buffer created from filename. X (This is the usual way to begin editing a new file.) X^X^R Read file into current buffer, erasing its previous contents. X No new buffer will be created. X^X^I Insert file into current buffer at cursor's location. X^X^V Find a file to make current in VIEW mode X----------------------------------------------------------------------- X (13) SAVING TO DISK X X^X^S Save current buffer to disk, using the buffer's filename X as the name of the disk file. Any disk file of that name X will be overwritten. X^X^W Write current buffer to disk. Type in a new filename at the X prompt to write to; it will become the current buffer's filename. XM-Z Write out all changed buffers and exit MicroEMACS X----------------------------------------------------------------------- X (14) ACCESSING THE OPERATING SYSTEM X X^X! Send one command to the operating system and return X^XC Start a new command processer under MicroEMACS X^XD Suspend MicroEMACS into the background (UNIX BSD4.2 only) X^X^C Exit MicroEMACS XM-Z Write out all changed buffers and then Exit MicroEMACS X X----------------------------------------------------------------------- X (15) SPECIAL KEYS AND KEY BINDINGS X X^G Cancel current command and return to top level of processing. X^U or Universal repeat. May be followed by an integer (default = 4) XM- and repeats the next command that many times. XM-X Execute a named (and possibly unbound) command X^C Bind a key to a named command XDisplay-Bindings X List the current key bindings in a buffer *-*-END-of-emacs.hlp-*-* exit