nwd@j.cc.purdue.edu (Daniel Lawrence) (11/19/87)
# This is a shar archive. # Remove everything above this line. # Run the file through sh, not csh. # (type `sh med.1') # If you do not see the message # `med.1 completed!' # then the file was incomplete. echo extracting - amiga.rc sed 's/^X//' > amiga.rc << 'FRIDAY_NIGHT' X; EMACS.RC: Startup file for MicroEMACS 3.8 X; X; This file is executed everytime the X; editor is entered X Xset $discmd "FALSE" Xwrite-message "[Setting up....]" X X; If you screen "SNOWS", uncomment this line X; set $flicker "TRUE" X X; If you are on an IBM-PC EGA card and want to force the X; screen to EGA mode, uncomment the following line X; set $sres "EGA" X X; ***** Rebind the Function key group X Xbind-to-key search-forward FN0 Xbind-to-key search-reverse FN1 Xbind-to-key hunt-forward FN2 Xbind-to-key hunt-backward FN3 Xbind-to-key next-window FN4 Xbind-to-key execute-macro FN5 Xbind-to-key find-file FN6 Xbind-to-key execute-file FN7 Xbind-to-key save-file FN8 Xbind-to-key exit-emacs FN9 X Xbind-to-key apropos FNR Xbind-to-key describe-key FNS Xbind-to-key fill-paragraph FNT Xbind-to-key shell-command FNX Xbind-to-key i-shell FNY X X; set screen colors Xadd-global-mode "black" X X; toggle function key window off X1 store-macro X save-window X 1 next-window X !if &sequal "Function Keys" $cbufname X delete-window X !endif X bind-to-key execute-macro-14 FNP X!force restore-window X write-message "[Function key window OFF]" X!endm X X; toggle function key window back on X14 store-macro X 1 next-window X !if &sequal $cbufname "emacs.hlp" X execute-macro-11 X !endif X !if ¬ &sequal $cbufname "Function Keys" X 1 split-current-window X select-buffer "Function Keys" X add-mode "red" X!force 5 resize-window X beginning-of-file X !endif X bind-to-key execute-macro-1 FNP X 2 next-window X write-message "[Function key window ON]" X!endm X X; Enter Help X2 store-macro X 1 next-window ;Make sure the function key window isn't up! X !if &sequal $cbufname "Function Keys" X delete-window X bind-to-key execute-macro-14 FNP X !endif X help X 8 resize-window X bind-to-key execute-macro-12 FNT X bind-to-key execute-macro-13 FNS X bind-to-key execute-macro-11 FNQ X bind-to-key execute-macro-15 ^XO X bind-to-key execute-macro-15 ^XP X bind-to-key execute-macro-15 FN4 X add-mode "red" X beginning-of-file X 2 forward-character X clear-message-line X!endm X X; Exit Help X11 store-macro X bind-to-key previous-page FNT X bind-to-key next-page FNS X bind-to-key execute-macro-2 FNQ X bind-to-key next-window ^XO X bind-to-key previous-window ^XP X bind-to-key next-window FN4 X delete-window X clear-message-line X!endm X X; don't allow these commands from within the HELP screen X15 store-macro X write-message "[Use F2 to exit HELP]" X!endm X X; last help page X12 store-macro X beginning-of-line X search-reverse "=>" X 1 redraw-display X!endm X X; next help page X13 store-macro X beginning-of-line X 2 forward-character X search-forward "=>" X 1 redraw-display X!endm X X; reformat indented paragraph X X6 store-macro X write-message " [Fixing paragraph]" X set $discmd "FALSE" X kill-region X 2 split-current-window X select-buffer "[temp]" X yank X beginning-of-file X replace-string "~n " "~n" X 66 set-fill-column X fill-paragraph X 77 set-fill-column X beginning-of-file X handle-tab X replace-string ~n "~n " X end-of-file X 2 delete-previous-character X beginning-of-file X set-mark X end-of-file X kill-region X unmark-buffer X delete-window X yank X delete-buffer "[temp]" X set $discmd "TRUE" X write-message " [Fixed paragraph]" X!endm X X; indent region X X7 store-macro X write-message " [Indenting region]" X kill-region X 2 split-current-window X select-buffer "[temp]" X yank X beginning-of-file X handle-tab X replace-string "~n" "~n " X end-of-file X 4 delete-previous-character X beginning-of-file X set-mark X write-message " [Indenting region]" X end-of-file X kill-region X unmark-buffer X delete-window X yank X delete-buffer "[temp]" X write-message " [Region Indented]" X!endm X X; undent region X X8 store-macro X write-message " [Undenting region]" X kill-region X 2 split-current-window X select-buffer "[temp]" X yank X beginning-of-file X delete-next-character X replace-string "~n " "~n" X end-of-file X 2 delete-previous-character X beginning-of-file X set-mark X write-message " [Undenting region]" X end-of-file X kill-region X unmark-buffer X delete-window X yank X delete-buffer "[temp]" X write-message " [Region undented]" X!endm X X; bring up the function key window X X 1 split-current-window X select-buffer "Function Keys" X add-mode "red" X 5 resize-window X insert-string "f1 search f2 search back | F1 toggle function list F2 toggle help file~n" X insert-string "f3 hunt f4 hunt back | F3 find command/apropos F4 describe key~n" X insert-string "f5 next window f6 exec macro | F5 reformat paragraph F6 ref undented region~n" X insert-string "f7 find file f8 exec file | F7 indent region F8 undent region~n" X insert-string "f9 save file f10 exit emacs | F9 execute DOS command F10 shell up~n" X beginning-of-file X unmark-buffer X next-window X set $discmd "TRUE" X write-message "[Emacs is READY]" FRIDAY_NIGHT echo extracting - azmap.cmd sed 's/^X//' > azmap.cmd << 'FRIDAY_NIGHT' X; AZMAP.CMD: MicroEMACS Macro file X; to translate an AZTEC C .SYM map file into X; the form needed to read it into ADDSYMS X; to be used with Pheonix's PFIX plus (C) debugger X; X; written 6/5/86 by Daniel Lawrence X Xbeginning-of-file Xnewline Xprevious-line Xreplace-string "~n" "~n 0000:" Xbeginning-of-line Xkill-to-end-of-line Xnewline Xnewline Xnewline Xbeginning-of-file Xnewline Xinsert-string " Address Publics by Name" Xnewline Xset-mark Xend-of-file Xcase-region-upper Xbeginning-of-file Xreplace-string "_~n" "~n" X FRIDAY_NIGHT echo extracting - bdata.cmd sed 's/^X//' > bdata.cmd << 'FRIDAY_NIGHT' X;Create a block of DATA statements for a BASIC program X; within MicroEMACS 3.8 X X insert-string "1000 DATA " X set %linenum 1000 X X*nxtin X update-screen ;make sure we see the changes X set %data @"Next number[0 to end]: " X !if &equal %data 0 X !goto finish X !endif X X !if &greater $curcol 60 X 2 delete-previous-character X newline X set %linenum &add %linenum 10 X insert-string &cat %linenum " DATA " X !endif X X insert-string &cat %data ", " X !goto nxtin X X*finish X X 2 delete-previous-character X newline X X FRIDAY_NIGHT echo extracting - bpage.cmd sed 's/^X//' > bpage.cmd << 'FRIDAY_NIGHT' X; BPAGE.CMD: Box Macro and rectangualr region page X; for MicroEMACS 3.9d and above X; (C)opyright 1987 by Suresh Konda and Daniel M Lawrence X; Last Update: 11/02/87 X X; make sure the function key window is up X set %rcfkeys FALSE X execute-macro-1 X write-message "Loading..." X X; set the clean procedure up Xstore-procedure clean X delete-buffer "[Macro 10]" X delete-buffer "[Macro 11]" X delete-buffer "[Macro 12]" X delete-buffer "[getblock]" X delete-buffer "[putblock]" X delete-buffer "[Macro 13]" X delete-buffer "[Macro 14]" X delete-buffer "[Macro 15]" X delete-buffer "[Macro 16]" X delete-buffer "[Macro 17]" X delete-buffer "[Macro 18]" X delete-buffer "[Macro 19]" X delete-buffer "[drawbox]" X delete-buffer "[setpoints]" X delete-buffer "[horizontal]" X delete-buffer "[vertical]" X delete-buffer "[horline]" X delete-buffer "[vertline]" X delete-buffer "[delcol]" X delete-buffer "[iline]" X!endm X X; Write out the page instructions X save-window X 1 next-window X beginning-of-file X set $curcol 25 X overwrite-string " F1 Line type [DOUBLE] F2 kill block " X next-line X set $curcol 25 X overwrite-string " F3 draw box F4 copy block " X next-line X set $curcol 25 X overwrite-string " F5 insert line F6 yank block " X next-line X set $curcol 18 X overwrite-string "BOX " X set $curcol 25 X overwrite-string " F7 insert space F8 insert block " X next-line X set $curcol 25 X overwrite-string " " X unmark-buffer X beginning-of-file X !force restore-window X update-screen X X; this sets overwrite mode to off. to change it, set rcinsert to 1 Xset %rcinsert 0 X X; change line type X X10 store-macro X !if &equ %rcltype 1 X set %rcltype 2 X set %rctmp "DOUBLE" X !else X set %rcltype 1 X set %rctmp "SINGLE" X !endif X set %cbuf $cbufname X set %cline $cwline X select-buffer "Function Keys" X beginning-of-file X 1 goto-line X 40 forward-character X 6 delete-next-character X insert-string %rctmp X unmark-buffer X select-buffer %cbuf X %cline redraw-display X !return X!endm X X; Draw a box X X12 store-macro X !if &equal %rcltype 1 X set %c1 "Z" X set %c2 "D" X set %c3 "?" X set %c4 "@" X set %c5 "Y" X set %c6 "3" X !else X set %c1 "I" X set %c2 "M" X set %c3 ";" X set %c4 "H" X set %c5 "<" X set %c6 ":" X !endif X run drawbox X!endm X X; insert a line in a box X X14 store-macro X run iline X!endm X X; insert a blank line in a box X X16 store-macro X set %rctmp %rcltype X set %rcltype 0 X run iline X set %rcltype %rctmp X!endm X Xstore-procedure iline X run setpoints X !if &equal %pcol %mcol X run vertical X !else X !if &equal %pline %mline X run horizontal X !else X write-message "Illegal point and mark for lines" X !endif X !endif X!endm X Xstore-procedure setpoints X; procedure will set pcol, pline, mcol and mline. currently at point X set %pcol $curcol X set %pline $curline X exchange-point-and-mark X set %mcol $curcol X set %mline $curline X exchange-point-and-mark X!endm X Xstore-procedure drawbox X run setpoints X set $curline %mline X set $curcol %mcol X;draw top horizontal line X insert-string %c1 X; set %width &sub &sub %pcol %mcol 1 X set %width &sub %pcol %mcol X %width insert-string %c2 X insert-string %c3 X newline-and-indent X;draw bottom horizontal line X %pline goto-line X next-line X end-of-line X newline X set $curcol %mcol X insert-string %c4 X %width insert-string %c2 X insert-string %c5 X; bump pline X set %pline &add %pline 1 X;draw verticals -- go to top and work our way down X %mline goto-line X !while &less $curline %pline X next-line X detab-line X previous-line X end-of-line X !if &less $curcol %pcol X &sub %pcol $curcol insert-string " " X !endif X set $curcol %pcol X insert-string %c6 X set $curcol %mcol X insert-string %c6 X !endwhile X;return to point X %pline goto-line X next-line X beginning-of-line X %width forward-character X 2 forward-character X!endm X X; user procedure to draw a horizontal from mark to point making spaces for X; the characters. Xstore-procedure horizontal X set %s1 ":" X set %s2 "3" X !if &equal %rcltype 0 X; then insert blanks X set %c1 ":" X set %c2 "3" X set %c3 " " X set %c4 ":" X set %c5 "3" X set %c6 ":" X set %c7 "3" X !else X !if &equal %rcltype 1 X; then insert a single line X set %c1 "G" X set %c2 "C" X set %c3 "D" X set %c4 "W" X set %c5 "E" X set %c6 "6" X set %c7 "4" X !else X; then insert a double line X set %c1 "L" X set %c2 "F" X set %c3 "M" X set %c4 "N" X set %c5 "X" X set %c6 "9" X set %c7 "5" X !endif X !endif X run horline X!endm X Xstore-procedure vertical X set %s1 "M" X set %s2 "D" X !if &equal %rcltype 0 X set %c1 "M" X set %c2 "D" X set %c3 " " X set %c4 "M" X set %c5 "D" X set %c6 "M" X set %c7 "D" X !else X !if &equal %rcltype 1 X set %c1 "Q" X set %c2 "B" X set %c3 "3" X set %c4 "X" X set %c5 "E" X set %c6 "O" X set %c7 "A" X !else X set %c1 "K" X set %c2 "R" X set %c3 ":" X set %c4 "N" X set %c5 "W" X set %c6 "J" X set %c7 "P" X !endif X !endif X run verline X!endm X Xstore-procedure horline X; procedure to draw a line from beginning of line to point X !if &equal %mcol %pcol X !return X !endif X !if &less %pcol %mcol X; then point was to left of mark. exchange and reset variables X exchange-point-and-mark X run setpoints X !endif X !if %rcinsert X set $curcol %mcol X !else X end-of-line X newline X ; move to under mark X %mcol insert-string " " X !endif X; see if first char is a vertical line X previous-line X set %char &chr $curchar X next-line X %rcinsert delete-next-character X !if &sequal %char %s1 X insert-string %c1 X !else X !if &sequal %char %s2 X insert-string %c2 X !else X insert-string %c3 X !endif X !endif X; now for all chars but the last character i.e., char at point X !while &less $curcol %pcol X previous-line X set %char &chr $curchar X next-line X %rcinsert delete-next-character X !if &sequal %char %s1 X insert-string %c4 X !else X !if &sequal %char %s2 X insert-string %c5 X !else X insert-string %c3 X !endif X !endif X !endwhile X; see if last char is a vertical line X previous-line X set %char &chr $curchar X next-line X %rcinsert delete-next-character X !if &sequal %char %s1 X insert-string %c6 X !else X !if &sequal %char %s2 X insert-string %c7 X !else X insert-string %c3 X !endif X !endif X!endm X Xstore-procedure verline X; proc to draw vertical line from mark to point. mark should be above point. X !if &equal %mline %pline X !return X !endif X; if point was above mark exchange and reset variables X !if &less %pline %mline X exchange-point-and-mark X run setpoints X !endif X;top line X %mline goto-line X set $curcol %pcol X backward-character X set %char &chr $curchar X forward-character X %rcinsert delete-next-character X !if &sequal %char %s1 X insert-string %c1 X !else X !if &sequal %char %s2 X insert-string %c2 X !else X insert-string %c3 X !endif X !endif X;all but pline X !while &less $curline &sub %pline 1 X next-line X beginning-of-line X set $curcol %pcol X backward-character X set %char &chr $curchar X forward-character X %rcinsert delete-next-character X !if &sequal %char %s1 X insert-string %c4 X !else X !if &sequal %char %s2 X insert-string %c5 X !else X insert-string %c3 X !endif X !endif X !endwhile X; bottom line X next-line X beginning-of-line X set $curcol %pcol X backward-character X set %char &chr $curchar X forward-character X %rcinsert delete-next-character X !if &sequal %char %s1 X insert-string %c6 X !else X !if &sequal %char %s2 X insert-string %c7 X !else X insert-string %c3 X !endif X !endif X!endm X Xstore-procedure delcol X; proc to delete column. we will use the getblock procedure with the column of X; the point set to one beyond the column point X set-points X !if &equal %mcol %pcol X ; same columns X forward-character X run getblock X !return X !else X !if &equal %mline %pline X run getblock X !return X !endif X!endm X X; delete a rectangular block of text X X11 store-macro X set %bkcopy FALSE X run getblock X write-message "[Block deleted]" X!endm X X; copy a rectangular region X X13 store-macro X set %bkcopy TRUE X run getblock X write-message "[Block copied]" X!endm X X; yank a rectangular region X X15 store-macro X set %bkcopy TRUE X run putblock X!endm X X; insert a rectangular region X X17 store-macro X set %bkcopy FALSE X run putblock X!endm X Xstore-procedure getblock X ;set up needed variables X set $discmd FALSE X delete-buffer "[block]" X set %rcbuf $cbufname X set %cline $cwline X X ;save block boundries X set %endpos $curcol X set %endline $curline X exchange-point-and-mark X set %begpos $curcol X set %begline $curline X set %blwidth &sub %endpos %begpos X X ;detab the region X &add &sub %endline %begline 1 detab-line X X ;scan through the block X set $curline %begline X !while &less $curline &add %endline 1 X ;grab the part of this line needed X !force set $curcol %begpos X set-mark X !force set $curcol %endpos X kill-region X X ;bring it back if this is just a copy X !if %bkcopy X yank X !endif X X ;put the line in the block buffer X select-buffer "[block]" X yank X X ;and pad it if needed X !if &less $curcol %blwidth X &sub %blwidth $curcol insert-space X end-of-line X !endif X forward-character X X ;onward... X select-buffer %rcbuf X next-line X !endwhile X X ;unmark the block X select-buffer "[block]" X unmark-buffer X select-buffer %rcbuf X previous-line X %cline redraw-display X set $discmd TRUE X!endm X X; insert/overlay a rectangular block of text X Xstore-procedure putblock X ;set up needed variables X set $discmd FALSE X set %rcbuf $cbufname X set %cline $cwline X X ;save block boundries X set %begpos $curcol X set %begline $curline X X ;scan through the block X select-buffer "[block]" X beginning-of-file X set %endpos &add %begpos $lwidth X !while ¬ &equ $lwidth 0 X X ;pad the destination if it is needed X select-buffer %rcbuf X beginning-of-line X !if ¬ &equ $lwidth 0 X detab-line X previous-line X !endif X !force set $curcol %begpos X !if &less $curcol %begpos X &sub %begpos $curcol insert-space X end-of-line X !endif X X ;delete some stuff if this should overlay X !if %bkcopy X set-mark X !force set $curcol %endpos X kill-region X !endif X X ;grab the line from the block buffer X select-buffer "[block]" X beginning-of-line X set-mark X end-of-line X copy-region X forward-character X X ;put the line in the destination position X select-buffer %rcbuf X yank X next-line X X ;onward... X select-buffer "[block]" X !endwhile X X select-buffer %rcbuf X set $curline %begline X set $curcol %begpos X %cline redraw-display X set $discmd TRUE X!endm X X ; and init some variables X set %rcltype 2 X write-message "[Block mode loaded]" X FRIDAY_NIGHT echo extracting - emacs.hlp sed 's/^X//' > emacs.hlp << 'FRIDAY_NIGHT' X=> MicroEMACS 3.8 Help screens (01/18/87) X X M- means to use the <ESC> 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 M-G Goto a 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) DELETING & INSERTING X X<-- Delete previous character X^D or <DELETE> Delete next character X^C or <INSERT> Insert a space XM-<-- Delete previous word XM-D Delete next word X^K Close (delete) to end of line X----------------------------------------------------------------------- X=> (2a) MORE DELETING & INSERTING X X<RETURN> Insert a newline <TAB> Advance to next tab stop X^J Insert a newline and indent M-^W Delete paragraph X^O Open (insert) line X^W Delete region between mark (set using M-<spacebar>) and cursor XM-W Copy region to kill buffer X^X ^O Delete blank lines around cursor X----------------------------------------------------------------------- X=> (3) SEARCHING X X^S Search forward from cursor position. X^R Reverse search from cursor position. X^X S Forward incremental search X^X R Reverse incremental search X<ALT> S Search for the next occurence of the last string (IBM-PC only) X<ALT> R Search for the last occurence of the last string (IBM-PC only) X----------------------------------------------------------------------- X=> (4) 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=> (5) CAPITALIZING & TRANSPOSING X XM-U UPPERCASE word XM-C Capitalize word ^T Transpose characters XM-L lowercase word X^X ^L lowercase region X^X ^U uppercase region X^Q Quote next entry, so that control codes may be entered into text X----------------------------------------------------------------------- X=> (6) REGIONS & THE KILL BUFFER X XM-<spacebar> 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=> (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-<spacebar> 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 in buffer M-M Add global mode X^X ^M Delete mode in buffer M-^M Delete global mode XOVER Replaces (overwrites) rather than inserts characters XWRAP Turns on word wrap (automatic carraige return). XVIEW Allows viewing file without insertion and deletion. XCMODE Automatic indenting for C program entry XEXACT/MAGIC Changes how search and replace commands work (see next page) X----------------------------------------------------------------------- X=> (9) SEARCH AND REPLACE MODES X XEXACT Uppper/lower case is not ignored in searches XMAGIC Regular pattern matching characters are active X . Matches any one character X * Matches any any number of the preceding character X ^ Beginning of line [ ] Character class enclosure X $ End of line \ Quote next character X----------------------------------------------------------------------- X=> (10) ON-SCREEN FORMATTING X X^X F Set fill column XMn-<tab> 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, X file size and character under cursor XM-^C Count words/lines/chars in marked region X----------------------------------------------------------------------- X=> (11) 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 2 Split the current window in two ^X O Change to next window X^X 0 delete current window ^X P Change to previous window X^X 1 delete all other windows M-^V Page down next window X M-^Z Page up other window X----------------------------------------------------------------------- X=> (12) CONTROLLING WINDOWS AND THE SCREEN X X^X ^ Enlarge current window M-<n> ^X W Resize window to <n> lines X^X ^Z Shrink current window M-<n> M-S Change screen to <n> lines X^X ^N Move window down M-<n> M-T Change screen to <n> columns X^X ^P Move window up XM-^L Reposition window X^L Refresh the screen X----------------------------------------------------------------------- X=> (13) MULTIPLE BUFFERS XA BUFFER is a named area containing a document being edited. Many buffers Xmay be activated at once. X^X B Switch to another buffer. <CR> = use just-previous buffer X^X X Switch to next buffer in buffer list XM-^N Change name of current buffer X^X K Delete a non-displayed buffer. X^X ^B Display buffer directory in a window X----------------------------------------------------------------------- X=> (14) 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=> (15) SAVING TO DISK X X^X ^S Save current buffer to disk X^X ^W Write current buffer to disk X^X N Change file name of current buffer XM-Z Write out all changed buffers and exit MicroEMACS X X X----------------------------------------------------------------------- X=> (16) ACCESSING THE OPERATING SYSTEM X X^X ! Send one command to the operating system and return X^X @ Pipe DOS command results to buffer X^X # Filter buffer through DOS filter program X^X C Start a new command processor under MicroEMACS X^X D Suspend MicroEMACS into the background (UNIX BSD4.2 only) X^X ^C Exit MicroEMACS X----------------------------------------------------------------------- X=> (17) KEY BINDINGS AND COMMANDS X XM-K Bind a key to a command M-A Describe a class of commands XM-^K Unbind a key from a command X^X ? Describe command bound to a key XM-X Execute a named (and possibly unbound) command X{Describe-bindings} X Display a list of all commands and key bindings to a buffer X----------------------------------------------------------------------- X=> (18) COMMAND EXECUTION XCommands can be specified as command lines in the form: X <optional repeat count> {command-name} <optional arguments> X{Execute-command-line} execute a typed in command line X{Execute-buffer} executes commands lines in a buffer X{Execute-file} executes command lines from a file X{clear-message-line} clears the message line during execution X M-~ clears the change flag for a buffer X----------------------------------------------------------------------- X=> (19) MACRO EXECUTION X X^X ( Start recording keyboard macro X^X ) Stop recording keyboard macro X^X E Execute keyboard macro XM-<n> {store-macro} Start recording named macro X !endm Stop recording named macro X{execute-macro-n} Execute macro n (where n is from 1 to 20) X----------------------------------------------------------------------- X=> (20) SPECIAL KEYS 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-<digit> and repeats the next command that many times. XM-X Execute a named (and possibly unbound) command X X FRIDAY_NIGHT echo extracting - emacs.rc sed 's/^X//' > emacs.rc << 'FRIDAY_NIGHT' X; EMACS.RC: Standard micro Startup program X; for MicroEMACS 3.9d and above X; (C)opyright 1987 by Daniel M Lawrence X; Last Update: 10/20/87 X Xset $discmd FALSE Xwrite-message "[Setting up....]" X X; If you screen "SNOWS", uncomment this line X; set $flicker "TRUE" X X; To use an IBM-PC EGA card, uncomment the following line X; set $sres "EGA" X X; ***** Rebind the Function key group X Xbind-to-key search-forward FN; Xbind-to-key search-reverse FN< Xbind-to-key hunt-forward FN= Xbind-to-key hunt-backward FN> Xbind-to-key execute-macro-1 FN? Xbind-to-key execute-macro-2 FN@ Xbind-to-key next-window FNA Xbind-to-key execute-macro-3 FNB Xbind-to-key save-file FNC Xbind-to-key exit-emacs FND X Xbind-to-key execute-macro-10 FNT Xbind-to-key execute-macro-11 FNU Xbind-to-key execute-macro-12 FNV Xbind-to-key execute-macro-13 FNW Xbind-to-key execute-macro-14 FNX Xbind-to-key execute-macro-15 FNY Xbind-to-key execute-macro-16 FNZ Xbind-to-key execute-macro-17 FN[ Xbind-to-key execute-macro-18 FN\ Xbind-to-key execute-macro-19 FN] X X; Set Default Global modes X Xadd-global-mode "blue" X;bind-to-key meta-prefix ` X X; Toggle function key window display X X1 store-macro X !if %rcfkeys X !goto rcfoff X !endif X X; toggle function key window on X save-window X 1 next-window X !if &sequal $cbufname "emacs.hlp" X delete-window X !endif X !if ¬ &sequal $cbufname "Function Keys" X 1 split-current-window X select-buffer "Function Keys" X add-mode "red" X !force 5 resize-window X 1 goto-line X !endif X set %rcfkeys TRUE X !force restore-window X !if &sequal $cbufname "Function Keys" X next-window X !endif X write-message "[Function key window ON]" X !return X X ;Toggle the function key window off X*rcfoff X save-window X 1 next-window X !if &sequal "Function Keys" $cbufname X delete-window X !endif X !force restore-window X write-message "[Function key window OFF]" X set %rcfkeys FALSE X!endm X X; Toggle HELP file onscreen X X2 store-macro X 1 next-window X X ;Make sure the function key window isn't up! X !if &sequal $cbufname "Function Keys" X delete-window X !endif X set %rcfkeys FALSE X X ;Bring up page 1 X !if ¬ &seq $cbufname "emacs.hlp" X help X 8 resize-window X add-mode "red" X beginning-of-file X 2 forward-character X !endif X X*rchelp X X write-message "[PgUp/PgDn] Page [FN6] EXIT ^G Exit leaving page on screen" X update-screen X set %rctmp >key X !if &equ &asc %rctmp 0 X set %rctmp >key X !if &seq %rctmp I X beginning-of-line X !force search-reverse "=>" X 1 redraw-display X !goto rchelp X !endif X !if &seq %rctmp Q X beginning-of-line X 2 forward-character X !force search-forward "=>" X 1 redraw-display X !goto rchelp X !endif X !if &seq %rctmp "~@" X delete-window X !if &seq %rcfkeys TRUE X set %rcfkeys FALSE X execute-macro-1 X !endif X write-message "[Help Exited]" X !return X !endif X !endif X !if &equ &asc %rctmp 7 X next-window X set %rcfkeys FALSE X write-message "[Help Aborted]" X !return X !endif X !goto rchelp X!endm X X; Load a new page X X3 store-macro X !if &seq &find newpage.cmd "" X write-message "[Can not find NEWPAGE.CMD]" X !return X !endif X execute-file newpage.cmd X!endm X X;procedure to clean out the current page (which is nothing right now) X Xstore-procedure clean X ; nothing by default X!endm X X; Set up auto CMODE X X20 store-macro X set %rctmp &sin $cfname "." X !if &equ %rctmp 0 X !return X !endif X set %rctmp &mid $cfname &add %rctmp 1 5 X !if &or &seq %rctmp "c" &seq %rctmp "h" X add-mode "cmode" X !endif X!endm Xbind-to-key execute-macro-20 M-FNR X X; bring up the function key window X X 1 split-current-window X select-buffer "Function Keys" X insert-string "f1 search-> f2 <-search [ MicroEMACS: Text Editor~n" X insert-string "f3 hunt-> f4 <-hunt [ ~n" X insert-string "f5 fkeys f6 help [ Available function key Pages include:~n" X insert-string "f7 nxt wind f8 pg[ ] [ WORD PROG BOX~n" X insert-string "f9 save f10 exit [ [use the f8 key to load Pages]~n" X unmark-buffer X delete-window X set %rcfkeys FALSE X execute-macro-1 X set $discmd TRUE FRIDAY_NIGHT echo med.1 completed! # That's all folks!
nwd@j.cc.purdue.edu (Daniel Lawrence) (11/19/87)
# This is a shar archive. # Remove everything above this line. # Run the file through sh, not csh. # (type `sh med.2') # If you do not see the message # `med.2 completed!' # then the file was incomplete. echo extracting - emacs.tut sed 's/^X//' > emacs.tut << 'FRIDAY_NIGHT' XYou are looking at the MicroEMACS tutorial. Comments on this document may Xbe referred to Daniel Lawrence. X XNOTE: This tutorial attempts to help you "learn by doing". The characters X ">>" at the left margin of your screen indicate directions for you to X try using a command. X XEMACS commands generally involve the CONTROL key (sometimes labelled CTRL Xor CTL) or the META key (generally labelled ESCAPE). Rather than write out XCONTROL or META each time we want you to prefix a character, we'll use the Xfollowing abbreviations: X X ^<chr> Hold the CONTROL key while pressing the character <chr>. X Thus, ^F would be: hold the CONTROL key and press F. X X>> Now type ^V (View Next Screen) to move to the next screen. X Remember: hold the CONTROL key and press V. X X ESC-<chr> Press the ESCAPE key and release it, then press the X character <chr>. Note: The command will have the X same meaning for upper or lower case characters (<chr>). X XIMPORTANT NOTE: If you must exit at some point, type ^X^C. X XFor the time being, you'll be expected to type ^V whenever you finish reading Xthe current screen. X XNote that there is an overlap when going from screen to screen; this provides Xsome continuity when moving through the file. X XThe first thing that you need to know is how to move around from place to Xplace in the file. You already know how to move forward a screen with ^V. XTo move back a screen, type ^Z. X X>> Try typing ^Z and then ^V to move back and forth between screens a few X times. X X XSUMMARY X------- X XThe following commands are useful for viewing screens: X X ^V Move forward one screen X ^Z Move back one screen X ESC-^L Clear screen and redisplay everything, putting the text X near the cursor at the center of the screen. X X>> Find the cursor and remember what text is near it. Type an ESC-^L. X Find the cursor again and see what text is near it now. X X XBASIC CURSOR CONTROL X-------------------- X XGetting from screen to screen is useful, but how do you reposition yourself Xwithin a given screen to a specific place? There are several ways you can Xdo this. One way (not the best, but the most basic) is to use the commands Xprevious, backward, forward and next. As you can imagine these commands X(which are given to EMACS as ^P, ^B, ^F, and ^N respectively) move the Xcursor from where it currently is to a new place in the given direction. XHere, in a more graphical form, are the commands: X X Previous line, ^P X : X : X Backward, ^B .... Current cursor position .... Forward, ^F X : X : X Next line, ^N X XYou'll probably find it easy to think of these by letter. P for previous, XN for next, B for backward and F for forward. These are the basic cursor Xpositioning commands and you'll be using them ALL the time so it would be Xof great benefit if you learn them now. X X>> Do a few ^N's to bring the cursor down to this line. X X>> Move into the line with ^F's and then up with several ^P's. Note what X ^P does when the cursor is in the middle of the line. X X>> Try ^B at the beginning of a line. Note what happened to the cursor. X Do a few more ^B's. Then do ^F's back to the end of the line and beyond. X XWhen you go off the top or bottom of the screen, the text beyond the edge is Xshifted onto the screen so that your instructions can be carried out while Xkeeping the cursor on the screen. X X>> Move the cursor off the bottom of the screen with ^N's and see what X happens. Note the new position of the cursor. X XIf moving by characters is too slow, you can move by words. ESC-F moves Xforward a word and ESC-B moves back a word. X X>> Type a few ESC-F's and ESC-B's. Intersperse them with ^F's and ^B's. X XNotice the parallel between ^F and ^B on the one hand, and ESC-F and ESC-B on Xthe other hand. Very often META characters are used for operations related Xto English text whereas CONTROL characters operate on the basic textual units Xthat are independent of what you are editing (characters, lines, etc.). X XTwo other commands which are useful are ^A and ^E. These commands move the Xcursor to the beginning (^A) and the end (^E) of the line. X X>> Try a couple of ^A's, and then a couple of ^E's. Note that the cursor X does not move when either of these commands is repeated continuously. X XTwo other simple cursor motion commands are ESC-< (less than), which moves Xto the beginning of the file, and ESC-> (greater than), which moves to the Xend of the file. If you need the shift key to type a "<", then you must Xalso use the shift key to type ESC-<. Otherwise, you would be typing ESC-, . X XThe location of the cursor within the text is also called "point". To Xparaphrase, the cursor shows on the screen where point is located in the Xtext. X XHere is a summary of simple moving operations, including the word and Xline moving commands: X X ^F Move forward a character X ^B Move back a character X X ESC-F Move forward a word X ESC-B Move back a word X X ^N Move to next line X ^P Move to previous line X X ESC-N Move to next paragraph X ESC-P Move to previous paragraph X X ^A Move to beginning of line X ^E Move to end of line X X ESC-< Go to beginning of file X ESC-> Go to end of file X X>> Try all of these commands now a few times for practice as these are X the most often used commands. Since the last two will take you away X from this screen, use ^V's and ^Z's to return here. X XLike all other commands in EMACS, these commands can be given arguments Xwhich cause them to be executed repeatedly. The way you give a command Xa repeat count is by pressing META (ESC) and then the number before you Xenter the command. As a special case, typing ^U is equivalent to ESC-4. X XFor instance, ESC-8 ^F moves forward eight characters. X X>> Try giving a suitable argument to ^N or ^P to come as close as you X can to this line in one jump. X XThis also applies to the screen moving commands, ^V and ^Z. When given Xan argument, they scroll the screen up or down by that many screens. X X>> Try typing ESC-3 ^V now. X XIf you would like to scroll up, you can give an argument to ^Z. X X XABORTING COMMANDS X----------------- X XThe EMACS command used to abort any command which requests input is X^G. For example, you can use ^G to discard a numeric argument or at Xthe beginning of a command that you don't want to finish. X X>> Type ESC-100 to make a numeric argument of 100, then type ^G. X Now type ^F. How many characters does it move? If you have X typed an ESC by mistake, you can get rid of it with ^G^G. X X XERRORS X------ XSometimes you may do something which EMACS doesn't allow. If it is Xsomething simple, such as typing a CONTROL key sequence which is not Xassociated with any command, EMACS will just beep at you. Otherwise, XEMACS will also display an informative error message at the bottom of Xthe screen. X XSome versions of EMACS do not have all the features described in this Xtutorial implemented yet. If you come across such an unimplemented Xfeature, you may get an error message when you try to use it. Just Xpress any cursor movement key and proceed to the next section of the Xtutorial. X X XNOTE: Several of the exercises in the following sections allow you to use X options which will make changes to this tutorial. Do no worry about X these changes affecting the tutorial - this is only a copy of the X master tutorial and you will not be instructed to save the changes X made to it. X X XCURSOR KEYS X----------- X XThe cursor keypad, usually located on the right side of the keyboard, Xhas been bound to some of the more useful screen movement commands. XThe mappings are as follows: X X Cursor-Right ^F Move forward a character X Cursor-Left ^B Move back a character X X X ^Cursor-Right ESC-F Move forward a word X ^Cursor-Left ESC-B Move back a word X X X Cursor-Down ^N Move to next line X Cursor-Up ^P Move to previous line X X X Pg-Dn ^V Move to next screen X Pg-Up ^Z Move to previous screen X X X Home ESC-< Go to beginning of file X End ESC-> Go to end of file X X X Insert ^C Insert single space X Delete ^D Delete current character X XA map of the keypad layout looks something like this: X X ------------------------------------------------- X | 7 | 8 | 9 | X | Home | ^ | Pg Up | X | ESC-< | | ^P | ^Z | X ------------------------------------------------- X | 4 | 5 | 6 | X | <-- ^B | | --> ^F | X ------------------------------------------------- X | 1 | 2 | 3 | X | End | | | Pg Dn | X | ESC-> | v ^N | ^V | X ------------------------------------------------------------- X | 0 | . | X | Insert ^C | Delete ^D | X ------------------------------------------------------------- X X>> Practice using the cursor keypad. X X XMODE LINE X--------- X XThe line above the function key display at the bottom of the screen Xis referred to as the "communication line". This is where EMACS Xinteractively communicates with you. Later you will see how EMACS Xprompts you for information on this line, such as to initiate a Xsearch. EMACS can report things to you on this line as well. X X>> Type ^X= and see what appears in the communication line. Don't worry X about what all this information means - it is just an example of how X EMACS lets you know more about the file you are editing. X XThe line immediately above the communication line is referred to as the X"mode line". The mode line looks something like X X=* MicroEMACS 3.7 () == emacs.tut == File: emacs.tut =========================== X XThis is a very useful "information" line. X X - The asterisk (star) indicates that changes have been made to the file. X Immediately after opening or saving a file, there is no star. X X - Any words inside the parentheses indicate the "modes" EMACS is X currently in. Modes will be discussed in the next section. X X - The string following the () is the buffername, i.e., the name EMACS X gives to the buffer, and it is usually related to the filename. X X - The string following "File:" is the name of the file you are X currently editing. X X>> Look at the mode line and identify the items discussed above. X X XMODES X----- X XListed within the parentheses are the "modes" which are associated with Xthe current buffer. Modes are a feature of EMACS which assist in the Xediting of different languages, i.e., C, and text. Presently, there are Xno modes associated with this buffer. This means EMACS will do exactly Xwhat you think it will when using it - no "bonuses". You can find out Xmore about the current buffer and mode status by typing ^X^B. Refer to Xthe EMACS manual for a further discussion of buffers and modes. X XAs you become more familiar with EMACS and the use of buffers, "mode" Xtakes on additional meaning. When more than one buffer is in use, a Xmode is referred to as "local" or "global". These terms indicate how a Xmode will affect the current buffer and other existing or to be added Xbuffers. X XA "local" mode is valid only within the scope of the current buffer. XOther existing buffers and buffers which will be added are not affected Xby local modes. X XThe commands to add and delete local modes are X X ^XM Add a local mode X ^X^M Delete a local mode X XEach of the above commands will prompt you for a mode. To activate X(deactivate) a mode, type the name of a valid (active) mode (refer to XEMACS manual for a complete list of the valid modes) and follow it by Xpressing <Return>, the carriage-return key. X X>> Type ^XM WRAP - note the change in the mode line. Move the cursor X to a blank line on this screen and begin typing the sequence "asdf ". X Continue typing this sequence and note what happens when the right X margin is encountered. X XThe previous exercise allowed you to enter text with the "WRAP" mode Xactive. As you can see, "WRAP" instructs EMACS to break between words Xwhen a line gets too long. However, in order for this mode to be Xeffective, spaces must be inserted between words. X XThe right margin is usually set at 72 characters but it can be changed. XTo change the margin type ESC nn ^XF where "nn" is the column number of Xthe new right-hand margin. X X>> Type ESC 40 ^XF. Then begin typing "asdf " and notice where the X line now breaks. To return to the default right-hand margin, type X ESC 72 ^XF. X X>> Type ^X^M WRAP to "turn off" the local mode "WRAP". X XA "global" mode affects only those buffers which will be ADDED after the X"add/delete global mode" command is executed - not the current or other Xexisting buffers. Currently there is no global mode set. X XThe commands to add and delete global modes are X X ESC-M Add a global mode X ESC-^M Delete a global mode X XNote: All modes can be local. However, global modes allow you to X activate those modes which usually apply to most of the buffers X in use. X XAs with local modes, each of the above commands will prompt you for Xa mode. To activate (deactivate) a mode, enter the name of a valid X(active) mode. X X>> Type ESC-M OVER. This mode tells EMACS to write over the text on X the current line. Is there any change in the mode line? Now move to X the line of "asdf " you entered and start typing. Note that nothing X happens. Remember that global modes affect only those modes which X will be added - not those already existing. X X>> Type ESC-^M OVER to "turn off" the global overwrite mode. X X XINSERTING AND DELETING X---------------------- X XIf you want to type text, just start typing. Characters which you Xcan see, such as A, 7, *, etc. are taken by EMACS as text and are Ximmediately inserted. Type <Return> to insert a line separator, Xi.e., a single linefeed character. X XYou can delete the last character you typed by typing either <Delete> Xor ^H. On some keyboards, there is a dedicated key for creating a ^H. XIf so, it is usually labelled as either "Backspace" or "<--". <Delete> Xis a key on the keyboard, which may be labelled "Rubout" instead of X"Delete" on some terminals. More generally, <Delete> deletes the Xcharacter immediately before the current cursor position. X X>> Now type a few characters and then delete them by typing <Delete> X a few times. X X>> Now start typing text until you reach the right margin, then continue X to type. When a line of text gets too big for one line on the screen, X the line of text is "continued" off the edge of the screen. The dollar X sign at the right margin indicates a line which has been continued. X EMACS scrolls the line over so you can see what you are editing. The X "$" at the left or right edge of the screen indicates that the current X line extends off in that direction. X XThis concept is easier to understand by doing rather than by reading about Xit so it is suggested that the following exercises be done. X X>> The following line actually goes off the edge. Try typing enough ESC-F's X so that you move off the right hand end of this line. This is a long line of text. Note the "$" at each edge. Keep typing ESC-F's and watch where EMACS decides to scroll the line. Now, type ESC-B's until EMACS decides to scroll the line again. X X>> Go to the line you entered which the text continued off the edge of X the screen. Use ^D's to delete the text until the text line fits on X one screen line again. The continuation "$" will go away. X X>> Move the cursor to the beginning of a line and type <Delete>. This X deletes the line separator before the line and merges the line onto X the previous line. The resulting line may be too long to fit on the X screen, in which case it has a continuation indicator. X X>> Press <Return> to insert the separator again. X XInternally, EMACS will allow you to have lines of nearly any length, limited Xonly by the amount of memory available. Externally, however, EMACS can only Xread or write lines, to or from a file, which are less than or equal to 255 Xcharacters. X XRemember that most EMACS commands can be given a repeat count. Note that Xthis includes characters which insert themselves. X X>> Try that now -- type ESC-8 * and see what happens. X XIf you want to insert spaces in a line, type ^C. X X>> Move to a line and move the cursor with ^F's; then insert spaces with ^C. X Use ^D to remove the spaces. X XIf you want to create a blank line between two lines, move to the second Xof the two lines and type ^O. X X>> Try moving to a line and typing ^O now. X XYou've now learned the most basic way of typing something in EMACS and Xcorrecting errors. You can delete characters, words or lines as well. XHere is a summary of the delete operations: X X <Delete> Delete the character just before the cursor X ^H Delete the character just before the cursor X ^D Delete the character the cursor is under X X ESC-<Delete> Kill the word immediately before the cursor X ESC-^H Kill the word immediately before the cursor X ESC-D Kill the word from the cursor position X X ^K Kill from the cursor position to end of line X XNotice that <Delete> and ^D vs ESC-<Delete> and ESC-D extend the parallel Xstarted by ^F and ESC-F (well, <Delete> isn't really a control character, Xbut let's not worry about that). X XNow suppose you kill something, and then you decide that you want to get Xit back? Well, whenever you kill something bigger than a character, EMACS Xsaves it for you. To yank it back, use ^Y. Note that you don't have to Xbe in the same place to do ^Y. This is a good way to move text around. XAlso note the difference between "Killing" and "Deleting" - "Killed" text Xcan be yanked back, and "Deleted" text cannot. Generally, the commands Xthat can destroy a lot of text save it, while the ones that attack only Xone character do not save it. X X>> Type ^N a couple times to position the cursor at some line on this X screen. Now kill that line with ^K. X XNote that a single ^K kills the contents of the line, and a second ^K Xkills the line itself, and makes all the other lines move up. If you Xgive ^K a repeat count, it kills that many lines AND their contents. X XThe text that has just disappeared is saved so that you can retrieve it. XTo retrieve the last killed text and put it where the cursor currently Xis, type ^Y. X X>> Try it. Type ^Y to yank the text back. X XThink of ^Y as if you were yanking something back that someone took away Xfrom you. Notice that if you do several ^K's in a row the text that is Xkilled is all saved together so that one ^Y will yank all of the lines. X X>> Try it. Type ^K several times. X X>> To retrieve that killed text: Type ^Y. Move the cursor down a few X lines and type ^Y again. You now know how to copy text. X XWhat do you do if you have some text you want to yank back, and then Xyou kill something else? ^Y would yank the more recent kill. X X>> Kill a line, move around, kill another line. Then do ^Y to get back X the second killed line. X X XSEARCHING X--------- X XEMACS can do searches for strings (these are groups of contiguous Xcharacters or words) either forward through the file or backward Xthrough it. X X>> Now type ^S to start a search. Type the word "cursor", then ESC. X X>> Type ^S ESC to find the next occurrence of "cursor". X XThe ^S starts a search that looks for any occurrence of the search Xstring AFTER the current cursor position. But what if you want to Xsearch for something earlier in the text? To do this one should Xtype ^R for Reverse search. Everything that applies to ^S applies Xto ^R except that the direction of the search is reversed. X X XTEXT REPLACEMENT X---------------- X X>> Move the cursor to the blank line two lines below this one. X Then type ESC-R changed ESC altered ESC . X X Notice how this line has changed; you have replaced the word X "changed" with "altered" wherever it occurs in the file after X the cursor. After all the substitutions have been made or X the end of file has been reached, a message informing you of X the number of substitutions which have been made appears in X the communication line. X XThe more customary command for replacing strings is the interactive Xcommand query-replace-search (ESC-^R), which has several options. In Xessence, it shows each occurrence of the first string and asks you if Xyou want to replace it or not. Type a "?" when it asks to replace the Xstring to list the various options for query-replace-search. For a Xmore detailed discussion of this command refer to the EMACS manual. X X XFILES X----- X XIn order to make the text changes permanent, you must save them to a file. XIf you do not save them, the changes will "disappear" when you leave EMACS. XAs you make changes, i.e., corrections, deletions, insertions, etc., they Xare actually written to a "scratch" copy of the file and the changes to Xthis file will not affect the "master" copy of the file until a file save Xis specified. This allows you to decide if changes made to the file should Xbe made permanent or discarded. X XRemember: The file name appears on the mode line. X X=* MicroEMACS 3.7 () == emacs.tut == File: emacs.tut =========================== X --------------- X XThe commands for finding and saving files are unlike the other commands Xyou have learned so far in that they consist of two characters - a ^X Xfollowed by another character which specifies the file command to be Xexecuted. X XTo find a file, type ^X^F. EMACS will then prompt you from the Xcommunication line for the name of the file. In response to the prompt, Xtype the file name followed by a <Return> to indicate the file name has Xbeen entered. This command will tell EMACS to go find this file and Xload it. Its contents will then be displayed on the screen and you will Xbe able to edit the file's contents. X XTo save any changes made to the file, type ^X^S. This tells EMACS to Xcreate a new version of the file which includes the changes you have Xmade. When the save is complete, the number of lines saved will be Xdisplayed in the communication line. X XIf you edit a file and at some point decide to quit (i.e., ^X^C) without Xsaving the changes, EMACS will remind you that changes have been made to Xthe file and ask you if you really want to quit. Enter "N" to return to XEMACS or "Y" to exit EMACS without saving the changes. X XTo create a file, just edit it "as if" it already existed. Then start Xtyping in the text. When you ask to "save" the file, EMACS will really Xcreate the file with the text that you have entered. From then on, you Xcan consider yourself to be editing an existing file. X XIt is not easy for you to test editing a file and continue with the Xtutorial. But you can always come back into the tutorial by starting Xit over and skipping forward. So, when you feel ready, you should Xtry editing a file named "FOO", putting some text in it, and saving Xit; then exit EMACS and look at the file to be sure that it worked. X X XEXTENDING THE COMMAND SET X------------------------- X XThere are many, many more EMACS commands than could possibly be put on all Xthe CONTROL and META characters. EMACS gets around this with the X (eXtend) Xcommand. There are two forms of this command: X X ^X Character eXtend. Followed by one character. X ESC-X Named command eXtend. Followed by a long name. X XThese are commands that are generally useful but used less than the commands Xyou have already learned about. You have already seen two of them: the file Xcommands ^X^F to Find and ^X^S to Save. Another example is the command to Xtell EMACS that you'd like to stop editing. The command to do this is ^X^C. X XThere are many ^X commands. Right now, the most helpful ones will be X X ^X^F Find file. X ^X^S Save file. X ^X^C Quit EMACS. This does not save your files automatically; X however, if your files have been modified, EMACS asks if X you really want to quit. The standard way to save and X exit is ^X^S ^X^C. X XNamed eXtended commands are commands which are used even less frequently, Xor commands which are used only in certain modes. These commands are Xusually called "functions". An example is the function "apropos", which Xprompts for a keyword and then gives the names of all the functions that Xare apropos for that keyword. When you type ESC-X, EMACS prompts you from Xthe communication line with ":" and you should type the name of the Xfunction you wish to call; in this case, "apropos". Just type "apr<Space>" Xand EMACS will complete the name. EMACS will ask you for a keyword or Xphrase and you type the string that you want information on. X X>> Type ESC-X, followed by "apropos<Return>" or "apr<Space>". Then X type "file" followed by a <Return>. Note: ESC-A is equivalent to X the ECS-X "apropos" command. X X>> To remove the "window" that was added, type ^X0 (zero). X X XFUNCTION KEYS X------------- X XBy now, you should be familiar with the format and meaning of some of Xthe more common CONTROL and META commands. Because several of these Xcommands are used frequently, they have been bound to the function Xkeys, which are usually located on the left-hand side of the keyboard Xand labelled F1..F10. By pressing the appropriate function key, one Xcan replace several keystrokes with a single keystroke, thus saving Xyou time as you become familiar with their use. X XThe highlighted portion at the top of the screen lists the commands Xwhich are associated with each function key. Each function key supports Xtwo commands specified by fn or Fn where n = 1, 2,...10. The default Xcommands are represented by fn and are defined on the left side of the Xscreen; these commands are executed by pressing the appropriate function Xkey. The secondary commands are represented by Fn and are defined on Xthe right side of the screen; these commands are executed by pressing Xthe <Shift> key and the appropriate function key at the same time. X X>> Press f1 would ESC. Note the position of the cursor - "would" X was located just as if ^S would ESC had been entered. Enter X ^S would ESC to see for yourself. X X>> Press F1 (<Shift> f1). Note the different appearance of the screen. X You have toggled the function key list, i.e., "turned it off". To X "turn it on", press F1 again. X X>> Try using some of the other function keys to become familiar with X their use. NOTE: Do NOT use f9 with this file as it would save X any changes you may have made while using the tutorial. X X XGETTING MORE HELP X----------------- X XIn this tutorial we have tried to supply just enough information to get Xyou started using EMACS. There is so much available in EMACS that it Xwould be impossible to explain it all here. However, you may want to Xlearn more about EMACS since it has numerous desirable features that you Xdon't know about yet. X XThe most basic HELP feature is the describe-key function which is Xavailable by typing ^X? and then a command character. EMACS prints Xone line in the communication line to tell what function is bound Xto that key. X X>> Type ^X?^P. The message in the communication line should X be something like "^P is bound to previous-line". X XNOTE: Multi-character commands such as ^X^Z and ESC-V are also X allowed after ^X? . X X### The describe-command function does not work - December 1986 ### X### Skip to the next section ### X XThe describe-command function (ESC-?) will prompt for the name of a Xfunction and print out the section from the manual about that command. XWhen you are finished reading it, type a space or a ^G (quit) to bring Xyour text back on the screen. X XNow let's get more information about the previous-line command. X X>> Type ESC-?^P. When you are finished reading the output, type <Space>. X XThe "name of the function" is important for people who are customizing XEMACS. It is what appears in the EMACS CHART as the documentation for Xthe command character. X X XCONCLUSION X---------- X XRemember: To EXIT use ^X^C. X XThis tutorial is meant to be understandable to all new users, so if Xyou found something unclear, don't sit and blame yourself - complain! X XYou'll probably find that if you use EMACS for a few days you won't be Xable to give it up. Initially it may give you trouble. But remember, Xthis is the case with any editor, especially one that can do many, many Xthings - and EMACS can do practically everything. X X XACKNOWLEDGEMENTS X---------------- X XThis is a modified version of the "JOVE Tutorial" by Jonathan Payne X(19 January 86). That document was in turn a modified version of Xthe tutorial "Teach-Emacs" from MIT as modified by Steve Zimmerman Xat CCA-UNIX (31 October 85). X XUpdate - February 1986 by Dana Hoggatt. X XUpdate - December 1986 by Kim Leburg. X XUpdate - November 1987 by Daniel Lawrence FRIDAY_NIGHT echo med.2 completed! # That's all folks!
nwd@j.cc.purdue.edu (Daniel Lawrence) (11/19/87)
# This is a shar archive. # Remove everything above this line. # Run the file through sh, not csh. # (type `sh med.3') # If you do not see the message # `med.3 completed!' # then the file was incomplete. echo extracting - findcom.cmd sed 's/^X//' > findcom.cmd << 'FRIDAY_NIGHT' X; This hunts down mismatched comment problems in C X X; start from the current position in the file X X !force search-forward "/*" X !if &seq $status FALSE X !goto nend X !endif X X*nxtopen X ;record the position of the open comment X update-screen X set %oline $curline X set %opos $curcol X X ;find the first close comment X !force search-forward "*/" X !if &seq $status FALSE X write-message "%%No close to this open comment" X !return X !endif X X ;record the position of the close comment X set %cline $curline X set %cpos $curcol X X ;go back to the open and find the next open X set $curline %oline X set $curcol %opos X X ;and now find the next open X !force search-forward "/*" X !if &seq $status FALSE X write-message "No errors" X !return X !endif X set %nline $curline X set %npos $curcol X X ;compare the close to the next open X !if &less %cline %nline X !goto getnext X !endif X !if &and &equ %cline %nline &less %cpos %npos X !goto getnext X !endif X X ;report a mismatch X set $curline %oline X set $curcol %opos X write-message "%%This comment does not terminate properly" X !return X X*getnext X set $curline %nline X set $curcol %npos X !goto nxtopen FRIDAY_NIGHT echo extracting - func.cmd sed 's/^X//' > func.cmd << 'FRIDAY_NIGHT' X; FUNC.CMD Allow mainframes to simulate function X; keys with ^C<n> and ^C shifted-<n> X; Also allow the ` key to be META as well as ESC X Xbind-to-key execute-macro-21 ^C X X21 store-macro X !if ¬ $pending X write-message "FN-" X !endif X set %rcchar >key X set %rcchar &sindex "1234567890!@#$%^&*()" %rcchar X !if &equ %rcchar 0 X write-message "[Not Bound]" X !return X !endif X clear-message-line X set %rcchar &mid ";<=>?@ABCDTUVWXYZ[\]" %rcchar 1 X &ind &bind &cat "FN" %rcchar X!endm FRIDAY_NIGHT echo extracting - me110.rc sed 's/^X//' > me110.rc << 'FRIDAY_NIGHT' X; EMACS.RC: Startup file for MicroEMACS 3.8 (HP 110) X; X; This file is executed everytime the X; editor is entered X X; ***** Rebind the Function key group X Xbind-to-key search-forward FN; Xbind-to-key search-reverse FN< Xbind-to-key next-window FN= Xbind-to-key execute-macro FN> Xbind-to-key find-file FN? Xbind-to-key view-file FN@ Xbind-to-key save-file FNA Xbind-to-key exit-emacs FNB Xbind-to-key describe-key FND Xbind-to-key meta-prefix ` Xbind-to-key beginning-of-file FNs Xbind-to-key end-of-file FNt X X; Enter Help X1 store-macro X delete-other-windows X help X 8 resize-window X bind-to-key execute-macro-12 FNH X bind-to-key execute-macro-13 FNP X bind-to-key execute-macro-11 FNT X beginning-of-file X 2 forward-character X clear-message-line X!endm X X; consult file X2 store-macro X 2 split-current-window X previous-window X view-file @"File to Consult: " X 8 resize-window X next-window X!endm X X; Exit Help X11 store-macro X bind-to-key previous-line FNH X bind-to-key next-line FNP X bind-to-key execute-macro-1 FNT X delete-window X clear-message-line X!endm X X; last help page X12 store-macro X beginning-of-line X search-reverse "=>" X 1 redraw-display X!endm X X; next help page X13 store-macro X beginning-of-line X 2 forward-character X search-forward "=>" X 1 redraw-display X!endm X X; bring up the function key window X X 2 split-current-window X select-buffer "Function Keys" X 2 resize-window X insert-string " F1 search | F2 search back | F3 next wind | F4 Exec Macro | MENU Help" X newline X insert-string "SYS desc key | F5 Find file | F6 view file | F7 save file | F8 exit" X beginning-of-file X unmark-buffer X next-window FRIDAY_NIGHT echo extracting - me150.rc sed 's/^X//' > me150.rc << 'FRIDAY_NIGHT' X; EMACS.RC: Startup file for MicroEMACS 3.4 X; X; This file is executed everytime the X; editor is entered X X; ***** Rebind the Function key group X Xbind-to-key hunt-forward FN^@ X1 label-function-key "hunt forward" Xbind-to-key hunt-backward FN^A X2 label-function-key "hunt backward" Xbind-to-key next-window FN^B X3 label-function-key "next window" Xbind-to-key execute-macro FN^C X4 label-function-key "exec macro" Xbind-to-key find-file FN^D X5 label-function-key "find file" Xbind-to-key view-file FN^E X6 label-function-key "view file" Xbind-to-key save-file FN^F X7 label-function-key "save file" Xbind-to-key exit-emacs FN^G X8 label-function-key "exit emacs" X X; Enter Help X1 store-macro X help X 8 resize-window X bind-to-key execute-macro-12 FNI X bind-to-key execute-macro-13 FNQ X bind-to-key execute-macro-11 FNT X add-mode "red" X begining-of-file X 2 forward-character X clear-message-line X!endm X X; consult file X2 store-macro X 2 split-current-window X previous-window X view-file "@File to Consult: " X 8 resize-window X add-mode "green" X add-mode "Black" X next-window X!endm X X; Exit Help X11 store-macro X bind-to-key previous-page FNI X bind-to-key next-page FNQ X bind-to-key execute-macro-1 FNT X delete-window X clear-message-line X!endm X X; last help page X12 store-macro X begining-of-line X search-reverse "=>" X 1 redraw-display X!endm X X; next help page X13 store-macro X begining-of-line X 2 forward-character X search-forward "=>" X 1 redraw-display X!endm X X FRIDAY_NIGHT echo extracting - menu.cmd sed 's/^X//' > menu.cmd << 'FRIDAY_NIGHT' X; MENU.CMD: Menu learning system for MicroEMACS 3.7 X; X; This file is executed to activate MicroEMACS's X; menu interface code X X; setup windows for use X X add-global-mode "blue" X 1 split-current-window X 5 resize-window X add-mode "red" X view-file "menu1" X name-buffer "menu window" X change-file-name "" X add-mode "view" X next-window X X; Load menu routines as needed X X; Activate Main Menu X X1 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<01" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key execute-macro-3 FN; X bind-to-key execute-macro-4 FN< X bind-to-key execute-macro-5 FN= X bind-to-key execute-macro-6 FN> X bind-to-key execute-macro-7 FN? X bind-to-key execute-macro-8 FN@ X bind-to-key execute-macro-9 FNA X bind-to-key execute-macro-2 FNB X bind-to-key execute-macro-10 FNC X bind-to-key exit-emacs FND X clear-message-line X!endm X X; and bring that menu up X X execute-macro-1 X write-message " [loading MENU system]" X X; set up the editor control menu X X2 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<02" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key execute-macro-11 FN; X bind-to-key execute-macro-12 FN< X bind-to-key execute-macro-13 FN= X bind-to-key execute-macro-14 FN> X bind-to-key execute-macro-15 FN? X bind-to-key execute-macro-16 FN@ X bind-to-key execute-macro-17 FNA X bind-to-key execute-macro-18 FNB X bind-to-key execute-macro-19 FNC X bind-to-key execute-macro-1 FND X clear-message-line X!endm X X; Activate word case/screen control Menu X X3 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<03" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key case-word-upper FN; X bind-to-key case-region-upper FN< X bind-to-key case-word-lower FN= X bind-to-key case-region-lower FN> X bind-to-key case-word-capitalize FN? X unbind-key FN@ X bind-to-key clear-and-redraw FNA X bind-to-key set-mark FNB X bind-to-key redraw-display FNC X bind-to-key execute-macro-1 FND X clear-message-line X!endm X X; Activate paging/scrolling Menu X X4 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<08" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key previous-page FN; X bind-to-key next-page FN< X bind-to-key move-window-down FN= X bind-to-key move-window-up FN> X bind-to-key scroll-next-up FN? X unbind-key FN@ X bind-to-key scroll-next-down FNA X unbind-key FNB X bind-to-key exchange-point-and-mark FNC X bind-to-key execute-macro-1 FND X clear-message-line X!endm X X; Activate cut & paste Menu X X5 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<04" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key set-mark FN; X unbind-key FN< X bind-to-key kill-region FN= X unbind-key FN> X bind-to-key copy-region FN? X unbind-key FN@ X bind-to-key yank FNA X unbind-key FNB X unbind-key FNC X bind-to-key execute-macro-1 FND X clear-message-line X!endm X X; Activate Search & replace Menu X X6 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<09" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key search-forward FN; X bind-to-key search-reverse FN< X bind-to-key hunt-forward FN= X bind-to-key hunt-backward FN> X bind-to-key incremental-search FN? X bind-to-key reverse-incremental-search FN@ X bind-to-key replace-string FNA X bind-to-key query-replace-string FNB X unbind-key FNC X bind-to-key execute-macro-1 FND X clear-message-line X!endm X X; Activate Deletion Menu X X7 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<05" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key delete-previous-character FN; X unbind-key FN< X bind-to-key delete-next-character FN= X unbind-key FN> X bind-to-key kill-to-end-of-line FN? X unbind-key FN@ X bind-to-key delete-blank-lines FNA X unbind-key FNB X unbind-key FNC X bind-to-key execute-macro-1 FND X clear-message-line X!endm X X; Activate Word procesing Menu X X8 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<10" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key previous-word FN; X bind-to-key next-word FN< X bind-to-key previous-paragraph FN= X bind-to-key next-paragraph FN> X bind-to-key fill-paragraph FN? X bind-to-key kill-paragraph FN@ X bind-to-key delete-previous-word FNA X bind-to-key delete-next-word FNB X bind-to-key count-words FNC X bind-to-key execute-macro-1 FND X clear-message-line X!endm X X; Activate Insertion Menu X X9 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<06" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key open-line FN; X bind-to-key insert-string FN< X bind-to-key handle-tab FN= X bind-to-key quote-character FN> X bind-to-key insert-space FN? X bind-to-key transpose-characters FN@ X bind-to-key newline-and-indent FNA X unbind-key FNB X bind-to-key newline FNC X bind-to-key execute-macro-1 FND X clear-message-line X!endm X X; Activate Cursor movement Menu X X10 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<07" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key beginning-of-file FN; X bind-to-key previous-line FN< X bind-to-key backward-character FN= X bind-to-key forward-character FN> X bind-to-key end-of-file FN? X bind-to-key next-line FN@ X bind-to-key beginning-of-line FNA X bind-to-key end-of-line FNB X bind-to-key execute-macro-21 FNC X bind-to-key execute-macro-1 FND X clear-message-line X!endm X X21 store-macro X @"Line number to go to: " goto-line X!endm X X; Activate Buffer Menu X X11 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<11" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key buffer-position FN; X bind-to-key unmark-buffer FN< X bind-to-key delete-buffer FN= X bind-to-key next-buffer FN> X bind-to-key list-buffers FN? X bind-to-key execute-macro-22 FN@ X bind-to-key name-buffer FNA X unbind-key FNB X bind-to-key select-buffer FNC X bind-to-key execute-macro-2 FND X clear-message-line X!endm X X22 store-macro X filter-buffer @"Name of DOS filter: " X!endm X; Macro Menu X X12 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<11" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key begin-macro FN; X unbind-key FN< X bind-to-key end-macro FN= X unbind-key FN> X bind-to-key execute-macro FN? X unbind-key FN@ X unbind-key FNA X unbind-key FNB X unbind-key FNC X bind-to-key execute-macro-2 FND X clear-message-line X!endm X X; Color change Menu X X13 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<12" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key execute-macro-23 FN; X unbind-key FN< X bind-to-key execute-macro-24 FN= X unbind-key FN> X bind-to-key execute-macro-25 FN? X unbind-key FN@ X bind-to-key execute-macro-26 FNA X unbind-key FNB X unbind-key FNC X bind-to-key execute-macro-2 FND X clear-message-line X!endm X X; Set forground color X X23 store-macro X save-window X 1 next-window X select-buffer "[color]" X beginning-of-file X insert-string @"Color to change to: " X newline X beginning-of-file X case-word-upper X beginning-of-file X unmark-buffer X select-buffer "menu window" X 1 redraw-display X restore-window X add-mode #"[color]" X delete-buffer "[color]" X!endm X X; Set background color X X24 store-macro X save-window X 1 next-window X select-buffer "[color]" X beginning-of-file X insert-string @"Color to change to: " X newline X beginning-of-file X case-word-lower X beginning-of-file X unmark-buffer X select-buffer "menu window" X 1 redraw-display X restore-window X add-mode #"[color]" X delete-buffer "[color]" X!endm X X; Set global forground color X X25 store-macro X save-window X 1 next-window X select-buffer "[color]" X beginning-of-file X insert-string @"Color to change to: " X newline X beginning-of-file X case-word-upper X beginning-of-file X unmark-buffer X select-buffer "menu window" X 1 redraw-display X restore-window X add-global-mode #"[color]" X delete-buffer "[color]" X!endm X X; Set global background color X X26 store-macro X save-window X 1 next-window X select-buffer "[color]" X beginning-of-file X insert-string @"Color to change to: " X newline X beginning-of-file X case-word-lower X beginning-of-file X unmark-buffer X select-buffer "menu window" X 1 redraw-display X restore-window X add-global-mode #"[color]" X delete-buffer "[color]" X!endm X X; set Mode Menu X X14 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<17" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key add-mode FN; X bind-to-key add-global-mode FN< X bind-to-key delete-mode FN= X bind-to-key delete-global-mode FN> X unbind-key FN? X bind-to-key execute-macro-27 FN@ X unbind-key FNA X unbind-key FNB X bind-to-key select-buffer FNC X bind-to-key execute-macro-2 FND X clear-message-line X!endm X X27 store-macro X @"Column to fill to: " set-fill-column X!endm X X; DOS command Menu X X15 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<13" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key shell-command FN; X unbind-key FN< X bind-to-key pipe-command FN= X unbind-key FN> X bind-to-key i-shell FN? X unbind-key FN@ X bind-to-key quick-exit FNA X unbind-key FNB X bind-to-key exit-emacs FNC X bind-to-key execute-macro-2 FND X clear-message-line X!endm X X; Script Menu X X16 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<18" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key execute-file FN; X bind-to-key execute-command-line FN< X bind-to-key execute-buffer FN= X bind-to-key execute-named-command FN> X unbind-key FN? X unbind-key FN@ X unbind-key FNA X unbind-key FNB X unbind-key FNC X bind-to-key execute-macro-2 FND X clear-message-line X!endm X X; File access Menu X X17 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<14" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key find-file FN; X bind-to-key save-file FN< X bind-to-key view-file FN= X bind-to-key write-file FN> X bind-to-key read-file FN? X bind-to-key change-file-name FN@ X bind-to-key insert-file FNA X unbind-key FNB X unbind-key FNC X bind-to-key execute-macro-2 FND X clear-message-line X!endm X X; Window Menu X X18 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<19" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key split-current-window FN; X bind-to-key delete-other-windows FN< X bind-to-key resize-window FN= X bind-to-key delete-window FN> X bind-to-key shrink-window FN? X bind-to-key grow-window FN@ X bind-to-key next-window FNA X bind-to-key previous-window FNB X unbind-key FNC X bind-to-key execute-macro-2 FND X clear-message-line X!endm X X; key binding Menu X X19 store-macro X save-window X 1 next-window X beginning-of-file X search-forward "<<15" X next-line X 1 redraw-display X restore-window X update-screen X X; ***** Rebind the Function key group X X bind-to-key bind-to-key FN; X unbind-key FN< X bind-to-key unbind-key FN= X unbind-key FN> X bind-to-key describe-key FN? X unbind-key FN@ X bind-to-key describe-bindings FNA X unbind-key FNB X unbind-key FNC X bind-to-key execute-macro-2 FND X clear-message-line X!endm X X clear-message-line FRIDAY_NIGHT echo extracting - menu1 sed 's/^X//' > menu1 << 'FRIDAY_NIGHT' X--<<01>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 WORD CASE/SCREEN CONTROL F2 PAGING/SCROLLING X[Main Menu] F3 CUT & PASTE F4 SEARCH AND REPLACE X F5 DELETION COMMANDS F6 WORD PROCESSING X F7 INSERTION COMMANDS F8 EDITOR CONTROL X 06/18/86 F9 CURSOR MOVEMENT F10 exit MicroEMACS X--<<02>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 BUFFER CONTROL F2 MACROS X[Editor control] F3 COLOR CHANGES F4 MODES X F5 DOS COMMANDS F6 SCRIPTS X F7 FILE ACCESS F8 WINDOWS X F9 KEY BINDINGS F10 exit to MAIN MENU X--<<03>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 upper case a word F2 upper case a region X Word case & F3 lower case a word F4 lower case a region X Screen control F5 capitilize a word X F7 redraw the screen F8 mark a region X F9 center the current line F10 exit to MAIN MENU X--<<04>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 mark a region X Cut & Paste F3 delete the region X F5 copy the region to the kill buffer X F7 insert the kill buffer into the text here X F10 exit to MAIN MENU X--<<05>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 delete the last character X Deletions F3 delete the next character X F5 delete to the end of the current line X F7 delete all the blank lines around the cursor X F10 exit to MAIN MENU X--<<06>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 open a blank line F2 insert a prompted string X Insertion F3 insert a tab F4 quote the next character X F5 insert a space F6 transpose last 2 chars X F7 insert a newline and indent like the last line X F9 insert a newline F10 exit to MAIN MENU X--<<07>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 begining of the file F2 up one line X Cursor Movement F3 left F4 right X F^2 F5 end of the file F6 down one line X F3 < + > F4 F7 begining of line F8 end of line X FV6 F9 goto line F10 exit to MAIN MENU X--<<08>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 go up one page F2 go down one page X Paging and F3 scroll the screen up F4 scroll the screen down X Scrolling F5 make the next widow go up one page X F7 make the next window go down one page X F9 exchange cursor & mark F10 exit to MAIN MENU X--<<09>>----------------------------------------------------------------------- XMicroEMACS 3.7 f1 search forward f2 seach backwards X Search and F3 hunt forward f4 hunt backwards X Replace F5 isearch forward F6 isearch backward X F7 replace string F8 replace string w/query X F10 exit to MAIN MENU X--<<10>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 go back a word F2 go forward a word X Word processing F3 go back a paragraph F4 go forward a paragraph X F5 fill paragraph F6 delete current paragraph X F7 delete last word F8 delete next word X F9 count words in region F10 exit to MAIN MENU X--<<11>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 report position F2 unmark buffer X Buffer Control F3 delete buffer F4 switch to next buffer X F5 list all buffers F6 filter buffer through X F7 rename current buffer DOS program X F9 select buffer F10 exit to CONTROL MENU X--<<12>>----------------------------------------------------------------------- XMicroEMACS 3.7 Colors: | F1 current window's forground color X Color changes Black Magenta | F3 current window's background color X Blue Cyan | F5 global forground color X Red Yellow | F7 global background color X Green White | F10 exit to CONTROL MENU X--<<13>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 execute one DOS command X DOS commands F3 pipe one DOS command to a buffer X F5 shell up to a new command interpeter X F7 QUICK exit (write out all changed buffers and exit) X F9 exit MicroEMACS F10 exit to CONTROL MENU X--<<14>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 find file F2 save current file X File Access F3 view file (in VIEW mode) F4 write file w/ new name X F5 read file into buffer F6 change current file name X F7 insert file into buffer X F10 exit to CONTROL MENU X--<<15>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 bind a function to a key X Key Bindings F3 unbind a key X F5 describe a key X F7 describe all bindings X F10 exit to CONTROL MENU X--<<16>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 define macro The keyboard macro only works X Keyboard Macro F3 end macro for standard commands, NOT for X F5 execute macro menu selections. X X F10 exit to CONTROL MENU X--<<17>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 set mode F2 set global mode X Modes F3 delete mode F4 delete global mode X Standard modes are: F6 set fill column X WRAP VIEW CMODE EXACT OVER MAGIC X F10 exit to CONTROL MENU X--<<18>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 execute script file F2 execute script line X Script F3 execute script in buffer F4 execute command (by name) X Script line format: X {<repeat count>} <command name> {<argument(s)> | "<argument(s)>"} X F10 exit to CONTROL MENU X--<<19>>----------------------------------------------------------------------- XMicroEMACS 3.7 F1 split current window F2 delete all other windows X Windows F3 resize window F4 delete current window X F5 shrink window F6 enlarge window X F7 next window F8 previous window X F10 exit to CONTROL MENU X------------------------------------------------------------------------------- FRIDAY_NIGHT echo extracting - newpage.cmd sed 's/^X//' > newpage.cmd << 'FRIDAY_NIGHT' X; NEWPAGE.CMD: Startup page Loader X; for MicroEMACS 3.9d and above X; (C)opyright 1987 by Daniel M Lawrence X X; Get rid of the last page X set $discmd FALSE X write-message [Cleaning] X run clean X delete-buffer "[clean]" X X; make sure the function key window is up X set %rcfkeys FALSE X execute-macro-1 X X; Write out the page load instructions X save-window X 1 next-window X beginning-of-file X set $curcol 25 X overwrite-string " Available Pages to Load: " X next-line X set $curcol 25 X overwrite-string " [W] WORDprocessing " X next-line X set $curcol 25 X overwrite-string " [P] PROGramming " X next-line X set $curcol 18 X overwrite-string " " X set $curcol 25 X overwrite-string " [B] BOX/block editing " X next-line X set $curcol 25 X overwrite-string "[space] to load a user page " X unmark-buffer X beginning-of-file X !force restore-window X update-screen X X; prompt for the page X X write-message "Page to load: " X*prompt X set %rctmp >key X clear-message-line X X; check for an abort X !if &seq %rctmp "" X write-message "[Aborted]" X save-window X 1 next-window X beginning-of-file X set $curcol 25 X overwrite-string " MicroEMACS: Text Editor " X next-line X set $curcol 25 X overwrite-string " " X next-line X set $curcol 25 X overwrite-string " Available function key Pages include: " X next-line X set $curcol 25 X overwrite-string " WORD PROG BOX " X next-line X set $curcol 25 X overwrite-string " [use the f8 key to load Pages] " X unmark-buffer X beginning-of-file X !force restore-window X set $discmd TRUE X !return X !endif X X; if it is an unlisted page, get it's name X !if &seq %rctmp " " X set %rcfile &cat @"Name of Page to load: " ".cmd" X !else X set %rcfile &cat %rctmp "page.cmd" X !endif X X; see if this is a legit file X !if &seq &find %rcfile "" X write-message "%No Such Page, Page to load: " X !goto prompt X !endif X X;and lastly, execute it X X execute-file %rcfile X set $discmd TRUE FRIDAY_NIGHT echo extracting - ppage.cmd sed 's/^X//' > ppage.cmd << 'FRIDAY_NIGHT' X; PPAGE.CMD: Programming Macro Page X; for MicroEMACS 3.9d and above X; (C)opyright 1987 by Daniel M Lawrence X X; set the clean procedure up Xstore-procedure clean X delete-buffer "[Macro 10]" X delete-buffer "[Macro 11]" X delete-buffer "[Macro 12]" X delete-buffer "[Macro 13]" X bind-to-key execute-macro-14 FNX X bind-to-key execute-macro-15 FNY X delete-buffer "[Macro 16]" X delete-buffer "[Macro 17]" X bind-to-key execute-macro-18 FN\ X bind-to-key execute-macro-19 FN] X!endm X X; make sure the function key window is up X set %rcfkeys FALSE X execute-macro-1 X write-message "Loading..." X X; Write out the page instructions X save-window X 1 next-window X beginning-of-file X set $curcol 25 X overwrite-string " F1 display variable F2 evaluate expression" X next-line X set $curcol 25 X overwrite-string " F3 compile buffer F4 debug mode [OFF]" X next-line X set $curcol 25 X overwrite-string " F5 execute buffer F6 execute macro" X next-line X set $curcol 18 X overwrite-string "PROG" X set $curcol 25 X overwrite-string " F7 indent region F8 undent region" X next-line X set $curcol 25 X overwrite-string " F9 execute DOS command F10 shell to DOS" X unmark-buffer X beginning-of-file X !force restore-window X update-screen X X; display a variable X X10 store-macro X set %rcdebug $debug X set $debug FALSE X set %rctmp @&cat &cat "Variable to display[" %rcvar "]: " X !if ¬ &seq %rctmp "" X set %rcvar %rctmp X !endif X write-message &cat &cat &cat %rcvar " = [" &ind %rcvar "]" X set $debug %rcdebug X!endm X X; evaluate expresion X X11 store-macro X delete-buffer "[temp]" X set %rcbuf $cbufname X set %cline $cwline X select-buffer "[temp]" X insert-string "set %rcval " X !force insert-string @"EXP: " X execute-buffer "[temp]" X unmark-buffer X select-buffer %rcbuf X delete-buffer "[temp]" X %cline redraw-display X write-message &cat &cat "Value = [" %rcval "]" X!endm X X; compile the current buffer X X12 store-macro X; here is where to add code to handle compiling the current buffer X write-message "[No Compiler module loaded]" X!endm X X; Toggle debug mode X X13 store-macro X set $debug FALSE X set %cbuf $cbufname X set %cline $cwline X select-buffer "Function Keys" X beginning-of-file X next-line X 68 forward-character X set %rcdebug &equ $curchar 70 X delete-previous-character X 2 delete-next-character X !if %rcdebug X insert-string "ON " X !else X insert-string "OFF" X !endif X unmark-buffer X select-buffer %cbuf X %cline redraw-display X write-message &cat &cat "[Debug Mode " %rcdebug "]" X set $debug %rcdebug X!endm X X bind-to-key execute-buffer FNX X bind-to-key execute-macro FNY X X; indent region X X16 store-macro X write-message "[Indenting region]" X set %endline $curline X set %endpos $cwline X exchange-point-and-mark X set $discmd FALSE X set-mark X set $discmd TRUE X X !while &gre %endline $curline X beginning-of-line X handle-tab X next-line X !endwhile X X beginning-of-line X set $cwline %endpos X write-message "[Region indented]" X!endm X X; undent region X X17 store-macro X write-message "[Undenting region]" X set %endline $curline X set %endpos $cwline X exchange-point-and-mark X set $discmd FALSE X set-mark X set $discmd TRUE X X !while &gre %endline $curline X beginning-of-line X !if &gre $lwidth 0 X delete-next-character X !endif X next-line X !endwhile X X beginning-of-line X set $cwline %endpos X write-message "[Region undented]" X!endm X X bind-to-key shell-command FN\ X bind-to-key i-shell FN] X set %rcvar "" X write-message "[Program page loaded]" FRIDAY_NIGHT echo med.3 completed! # That's all> Da> Da
nwd@j.cc.purdue.edu (Daniel Lawrence) (11/19/87)
# This is a shar archive. # Remove everything above this line. # Run the file through sh, not csh. # (type `sh med.4') # If you do not see the message # `med.4 completed!' # then the file was incomplete. echo extracting - readme sed 's/^X//' > readme << 'FRIDAY_NIGHT' X MicroEMACS 3.9 Release Notes July 22, 1987 X X********************************************************************** X X (C)opyright 1987 by Daniel M. Lawrence X MicroEMACS 3.9 can be copied and distributed freely for any X non-commercial purposes. MicroEMACS 3.9 can only be incorporated X into commercial software with the permission of the current author. X X********************************************************************** X X MicroEMACS 3.9 is availible in a couple of different ways. XFirst, it is availible via my bulletin board system..... X X The Programmer's Room X FIDO 201/2 X (317) 742-5533 X 24 hours 300/1200 baud X X Also it should be online on the following BBS's: X X The Starship Trooper Fido 201/1 (317) 423-2281 2400 X X [These following two are open from 10pm till 5pm X and only while Purdue is in session] X The NightStaff Fido 201/4 (317) 495-4270 1200 X The Access Violation Fido 201/5 (317) 495-4270 9600 X X There it is arranged as three MSDOS .ARC files, EMACSDOC.ARC Xwhich contains the documentation and command files, EMACSSRC.ARC which Xcontains the sources and the UNIX Makefile, and EMACSEXE.EXE which Xcontains the MSDOS executables. Also all the various executables are Xavailable individually. X XEMACSDOC.ARC includes the files: X X README This file X X (These four files should be in your path for the standard setup) X EMACS.RC Standard startup file X NEWPAGE.CMD Shifted Function key Pager X PPAGE.CMD Programming page X WPAGE.CMD Word processing page X BPAGE.CMD Block and box manipulation page X X ME110.RC HP110 startup file X ME150.RC HP150 startup file X AMIGA.RC AMIGA ".emacsrc" startup file X ST520.RC ATARI ST startup file X X EMACS.HLP Online help file X EMACS.MSS MicroSCRIBE format of EMACS.TXT X EMACS.TXT EMACS BEGINNER'S/REFERENCE MANUAL X X AZMAP.CMD Translate AZTEC .SYM files to .MAP X BDATA.CMD BASIC Data statement builder X FINDCOM.CMD Find mismatched C comments X FUNC.CMD Allow function keys on systems with non (like UNIX) X MENU.CMD Sample Menu system X MENU1 datafile for menu system X SHELL.CMD Sample interactive MSDOS shell X TRAND.CMD Generate random numbers and do statistics on them X XEMACSSRC.ARC includes the files: X X ALINE.H Atari ST graphic header file X ANSI.C ANSI screen driver X BASIC.C basic cursor movement X BIND.C key binding commands X BUFFER.C buffer manipulation commands X CRYPT.C encryption functions X DOLOCK file locking stub routines X DG10.C Data General 10 screen driver X DISPLAY.C main display driver X EBIND.H binding list X EDEF.H global variable declarations X EFUNC.H function name list X EPATH.H default path settings X ESTRUCT.H configuration and structure definitions X EVAL.C expression evaluator X EVAR.H EMACS macro variable declarations X EXEC.C macro execution functions X FILE.C user file functions X FILEIO.C low level file I/O driver X HP110.C HP110 screen driver X HP150.C HP150(A or C) screen driver X IBMPC.C IBM-PC CGA and MONOCHROME driver X INPUT.C low level user input driver X ISEARCH.C incremental search functions X LINE.C text line manipulation functions X LOCK.C file locking functions X MAIN.C argument parsing and command loop X RANDOM.C other random user functions X REGION.C region cut & paste functions X SEARCH.C search and replace functions X SPAWN.C OS interface driver X ST520.C ATARI ST1040 screen driver X TCAP.C Termcap screen driver X TERMIO.C low level I/O driver X TIPC.C TI-PC screen driver X VMSVT.C VMS screen driver X VT52.C VT52 screen driver X WINDOW.C window manipulation functions X WORD.C word manipulation functions X Z309.C Zenith 100 PC series terminal driver X XEMACSEXE.ARC includes the files: X X MEIBM.EXE IBM-PC CGA/MONO/EGA version X MEANSI.EXE MSDOS ANSI graphics version X ME110.EXE HP110 portable version X ME150.EXE HP150 version X ME309.EXE Zenith 100 PC series version X ME520.PRG Atari 520/1040ST version X MEAMIGA. Amiga 1000 version X X Recently, MicroSPELL 1.0 has been released. This program allows Xyou to spell check text files and uses MicroEMACS to scan the file, Xdoing various corrections. X X MicroSCRIBE, a fairly SCRIBE compatible text formatter to go Xalong with these programs will probably be available for beta testing Xearly spring 1988. This program is turning out to be a lot more complex Xthan I thought it would be, and is taking more time to get out. X X I have in my possesion a port of MicroEMACS 3.8i to the XMacintosh, and I will be incorporating the needed changes for the current Xversion to support the Macintosh. X X As before, I will continue to support these programs, and Xencourage everyone to spread them around as much as they can. If you Xmake what you think are changes that are useful to many, send me the Xupdates, and as time permits, I will incorporate the ones I understand, Xand agree with into the master sources. X X MicroEMACS is available on disk directly from my by sending me X$25 per order and a note specifying the disk format and the product that Xyou need. I can fill orders for IBM-PC high/low density 5 1/4 and 3 X1/5, ATARI ST single and double density, AMIGA disks and HP150 disks. X(You do not need to send disks or mailers, I will provide these.) The Xdistribution set includes on disk all docs, executables and sources. XAlso I will register you and you will receive automatic notices of new Xversions of all the programs I am releasing. X X Commercial lisences to allow MicroEMACS to be incorporated into Xother software packages are also available at a reasonable per package Xprice. Also I am available to do customization of MicroEMACS at an Xhourly rate. Send all requests to the address below: X X USmail: Daniel Lawrence X 617 New York St X Lafayette, IN 47901 X X UUCP: pur-ee!j.cc.purdue.edu!nwd X ARPA: nwd@j.cc.purdue.edu X FIDO: The Programmer's Room 201/2 X (317) 742-5533 X ATT: (317) 742-5153 X X X New Features since version 3.8i X =============================== X X** New standard startup file X X The new emacs.rc file is segmented into more parts and loads much Xfaster than before. Separate "pages" of shifted function keys are Xavailable. Users can write their own "pages". X X*** New Variables (there are a lot...) X X $status returns status of last command X $palette color palette settings X $lastkey returns last keystroke X $curchar returns and set the ascii number of the X character under the point X $progname always returns "MicroEMACS" X $version always returns the current version ("3.9") X $discmd sets display of messages on the command X line (except via the write-message command) X $disinp sets echoing of characters during input on the X command line X $wline returns and sets # lines in current window X $cwline returns and set current line within window X $target returns/sets target for line moves X $search returns/sets default search string X $replace returns/sets default replace string X $match returns last matched string in magic search X $cmode returns/sets encoded mode of current buffer X $gmode returns/sets encoded global mode (see appendix E X in emacs.mss to decode this) X $tpause returns/sets the pause for fence matching X (this is in rather arbitrary units which X WILL vary from machine to machine) X $line return/sets the contents of the current line X $gflags global operations flag (see emacs.txt Appendix G) X $rval child process return value X X*** New computers supported X X Atari 1040ST all three graphics modes and 50 line mode on a X monochrome monitor. The mouse is bound to the X cursor keys for now. X X*** New Compilers supported X X Turbo C v1.0 under MSDOS is now a supported compiler. X Mark Williams C on the Atari ST is also supported. X X** New directives X X !while <condition> loops while <cond> is true X X !break breaks out of the innermost !while X X !endwhile delimits the end of a !while loop X X All !gotos are legal into and out of a !while loop. X X*** Autosave mode X X This mode saves the file out to disk every time 256 have been Xinserted. $asave controls the # of characters between saves, $acount Xcontrols the # of chars to the next save. X X*** New functions X X &and <log> <log> Logical AND X &or <log> <log> Logical OR X &len <str> returns length of <str> X &lower <str> lowercase <str> X &upper <str> uppercase <str> X &rnd <int> generate a random integer between 1 and <int> X &sindex <str1> <str2> search for string 2 within string 1 X returning its position, or zero if it fails X &env <str> return value of DOS environment X variable <str> X &bind <str> returns the function name bound to the X key <str> X &exist <str> Does file <str> exist? X &find <str> find file <str> along the PATH X &band <num> <num> bitwise and X &bor <num> <num> bitwise or X &bxor <num> <num> bitwise xor X &bnot <num> bitwise not X &xlate <str1> <str2> <str3> X scan <str1> replacing characters in X <str2> with the coresponding characters X in <str3> X X*** Advanced word processing commands X X ^X^T trim-line trim all trailing whitespace X ^X^E entab-line change all multiple char runs to tabs X ^X^D detab-line change all tabs to multiple spaces X X*** Merged EGA driver X X The EGA driver is now part of the IBM-PC driver. This driver now Xsupports MONO, CGA and EGA cards/modes. (settable by using the $sres Xvariable) X X*** 8 bit characters fully supported X X Eight bit characters (including foreign language and line Xdrawing characters) are now supported on the various micro environments) X X*** List Buffers expanded X X Given a numeric argument, ^X^B (list-buffers) will now also list Xall the hidden internal buffers. X X*** -k switch enhanced X X If you use the -k (encrypted file) switch on the command line Xwithout a key immediatly following it, it will prompt you for the key to Xuse to decrypt with. X X*** word delete enhanced X X with a zero (0) argument, M-D (delete-next-word) deletes the Xnext word and not any intervening whitespace or special characters. X X*** New File read hook X X Whenever MicroEMACS reads a file from disk, right before it is Xread, whatever function is bound to M-FNR (which is an illegal Xkeystroke) will execute. By default this would be (nop), but the Xstandard emacs.rc binds this to a file that examines the file name and Xplaces the buffer int CMODE if the extension ends in a .c or .h. You can Xof course redefine this macro to taste. X X*** Search Path modified X X The order in which emacs looks for all .rc (startup) and X.cmd (command macros) is as follows: X X $HOME (the HOME environment variable if it exists) X the current directory X $PATH (executable PATH) X default list contained in epath.h X X*** Line length limits removed X X Lines of arbitrary length may be read, edited, and written. X X*** Out of memory handling improved X X EMACS will announce "OUT OF MEMORY" when it runs out of dynamic Xmemory while reading files or inserting new text. It should then be Xsafe to save buffers out IF THE CONTENTS OF THE BUFFER ARE COMPLETE at Xthat time. When a buffer has been truncated while reading, a pound sign X"#" will appear in the first position of the mode line. Also a # will Xappear in a buffer listing. If you attempt to save a truncated buffer, XEMACS will ask if you are certain before allowing the truncated file to Xbe written. As before, still beware of killing blocks of text after you Xhave run out of memory. X X*** DENSE mode on the Atari ST X X On an Atari ST monochrome monitor, setting $sres to "DENSE" will Xresult in a 50 line display. X X*** Execute command X X Execute-program (^X-$) will execute an external program without Xcalling up an intervening shell is possible. X X*** Better close braces in CMODE X X The name says it all, try it. FRIDAY_NIGHT echo extracting - shell.cmd sed 's/^X//' > shell.cmd << 'FRIDAY_NIGHT' X; Shell.cmd: MSDOS shell within MicroEMACS X; written 1987 by Daniel Lawrence X X write-message "[Setting up SHELL window]" X Xstore-procedure getdir X shell-command "cd > eshell" X set %shtmp $cbufname X !force delete-buffer eshell X find-file eshell X beginning-of-file X set %shdir $line X select-buffer %shtmp X delete-buffer eshell X!endm X Xstore-procedure prompt X !if ¬ &equ $curcol 0 X newline X !endif X !if ¬ &seq $line "" X open-line X !endif X insert-string &cat %shdir ">" X!endm X Xstore-procedure getline X beginning-of-line X set %shtmp $curline X !force search-forward ">" X !if ¬ &equ $curline %shtmp X set $curline %shtmp X !endif X !if &equ $curchar 10 X set %shline "" X !else X kill-to-end-of-line X yank X set %shline $kill X !endif X newline X!endm X Xstore-procedure execline X shell-command &cat %shline " > shtmp" X !force insert-file shtmp X!endm X X; prompt and execute a command X X4 store-macro X run getline X !if ¬ &seq %shline "" X !if &or &seq &left %shline 2 "cd" &seq &right %shline 1 ":" X shell-command %shline X run getdir X !else X run execline X !endif X !endif X run prompt X!endm X Xstore-procedure checkmode X !if &and %shmode ¬ &seq $cbufname "[I-SHELL]" X set $discmd FALSE X bind-to-key newline ^M X add-mode blue X add-mode WHITE X write-message "[Exiting Shell window]" X set %shmode FALSE X set $discmd TRUE X !endif X !if &and ¬ %shmode &seq $cbufname "[I-SHELL]" X set $discmd FALSE X write-message "[Entering Shell window]" X bind-to-key execute-macro-4 ^M X run getdir X add-mode black X add-mode GREEN X end-of-file X run prompt X set %shmode TRUE X set $discmd TRUE X !endif X!endm X X; window movement (and deactivate us) X X5 store-macro X next-window X run checkmode X!endm X X6 store-macro X previous-window X run checkmode X!endm X X7 store-macro X delete-window X run checkmode X!endm X X8 store-macro X find-file @"Find file:" X run checkmode X!endm X X9 store-macro X next-buffer X run checkmode X!endm X Xstore-procedure openshell X set $discmd FALSE X bind-to-key execute-macro-5 ^XO X bind-to-key execute-macro-6 ^XP X bind-to-key execute-macro-7 ^X0 X bind-to-key execute-macro-8 ^X^F X bind-to-key execute-macro-9 ^XX X select-buffer "[I-SHELL]" X run checkmode X set $discmd TRUE X!endm X X set %shmode FALSE X run openshell FRIDAY_NIGHT echo extracting - st520.rc sed 's/^X//' > st520.rc << 'FRIDAY_NIGHT' X; EMACS.RC: Standard micro Startup program X; for MicroEMACS 3.9d and above X; (C)opyright 1987 by Daniel M Lawrence X; Last Update: 10/20/87 X Xset $discmd FALSE Xwrite-message "[Setting up....]" X X; If you screen "SNOWS", uncomment this line X; set $flicker "TRUE" X X; To use an IBM-PC EGA card, uncomment the following line X; set $sres "EGA" X X; ***** Rebind the Function key group X Xbind-to-key search-forward FN; Xbind-to-key search-reverse FN< Xbind-to-key hunt-forward FN= Xbind-to-key hunt-backward FN> Xbind-to-key execute-macro-1 FN? Xbind-to-key execute-macro-2 FN@ Xbind-to-key next-window FNA Xbind-to-key execute-macro-3 FNB Xbind-to-key save-file FNC Xbind-to-key exit-emacs FND X Xbind-to-key execute-macro-10 FNT Xbind-to-key execute-macro-11 FNU Xbind-to-key execute-macro-12 FNV Xbind-to-key execute-macro-13 FNW Xbind-to-key execute-macro-14 FNX Xbind-to-key execute-macro-15 FNY Xbind-to-key execute-macro-16 FNZ Xbind-to-key execute-macro-17 FN[ Xbind-to-key execute-macro-18 FN\ Xbind-to-key execute-macro-19 FN] X X; Set Default Global modes X Xadd-global-mode "blue" Xbind-to-key next-page FNG Xbind-to-key previous-page FNR X X; Toggle function key window display X X1 store-macro X !if %rcfkeys X !goto rcfoff X !endif X X; toggle function key window on X save-window X 1 next-window X !if &sequal $cbufname "emacs.hlp" X delete-window X !endif X !if ¬ &sequal $cbufname "Function Keys" X 1 split-current-window X select-buffer "Function Keys" X add-mode "red" X !force 5 resize-window X 1 goto-line X !endif X set %rcfkeys TRUE X !force restore-window X !if &sequal $cbufname "Function Keys" X next-window X !endif X write-message "[Function key window ON]" X !return X X ;Toggle the function key window off X*rcfoff X save-window X 1 next-window X !if &sequal "Function Keys" $cbufname X delete-window X !endif X !force restore-window X write-message "[Function key window OFF]" X set %rcfkeys FALSE X!endm X X; Toggle HELP file onscreen X X2 store-macro X 1 next-window X X ;Make sure the function key window isn't up! X !if &sequal $cbufname "Function Keys" X delete-window X !endif X set %rcfkeys FALSE X X ;Bring up page 1 X !if ¬ &seq $cbufname "emacs.hlp" X help X 8 resize-window X add-mode "red" X beginning-of-file X 2 forward-character X !endif X X*rchelp X X write-message "[INS/HOME] Page [FN6] EXIT ^G Exit leaving page on screen" X update-screen X set %rctmp >key X !if &equ &asc %rctmp 0 X set %rctmp >key X !if &seq %rctmp R X beginning-of-line X !force search-reverse "=>" X 1 redraw-display X !goto rchelp X !endif X !if &seq %rctmp G X beginning-of-line X 2 forward-character X !force search-forward "=>" X 1 redraw-display X !goto rchelp X !endif X !if &seq %rctmp "~@" X delete-window X !if &seq %rcfkeys TRUE X set %rcfkeys FALSE X execute-macro-1 X !endif X write-message "[Help Exited]" X !return X !endif X !endif X !if &equ &asc %rctmp 7 X next-window X set %rcfkeys FALSE X write-message "[Help Aborted]" X !return X !endif X !goto rchelp X!endm X X; Load a new page X X3 store-macro X !if &seq &find newpage.cmd "" X write-message "[Can not find NEWPAGE.CMD]" X !return X !endif X execute-file newpage.cmd X!endm X X;procedure to clean out the current page (which is nothing right now) X Xstore-procedure clean X ; nothing by default X!endm X X; Set up auto CMODE X X20 store-macro X set %rctmp &sin $cfname "." X !if &equ %rctmp 0 X !return X !endif X set %rctmp &mid $cfname &add %rctmp 1 5 X !if &or &seq %rctmp "c" &seq %rctmp "h" X add-mode "cmode" X !endif X!endm Xbind-to-key execute-macro-20 M-FNR X X; bring up the function key window X X 1 split-current-window X select-buffer "Function Keys" X insert-string "f1 search-> f2 <-search | MicroEMACS: Text Editor~n" X insert-string "f3 hunt-> f4 <-hunt | ~n" X insert-string "f5 fkeys f6 help | Available function key Pages include:~n" X insert-string "f7 nxt wind f8 pg[ ] | WORD PROG BOX~n" X insert-string "f9 save f10 exit | [use the f8 key to load Pages]~n" X unmark-buffer X delete-window X set %rcfkeys FALSE X execute-macro-1 X set $discmd TRUE FRIDAY_NIGHT echo extracting - trand.cmd sed 's/^X//' > trand.cmd << 'FRIDAY_NIGHT' X set %try 0 X set %sum 0 X insert-string "Rolls: " X*nextry X set %roll &rnd 100 X !if &greater $curcol 70 X newline X insert-string " " X !endif X set %sum &add %sum %roll X insert-string &cat %roll " " X update-screen X set %try &add %try 1 X !if &less %try 300 X !goto nextry X !endif X X newline X newline X insert-string &cat &cat "Sum of rolls: " %sum "~n" X insert-string &cat &cat "Average roll: " &div %sum 300 "~n" X update-screen X unmark-buffer FRIDAY_NIGHT echo extracting - wpage.cmd sed 's/^X//' > wpage.cmd << 'FRIDAY_NIGHT' X; WPAGE.CMD: Wordprocessing Macro Page X; for MicroEMACS 3.9d and above X; (C)opyright 1987 by Daniel M Lawrence X X; set the clean procedure up Xstore-procedure clean X delete-buffer "[Macro 10]" X bind-to-key execute-macro-11 FNU X bind-to-key execute-macro-12 FNV X delete-buffer "[Macro 13]" X delete-buffer "[Macro 14]" X delete-buffer "[Macro 15]" X delete-buffer "[Macro 16]" X delete-buffer "[Macro 17]" X bind-to-key execute-macro-18 FN\ X delete-buffer "[Macro 19]" X set $cmode %oldmode X set $gmode %oldgmode X!endm X X; make sure the function key window is up X set %rcfkeys FALSE X execute-macro-1 X write-message "Loading..." X X; Write out the page instructions X save-window X 1 next-window X beginning-of-file X set $curcol 25 X overwrite-string " F1 center line " X next-line X set $curcol 25 X overwrite-string " F3 reformat paragraph F4 spell check file " X next-line X set $curcol 25 X overwrite-string " F5 ref indented paragraph F6 PREVIEW output " X next-line X set $curcol 18 X overwrite-string "WORD" X set $curcol 25 X overwrite-string " F7 toggle words F8 output DRAFT " X next-line X set $curcol 25 X overwrite-string " F9 count words F10 output FINAL " X unmark-buffer X beginning-of-file X !force restore-window X update-screen X X; Center the current line X X10 store-macro X end-of-line X set %rctmp $curcol X beginning-of-line X &div &sub $fillcol %rctmp 2 insert-space X beginning-of-line X!endm X Xbind-to-key nop FNU Xbind-to-key fill-paragraph FNV X X; Spell check the current buffer X X13 store-macro X set %rctmp @"User dictionary(<ret> if none): " X !if &seq %rctmp "ERROR" X !return X !endif X !if ¬ &seq %rctmp "" X set %rctmp &cat &cat "-u" %rctmp " " X !endif X save-file X set %rcspell TRUE X write-message ~n X shell-command &cat &cat "spell " %rctmp $cfname X execute-file "scan.cmd" X delete-other-windows X !if &seq %rcfkeys TRUE X set %rcfkeys FALSE X execute-macro-1 X !endif X update-screen X write-message "[Spell Check complete]" X!endm X X; reformat indented paragraph X X14 store-macro X write-message " [Fixing paragraph]" X X ;remember where we are..and set up X set %endpos $cwline X set $discmd "FALSE" X X ;snarf the paragraph and put it in its own buffer X kill-region X 2 split-current-window X select-buffer "[temp]" X yank X X ;get rid of the blank lines at the end X end-of-file X !while &and &seq $line "" ¬ &equ $curline 1 X delete-previous-character X !endwhile X forward-character X X ;get rid of the indents X set %endline $curline X beginning-of-file X !while &gre %endline $curline X !while &or &equ $curchar 32 &equ $curchar 9 X delete-next-character X !endwhile X next-line X !endwhile X X ;re-format it X &sub $fillcol 8 set-fill-column X 1 goto-line X fill-paragraph X &add $fillcol 8 set-fill-column X X ;insert new indents X end-of-file X set %endline $curline X beginning-of-file X !while &less $curline &sub %endline 1 X beginning-of-line X handle-tab X next-line X !endwhile X X ;move it back into the original buffer X beginning-of-file X set-mark X end-of-file X kill-region X unmark-buffer X delete-window X yank X X ;and clean up X delete-buffer "[temp]" X set $cwline %endpos X set $discmd TRUE X write-message " [Fixed paragraph]" X!endm X X15 store-macro X write-message "[MicroSCRIBE not ready]" X!endm X X; swap the word the cursor is on and it's predisesor X X16 store-macro X set %rctmp $search X forward-character X previous-word X 0 delete-next-word X set %second $kill X insert-string "~~" X !force previous-word X !if &seq $status FALSE X set %first %second X !else X 0 delete-next-word X set %first $kill X insert-string %second X !endif X search-forward "~~" X delete-previous-character X insert-string %first X previous-word X set $search %rctmp X!endm X X17 store-macro X write-message "[MicroSCRIBE not ready]" X!endm X Xbind-to-key count-words FN\ X X19 store-macro X write-message "[MicroSCRIBE not ready]" X!endm X X set %oldmode $cmode X set %oldgmode $gmode X add-mode wrap X add-global-mode wrap X write-message "[Wordprocesing mode loaded]" FRIDAY_NIGHT echo extracting - sed 's/^X//' > << 'FRIDAY_NIGHT' XXFRIDAY_NIGHT