MicroEMACS v3.10 -- Contents: Introduction Suggestions for using the help facility Gnu Emacs Compatibility ^S-^Q (Xon-Xoff) Hacks Local Hacks New Features of Micro-Emacs v3.10 MicroEMACS Help screens -- Introduction Micro-EMACS, command name "emacs", is a compact and quick editor with easily reconfigurable keys. In basic editing and file handling commands it is very similar to the ever-popular, but oversized and slow, Gnu Emacs. We urge all Gnu Emacs users to change over to Micro-Emacs. The basic command line is emacs filename However, the following command line options are available: -v view (no changes) the file -sstring Search for the string at startup -g999 Go to that line number at startup +999 Go to that line number at startup (UNIX convention) @rcfile Execute commands from the named file instead of ~/.emacsrc At startup the program normally executes ~/.emacsrc if it exists, or /usr/ /local/bin/.emacsrc otherwise. If you make your own .emacsrc you will want to copy /usr/local/bin/.emacsrc to get the Xon-Xoff fixes described below. Micro-Emacs has documentation. There is a hardcopy manual in the racks in MS 6117 and MSA 3974. In addition, helpful files are located in the directory /usr/local/lib/emacs. These include emacsref.txt The manual described above (103 pages) emacs.tut Tutorial: copy it and edit the copy like it tells you emacs.key List of default key bindings emacs.hlp The on-line help file -- Suggestions for using the help facility Note: in Emacs documentation, an abbreviation like M-A means Meta-A, which on UNIX means press the escape key (labelled esc; don't hold down) then press A, lower or upper case. ^V means Control-V, hold down the control key and press v. There are also double key combinations like ^X0 meaning do control-X then zero. ^^ (the search command mentioned below) means control-caret. The caret is an upper case 6 on many keyboards; on Televideo and Wyse terminals use the "home" key to produce ^^, or else control-shift-6. To see a list of commands whose titles include a particular word, type M-A then type the word. Remember to type ^X0 (that's a zero) to close the apropos window when you are done with it. To see the help file, type M-?. ^V shows the next screen and ^Z shows the previous one. To search for a word or topic, type ^^, then the word, followed by escape. ^R searches backward. Again, ^X0 to close the window when done. --Gnu Emacs Compatibility To help Gnu Emacs users change to Micro-Emacs, here is a list of their major differences. Extended features are of course quite different, e.g. the help facility and the Gnu mail interface. But the motion and file commands are almost the same. See below about ^S. Command Micro key Gnu key (M- = meta (escape)) previous-page ^Z or M-V M-V apropos M-A ^C A (command names with keyword) goto-line M-G ??? (numbered line: M-number M-G) suspend-emacs ^XD ^Z insert-file ^X^I ^XI read-file ^X^R ^X^V ("Visit" in Gnu,^X^F is better) view-file ^X^V ^X^R ("Readonly" in Gnu) shell-command ^X! M-! (Execute UNIX command) pipe-command ^X@ ?? (Command output in a buffer) filter-buffer ^X# M-| (Just the region in Gnu) query-replace-string M-^R M-% (Strings end with Esc, ?=help) quick-exit M-Z -- (Saves all buffers) -- ^S-^Q (Xon-Xoff) Hacks Many editors including Emacs were designed to be used on a terminal connected directly to the computer. However, in modern systems like ours the terminals work through a communication server, and this server interprets ^S and ^Q as commands to shut off and restart the flow of data. Therefore we have provided a file /usr/local/bin/.emacsrc that automatically rebinds ^S and ^Q. Basically, ^S is mapped to ^^ (control-caret, shifted 6 on most keyboards) and ^Q is mapped to ^_ (control-underbar, shifted minus). On some terminals, like Wyse, to get ^^ you must press control-shift-^ and similarly for ^_. On TVI and Wyse, the "home" key is more convenient for producing ^^. The rebindings are: save-file ^X^^ search-forward ^^ change-screen-size M-^^ quote-character ^_ unbind-key ^Q unbind-key ^S If you want ^S and ^Q to work in the native way, and if you never ever use emacs on a port with flow control, you could provide .emacsrc in your home directory that lacks these rebindings. -- Local Hacks In an effort to make Micro-Emacs as useful as possible in the PIC lab while adapting to some rather strange terminal behavior, the following features (not bugs) have been added: a. The Freedom-100's are not quite fast enough to keep up with 9600 baud and hence generate Xon-Xoff (^Q-^S); however, it was not possible to get Emacs to process the flow control characters and still behave right on other terminals. Thus on Freedoms the end of the status line is often truncated due to buffer overflow. At least it's useable. b. Function and arrow keys of two or more characters are recognized if defined in TERMCAP. TVI, Wyse and Freedom terminals produce one-byte arrow key codes, which receive their standard interpretation (kill line, etc.) On these terminals the function keys are ^A followed by a letter, and if you manually generate such a sequence equally as fast as the terminal does (within 0.16 second), Emacs will see the function key and report "key not bound" unless you have bound it in your .emacsrc. If you always use a Wyse, TVI or Freedom you may want to change your .emacsrc to bind the arrow key codes to motion commands rather than the native definitions. -- New Features of Micro-Emacs v3.10 Completion of filenames, buffer names and command names Press the spacebar and completion will be attempted. If a unique completion is found, Emacs will press "return" for you; otherwise it will wait for you to type more characters. Rectangular move, and numerous other useful command macros A rectangular region of the screen can be cut out and yanked elsewhere (block.cmd). See /usr/local/lib/emacs/*.cmd for other command files. See /usr/local/lib/emacs/emacs.rc for hints on what to put in your own .emacsrc to use them. Multiple marks A numeric argument before set-mark (M-space), exchange-point-and- -mark (^X^X) and other region commands causes the N'th mark to be used. Default is mark 0. Automatic save Add mode "asave" (^XM) to enable it. The file is saved every 1024 characters. Set the variable $asave (^XA for set) to adjust. For immediate effect also set $acount to the same number. Coordinated multi-windows When multiple windows are open in the same buffer the program can still optimize screen output. In the old version it had to repaint the entire window. Detab, Entab, Trim Lines ^X^D, ^X^E, ^X^T respectively. Detab means convert tabs to the right number of blanks; entab means convert blanks to tabs; trim means to remove trailing whitespace. Without a numeric argument they work on the region (mark 0 only); with an argument they do so many lines. Fill paragraph M-Q rewraps lines to fit from column 0 to the fill column. Use M-(number)^XF to set the fill column (default 75). Set mode "wrap" (^XM) to automatically wrap lines on input. (These features have been in since at least v3.8.) Horizontal scroll If you set $hscroll to TRUE (1), on going rightward off the screen the whole screen will be shifted $hjump columns; otherwise only the current line will be shifted. Default $hjump is 1 and $hscroll is TRUE, but the systemwide .emacsrc sets $hjump to 8 and $hscroll to FALSE, like on the old version. +number on command line goes to that line on startup, like vi does. (UCLA hack) Honors DOTDIR environment variable as a substitute for HOME in a path search for .emacsrc (UCLA hack). "run" command M-^E to execute named procedure See manual, chapter 13, for details on macros and procedures No-operation command Narrow buffers ^X< makes text outside the region temporarily become invisible. ^X> brings it back. "Narrow" is a misnomer; lines vanish, not columns. Mouseability On PC's and VMS only. If I figure out how to make it work on UNIX I'll post a message. No-clobber saving (WARNING) Files can be saved first to a dummy name, then the old version is removed and the dummy is renamed. HOWEVER, in UNIX the old version modes are not transcribed to the new version. If this doesn't bother you, i.e. you're just doing text editing and your default UMASK mode is fine, you can set $ssave to TRUE. -- MicroEMACS Help screens (01/18/87) M- means to use the key prior to using another key ^A means to use the control key at the same time as the A key ^V or [Pg Dn] Scroll down M-< or Begining of file ^Z or [Pg Up] Scroll up M-> or End of file ----------------------------------------------------------------------- => (1) MOVING THE CURSOR ^F Forward character M-F Forward word Keypad arrows ^B Backward character M-B Backward word are active! ^A Front of line M-G Goto a line ^E End of line ^N Next line M-N Front of paragraph ^P Previous line M-P End of paragraph ----------------------------------------------------------------------- => (2) DELETING & INSERTING <-- Delete previous character ^D or Delete next character ^C or Insert a space M-<-- Delete previous word M-D Delete next word ^K Close (delete) to end of line ----------------------------------------------------------------------- => (2a) MORE DELETING & INSERTING Insert a newline Advance to next tab stop ^J Insert a newline and indent M-^W Delete paragraph ^O Open (insert) line ^W Delete region between mark (set using M-) and cursor M-W Copy region to kill buffer ^X ^O Delete blank lines around cursor ----------------------------------------------------------------------- => (3) SEARCHING ^S Search forward from cursor position. ^R Reverse search from cursor position. ^X S Forward incremental search ^X R Reverse incremental search S Search for the next occurence of the last string (IBM-PC only) R Search for the last occurence of the last string (IBM-PC only) ----------------------------------------------------------------------- => (4) REPLACING M-R Replace all instances of first typed-in string with second typed-in string. End each string with ESC. M-^R Replace with query. Answer with: ^G cancel . exit to entry point ! replace the rest Y replace & continue ? Get a list of options N no replacement & continue ----------------------------------------------------------------------- => (5) CAPITALIZING & TRANSPOSING M-U UPPERCASE word M-C Capitalize word ^T Transpose characters M-L lowercase word ^X ^L lowercase region ^X ^U uppercase region ^Q Quote next entry, so that control codes may be entered into text ----------------------------------------------------------------------- => (6) REGIONS & THE KILL BUFFER M- set MARK at current position ^X ^X eXchange mark and cursor A REGION will then be continuously-defined as the area between the mark and the current cursor position. The KILL BUFFER is the text which has been most recently saved or deleted. ----------------------------------------------------------------------- => (7) COPYING AND MOVING ^W Delete (Wipe) region M-W copy region to KILL buffer ^Y Yankback save buffer at cursor Generally, the procedure for copying or moving text is: 1) Mark a REGION using M- at beginning and cursor at end. 2) Delete it (with ^W) or copy it (with M-W) into the KILL buffer. 3) Move the cursor to the desired location and yank it back (with ^Y). ----------------------------------------------------------------------- => (8) MODES OF OPERATION ^X M Add mode in buffer M-M Add global mode ^X ^M Delete mode in buffer M-^M Delete global mode OVER Replaces (overwrites) rather than inserts characters WRAP Turns on word wrap (automatic carraige return). VIEW Allows viewing file without insertion and deletion. CMODE Automatic indenting for C program entry EXACT/MAGIC Changes how search and replace commands work (see next page) ----------------------------------------------------------------------- => (9) SEARCH AND REPLACE MODES EXACT Uppper/lower case is not ignored in searches MAGIC Regular pattern matching characters are active . Matches any one character * Matches any any number of the preceding character ^ Beginning of line [ ] Character class enclosure $ End of line \ Quote next character ----------------------------------------------------------------------- => (10) ON-SCREEN FORMATTING ^X F Set fill column Mn- Set tab spacing to n charecters between tabs stops M-Q Format paragraph so that text lies between margins ^X = Position report -- displays line number, char count, file size and character under cursor M-^C Count words/lines/chars in marked region ----------------------------------------------------------------------- => (11) MULTIPLE WINDOWS Many WINDOWS may be active at once on the screen. All windows may show different parts of the same buffer, or each may display a different one. ^X 2 Split the current window in two ^X O Change to next window ^X 0 delete current window ^X P Change to previous window ^X 1 delete all other windows M-^V Page down next window M-^Z Page up other window ----------------------------------------------------------------------- => (12) CONTROLLING WINDOWS AND THE SCREEN ^X ^ Enlarge current window M- ^X W Resize window to lines ^X ^Z Shrink current window M- M-S Change screen to lines ^X ^N Move window down M- M-T Change screen to columns ^X ^P Move window up M-^L Reposition window ^L Refresh the screen ----------------------------------------------------------------------- => (13) MULTIPLE BUFFERS A BUFFER is a named area containing a document being edited. Many buffers may be activated at once. ^X B Switch to another buffer. = use just-previous buffer ^X X Switch to next buffer in buffer list M-^N Change name of current buffer ^X K Delete a non-displayed buffer. ^X ^B Display buffer directory in a window ----------------------------------------------------------------------- => (14) READING FROM DISK ^X ^F Find file; read into a new buffer created from filename. (This is the usual way to begin editing a new file.) ^X ^R Read file into current buffer, erasing its previous contents. No new buffer will be created. ^X ^I Insert file into current buffer at cursor's location. ^X ^V Find a file to make current in VIEW mode ----------------------------------------------------------------------- => (15) SAVING TO DISK ^X ^S Save current buffer to disk ^X ^W Write current buffer to disk ^X N Change file name of current buffer M-Z Write out all changed buffers and exit MicroEMACS ----------------------------------------------------------------------- => (16) ACCESSING THE OPERATING SYSTEM ^X ! Send one command to the operating system and return ^X @ Pipe DOS command results to buffer ^X # Filter buffer through DOS filter program ^X C Start a new command processor under MicroEMACS ^X D Suspend MicroEMACS into the background (UNIX BSD4.2 only) ^X ^C Exit MicroEMACS ----------------------------------------------------------------------- => (17) KEY BINDINGS AND COMMANDS M-K Bind a key to a command M-A Describe a class of commands M-^K Unbind a key from a command ^X ? Describe command bound to a key M-X Execute a named (and possibly unbound) command {Describe-bindings} Display a list of all commands and key bindings to a buffer ----------------------------------------------------------------------- => (18) COMMAND EXECUTION Commands can be specified as command lines in the form: {command-name} {Execute-command-line} execute a typed in command line {Execute-buffer} executes commands lines in a buffer {Execute-file} executes command lines from a file {clear-message-line} clears the message line during execution M-~ clears the change flag for a buffer ----------------------------------------------------------------------- => (19) MACRO EXECUTION ^X ( Start recording keyboard macro ^X ) Stop recording keyboard macro ^X E Execute keyboard macro M- {store-macro} Start recording named macro !endm Stop recording named macro {execute-macro-n} Execute macro n (where n is from 1 to 20) ----------------------------------------------------------------------- => (20) SPECIAL KEYS ^G Cancel current command and return to top level of processing. ^U or Universal repeat. May be followed by an integer (default = 4) M- and repeats the next command that many times. M-X Execute a named (and possibly unbound) command