home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume1
/
8711
/
14
< prev
next >
Wrap
Internet Message Format
|
1990-07-13
|
50KB
Path: uunet!husc6!necntc!ncoast!allbery
From: nwd@j.cc.purdue.edu (Daniel Lawrence)
Newsgroups: comp.sources.misc
Subject: MicroEmacs 3.9 Manual (3 of 6)
Message-ID: <5816@ncoast.UUCP>
Date: 26 Nov 87 04:15:06 GMT
Sender: allbery@ncoast.UUCP
Lines: 1469
Approved: allbery@ncoast.UUCP
X-Archive: comp.sources.misc/8711/14
Xall the directories listed in the "@b(PATH)" environment variable. Then
Xit looks through a list of predefined standard directories which vary
Xfrom system to system. Finally, failing all of these, it looks in the
Xcurrent directory. This is also the same method EMACS uses to look up
Xany files to execute, and to find it's help file @b(EMACS.HLP).
X@index(PATH environment variable) @index(HOME environment variable)
X@index(Help File)
X
X@index(switches)
X On computers that call up EMACS via a command line process, such
Xas MSDOS and UNIX, there are different things that can be added to the
Xcommand line to control the way EMACS operates. These can be switches,
Xwhich are a dash ('-') followed by a letter, and possible other
Xparameters, or a startup file specifier, which is an at sign '@@'
Xfollowed by a file name.
X
X@begin(description)
X@@<file>@\This causes the named file to be executed instead of the
Xstandard emacs.rc file before emacs reads in any other files. More than
Xone of these can be placed on the command line, and they will be
Xexecuted in the order that they appear.
X
X-A@\This flag causes emacs to automatically run the startup file
X"error.cmd" instead of emacs.rc. This is used by various C compilers for
Xerror processing (for example, Mark Williams C). @index(error parsing)
X
X-E@\The following source files on the command line can be edited (as
Xopposed to being in VIEW mode). This is mainly used to cancel the
Xeffects of the -v switch used previously in the same command line.
X
X-G<num>@\Upon entering EMACS, position the cursor at the <num> line of
Xthe first file.
X
X-K<key>@\This key tells emacs to place the source files in CRYPT
X@index(CRYPT mode) mode and read it in using <key> as the encryption
Xkey. If no key is listed immediatly after the -K switch, EMACS will
Xprompt for a key, and not echo it as it is typed.
X
X-R@\This places EMACS in "restricted mode"@index(restricted mode)
X@index(BBS) where any commands allowing the user to read or write any
Xfiles other than the ones listed on the command line are disabled. Also
Xall commands allowing the user access to the operating system are
Xdisabled. This makes EMACS very useful as a "safe" environment for use
Xwithin other applications and especially used as a remote editor for a
XBBS or electronic bulletin board system.
X
X-S<string>@\After EMACS is started, it automatically searches for
X<string> in the first source file.
X
X-V@\This tells EMACS that all the following sources files on the command
Xline should be in VIEW mode to prevent any changes being made to them.
X@end(description)
X@appendix(MicroEMACS commands)
X
X Below is a complete list of the commands in EMACS, the keys
Xnormally used to do the command, and what the command does. Remember,
Xon some computers there may also be additional ways of using a command
X(cursor keys and special function keys for example).
X
X@begin(verbatim)
X@u(Command Binding Meaning)
Xabort-command ^G This allows the user to abort out of any
X command that is waiting for input
X
Xadd-mode ^X-M Add a mode to the current buffer
X
Xadd-global-mode M-M Add a global mode for all new buffers
X
Xapropos M-A List out commands whose name contains
X the string specified
X
Xbackward-character ^B Move one character to the left
X
Xbegin-macro ^X-( Begin recording a keyboard macro
X
Xbeginning-of-file M-< Move to the beginning of the file in
X the current buffer
X
Xbeginning-of-line ^A Move to the beginning of the current line
X
Xbind-to-key M-K Bind a key to a function
X
Xbuffer-position ^X-= List the position of the cursor in the
X current window on the command line
X
Xcase-region-lower ^X-^L Make a marked region all lower case
X
Xcase-region-upper ^X-^U Make a marked region all upper case
X
Xcase-word-capitalize M-C Capitalize the following word
X
Xcase-word-lower M-L Lower case the following word
X
Xcase-word-upper M-U Upper case the following word
X
Xchange-file-name ^X-N Change the name of the file in the
X current buffer
X
Xchange-screen-size M-^S Change the number of lines of the screen
X currently being used
X
Xchange-screen-width M-^T Change the number of columns of the
X screen currently being used
X
Xclear-and-redraw ^L Clear the physical screen and redraw it
X
Xclear-message-line (none) Clear the command line
X
Xcopy-region M-W Copy the currently marked region into
X the kill buffer
X
Xcount-words M-^C Count how many words, lines and
X characters are in the current marked region
X
Xctlx-prefix ^X Change the key used as the ^X prefix
X
Xdelete-blank-lines ^X-^O Delete all blank lines around the cursor
X
Xdelete-buffer ^X-K Delete a buffer which is not being
X currently displayed in a window
X
Xdelete-mode ^X-^M Turn off a mode in the current buffer
X
Xdelete-global-mode M-^M Turn off a global mode
X
Xdelete-next-character ^D Delete the character following the cursor
X
Xdelete-next-word M-D Delete the word following the cursor
X
Xdelete-other-windows ^X-1 Make the current window cover the entire
X screen
X
Xdelete-previous-character^H Delete the character to the left of the
X cursor
X
Xdelete-previous-word M-^H Delete the word to the left of the cursor
X
Xdelete-window ^X-0 Remove the current window from the screen
X
Xdescribe-bindings (none) Make a list of all legal commands
X
Xdescribe-key ^X-? Describe what command is bound to a
X keystroke sequence
X
Xdetab-line ^X-^D Change all tabs in a line to the
X equivelant spaces
X
Xend-macro ^X-) stop recording a keyboard macro
X
Xend-of-file M-> Move cursor to the end of the current buffer
X
Xend-of-line ^E Move to the end of the current line
X
Xentab-line ^X-^E Change multiple spaces to tabs where
X possible
X
Xexchange-point-and-mark ^X-^X Move cursor to the last marked spot,
X make the original position be marked
X
Xexecute-buffer (none) Execute a buffer as a macro
X
Xexecute-command-line (none) Execute a line typed on the command
X line as a macro command
X
Xexecute-file FNB Execute a file as a macro
X
Xexecute-macro ^X-E Execute the keyboard macro (play back
X the recorded keystrokes)
Xexecute-macro-<n> (none) Execute numbered macro <N> where <N> is
X an integer from 1 to 40
X
Xexecute-named-command M-X Execute a command by name
X
Xexecute-procedure M-^E Execute a procedure by name
X
Xexecute-program ^X-$ Execute a program directly (not through
X an intervening shell)
X
Xexit-emacs ^X-^C Exit EMACS. If there are unwritten,
X changed buffers EMACS will ask to confirm
X
Xfill-paragraph M-Q Fill the current paragraph
X
Xfilter-buffer ^X-# Filter the current buffer through an
X external filter
X
Xfind-file ^X-^F Find a file to edit in the current window
X
Xforward-character ^F Move cursor one character to the right
X
Xgoto-line M-G Goto a numbered line
X
Xgoto-matching-fence M-^F Goto the matching fence
X
Xgrow-window ^X-^ Make the current window larger
X
Xhandle-tab ^I Insert a tab or set tab stops
X
Xhunt-forward FN= Hunt for the next match of the last
X search string
X
Xhunt-backward FN> Hunt for the last match of the last
X search string
X
Xhelp M-? Read EMACS.HLP into a buffer and display it
X
Xi-shell ^X-C Shell up to a new command processor
X
Xincremental-search ^X-S Search for a string, incrementally
X
Xinsert-file ^X-^I insert a file at the cursor in the
X current file
X
Xinsert-space ^C Insert a space to the right of the cursor
X
Xinsert-string (none) Insert a string at the cursor
X
Xkill-paragraph M-^W Delete the current paragraph
X
Xkill-region ^W Delete the current marked region, moving
X it to the kill buffer
X
Xkill-to-end-of-line ^K Delete the rest of the current line
X
Xlist-buffers ^X-^B List all existing buffers
X
Xmeta-prefix <ESC> Key used to precede all META commands
X
Xmove-window-down ^X-^N Move all the lines in the current window down
X
Xmove-window-up ^X-^P Move all the lines in the current window up
X
Xname-buffer M-^N Change the name of the current buffer
X
Xnewline ^M Insert a <NL> at the cursor
X
Xnewline-and-indent ^J Insert a <NL> at the cursor and indent
X the new line the same as the preceeding line
X
Xnext-buffer ^X-X Bring the next buffer in the list into
X the current window
X
Xnext-line ^N Move the cursor down one line
X
Xnext-page ^V Move the cursor down one page
X
Xnext-paragraph M-N Move cursor to the next paragraph
X
Xnext-window ^X-O Move cursor to the next window
X
Xnext-word M-F Move cursor to the beginning of the
X next word
X
Xnop M-FNC Does nothing
X
Xopen-line ^O Open a line at the cursor
X
Xoverwrite-string (none) Overwrite a string at the cursor
X
Xpipe-command ^X-@@ Execute an external command and place
X its output in a buffer
X
Xprevious-line ^P Move cursor up one line
X
Xprevious-page ^Z Move cursor up one page
X
Xprevious-paragraph M-P Move back one paragraph
X
Xprevious-window ^X-P Move the cursor to the last window
X
Xprevious-word M-B Move the cursor to the beginning of the
X word to the left of the cursor
X
Xquery-replace-string M-^R Replace all of one string with another
X string, interactively querying the user
X
Xquick-exit M-Z Exit EMACS, writing out all changed buffers
X
Xquote-character ^Q Insert the next character literally
X
Xread-file ^X-^R Read a file into the current buffer
X
Xredraw-display M-^L Redraw the display, centering the
X current line
X
Xresize-window ^X-W Change the number of lines in the
X current window
X
Xrestore-window (none) Move cursor to the last saved window
X
Xreplace-string M-R Replace all occurences of one string
X with another string from the cursor
X to the end of the buffer
X
Xreverse-incremental-search^X-R Search backwards, incrementally
X
Xrun M-^E Execute a named procedure
X
Xsave-file ^X-^S Save the current buffer if it is changed
X
Xsave-window (none) Remember current window (to restore later)
X
Xscroll-next-up M-^Z Scroll the next window up
X
Xscroll-next-down M-^V Scroll the next window down
X
Xsearch-forward ^S Search for a string
X
Xsearch-reverse ^R Search backwards for a string
X
Xselect-buffer ^X-B Select a buffer to display in the
X current window
X
Xset ^X-A Set a variable to a value
X
Xset-encryption-key M-E Set the encryption key of the current buffer
X
Xset-fill-column ^X-F Set the current fill column
X
Xset-mark Set the mark
X
Xshell-command ^X-! Causes an external shell to execute
X a command
X
Xshrink-window ^X-^Z Make the current window smaller
X
Xsplit-current-window ^X-2 Split the current window in two
X
Xstore-macro (none) Store the following macro lines to a
X numbered macro
X
Xstore-procedure (none) Store the following macro lines to a
X named procedure
X
Xtranspose-characters ^T Transpose the character at the cursor
X with the character to the left
X
Xtrim-line ^X-^T Trim any trailing whitespace from line
X
Xunbind-key M-^K Unbind a key from a function
X
Xuniversal-argument ^U Execute the following command 4 times
X
Xunmark-buffer M-~ Unmark the current buffer (so it is
X no longer changed)
X
Xupdate-screen (none) Force a screen update during macro execution
X
Xview-file ^X-^V Find a file,and put it in view mode
X
Xwrap-word M-FNW Wrap the current word, this is an
X internal function
X
Xwrite-file ^X-^W Write the current buffer under a new
X file name
X
Xwrite-message (none) Display a string on the command line
X
Xyank ^Y yank the kill buffer into the current
X buffer at the cursor
X@end(verbatim)
X@appendix(MicroEMACS Bindings)
X
X Below is a complete list of the key bindings used in MicroEMACS.
XThis can be used as a wall chart reference for MicroEMACS commands.
X
X@begin(verbatim)
X@center(@b[Default Key Bindings for MicroEmacs 3.9e])
X
X ^A Move to start of line ESC A Apropos (list some commands)
X ^B Move backward by characters ESC B Backup by words
X ^C Insert space ESC C Initial capitalize word
X ^D Forward delete ESC D Delete forward word
X ^E Goto end of line ESC E Reset Encryption Key
X ^F Move forward by characters ESC F Advance by words
X ^G Abort out of things ESC G Go to a line
X ^H Backward delete
X ^I Insert tab/Set tab stops
X ^J Insert <NL>, then indent
X ^K Kill forward ESC K Bind Key to function
X ^L Refresh the screen ESC L Lower case word
X ^M Insert <NL> ESC M Add global mode
X ^N Move forward by lines ESC N Goto End paragraph
X ^O Open up a blank line
X ^P Move backward by lines ESC P Goto Begining of paragraph
X ^Q Insert literal ESC Q Fill current paragraph
X ^R Search backwards ESC R Search and replace
X ^S Search forward
X ^T Transpose characters
X ^U Repeat command four times ESC U Upper case word
X ^V Move forward by pages ESC V Move backward by pages
X ^W Kill region ESC W Copy region to kill buffer
X ^Y Yank back from killbuffer ESC X Execute named command
X ^Z Move backward by pages ESC Z Save all buffers and exit
X
X ESC ^C Count words in region ESC ~ Unmark current buffer
X ESC ^E Execute named procedure
X ESC ^F Goto matching fence ESC ! Reposition window
X ESC ^H Delete backward word ESC < Move to start of buffer
X ESC ^K Unbind Key from function ESC > Move to end of buffer
X ESC ^L Reposition window ESC . Set mark
X ESC ^M Delete global mode ESC space Set mark
X ESC ^N Rename current buffer ESC rubout Delete backward word
X ESC ^R Search & replace w/query rubout Backward delete
X ESC ^S Change screen rows
X ESC ^T Change screen columns
X ESC ^V Scroll next window down
X ESC ^W Delete Paragraph
X ESC ^Z Scroll next window up
X
X ^X ? Describe a key ^X ! Run 1 command in a shell
X ^X = Show the cursor position ^X @@ Pipe shell command to buffer
X ^X ^ Enlarge display window ^X # Filter buffer thru shell filter
X ^X 0 Delete current window ^X $ Execute an external program
X ^X 1 Delete other windows ^X ( Begin macro
X ^X 2 Split current window ^X ) End macro
X ^X A Set variable value
X ^X ^B Display buffer list ^X B Switch a window to a buffer
X ^X ^C Exit MicroEMACS ^X C Start a new command processor
X ^X ^D Detab line ^X D Suspend MicroEMACS (BSD4.2 only)
X ^X ^E Entab line ^X E Execute macro
X ^X ^F Find file ^X F Set fill column
X ^X ^I Insert file
X ^X K Delete buffer
X ^X ^L Lower case region
X ^X ^M Delete Mode ^X M Add a mode
X ^X ^N Move window down ^X N Rename current filename
X ^X ^O Delete blank lines ^X O Move to the next window
X ^X ^P Move window up ^X P Move to the previous window
X ^X ^R Get a file from disk ^X R Incremental reverse search
X ^X ^S Save current file ^X S Incremental forward search
X ^X ^T Trim line (Incremental search
X ^X ^U Upper case region not always availible)
X ^X ^V View file
X ^X ^W Write a file to disk ^X W resize Window
X ^X ^X Swap "." and mark ^X X Use next buffer
X ^X ^Z Shrink window ^X Z Enlarge display window
X
X@u(Usable Modes)
XWRAP Lines going past right margin "wrap" to a new line
XVIEW Read-Only mode where no modifications are allowed
XCMODE Change behavior of some commands to work better with C
XEXACT Exact case matching on search strings
XOVER Overwrite typed characters instead of inserting them
XCRYPT Current buffer will be encrypted on write, decrypted on read
XMAGIC Use regular expression matching in searches
XASAVE Save the file every 256 inserted characters
X
XWHITE/CYAN/MAGENTA/YELLOW/BLUE/RED/GREEN/BLACK Sets foreground color
Xwhite/cyan/magenta/yellow/blue/red/green/black Sets background color
X@end(verbatim)
X@newpage
X@appendix(Supported machines)
X
X The following table lists all the hardware/compilers for which I
Xcurrently support MicroEMACS. This is not exclusive of all machines
Xwhich MicroEMACS will run on, but I have either run it myself, or had a
Xfirst hand report of it running.
X
X@begin(verbatim)
X@u(Hardware OS Compiler Comments)
XVAX 780 UNIX V5 native
X UNIX V7 native
X BSD 4.2 native job control supported
X *VMS native only some terminals supported
X
XNCR Tower UNIX V5 native
X
XFortune 32:16 UNIX V7 native
X
XIBM-PC MSDOS LATTICE 2.15 Large CODE/Large DATA
X 2.0 & 3.2 AZTEC 3.4e Small CODE/Large DATA
X TURBO C v1.00 LARGE memory model
X *MSC 4.0
X *MWC 86
X SCO XENIX native
X
XHP150 MSDOS Lattice 2.15 Function key labels
X for the touch screen
X
XHP110 MSDOS Lattice 2.15
X Aztec 3.4e
X
X*Data General 10
X MSDOS Lattice 2.15
X
X*Texas Instruments Professional
X MSDOS Lattice 2.15
X
XAmiga Intuition Lattice 3.03 no mouse or menus yet
X *Aztec 3
X
XST520 TOS Mark Williams C Spawns under MSH
X Lattice 3.10 (no shell commands)
X
X@u[Systems to be supported (ie some code is already written:)]
XMacintosh Finder 5.0 Aztec
X
X*means that I do not own or have access to the listed compiler and/or
X machine and must rely upon others to help support it.
X@end(verbatim)
X@newpage
X@appendix(Machine Dependent Notes)
X
X This appendix lists some notes specific to individual
Ximplementations of MicroEMACS. Every attempt has been made to allow
XEMACS to be identical on all machines, but we have also tried to take
Xadvantage of function keys, cursor keys, mice, and special screen modes
Xwhere possible.
X
X@appendixsection(IBM-PC/XT/AT and its clones)
X
X The IBM-PC family of computers is supported with a variety of
Xdifferent display adapters. EMACS will attempt to discover what adapter
Xis connected and use the proper driver for it. Below is a list of the
Xcurrently supported video adapters:
X
X@begin(verbatim)
X@u(Adapter $sres Original mode used)
XMonochrome Graphics Adapter MONO MONO
XColor Graphics Adapter CGA CGA
XEnhanced Graphics Adapter EGA CGA
X@end(verbatim)
X
X EMACS also takes advantege of various function keys and the keys
Xon the keypad on an IBM-PC. The function keys are initially not bound
Xto any particular functions (except by the emacs.rc startup file), but
Xthe keypad keys do default to the following:
X
X@begin(verbatim)
X@u(Keypad key Function)
XHome beginning-of-file
XCSRS UP previous-line
XPg Up previous-page
XCSRS LEFT backward-character
XCSRS RIGHT forward-character
XEnd end-of-file
XCSRS DOWN next-line
XPg Dn Next-page
X@end(verbatim)
X
X All these special keys are indicated in EMACS macroes by use of
Xthe @b(FN) prefix. Below is a list of many of the keys and the codes
Xused to specify them. Also the codes may be gotten by using the
Xdescribe-key (^X ?) command on the suspect key.
X@newpage
X@begin(verbatim)
X IBM PC function keys in MicroEmacs
X
X function Function ^function Alt-function
X f1) FN; FNT FN^ FNh
X f2) FN< FNU FN_ FNi
X f3) FN= FNV FN` FNj
X f4) FN> FNW FNa FNk
X f5) FN? FNX FNb FNl
X f6) FN@@ FNY FNc FNm
X f7) FNA FNZ FNd FNn
X f8) FNB FN[ FNe FNo
X f9) FNC FN\ FNf FNp
Xf10) FND FN] FNg FNq
X
Xhome) FNG FNw
XCsUp) FNH
XPgUp) FNI FNa(umlaut) {Alt 132}
XCsLf) FNK FNs
X 5 )
XCsRt) FNM FNt
X End) FNO FNu
XCsDn) FNP
XPgDn) FNQ FNv
X Ins) FNR
X Del) FNS
X@end(verbatim)
X@newpage
X@appendixsection(HP 150)
X
X This machine from Hewlett Packard is very unusual for an MSDOS
Xmachine. It has a touch screen and is very function key oriented. An
Xadditional command, @i(label-function-key)@index(label-function-key)
Xallows you to place labels on the on screen function key labels. A
Xnumeric argument indicates which function key to label (one through
Xeight) and then the program prompts for a 16 character label, which will
Xbe used as two lines of eight characters. To label function key three
Xwith "save file" from a macro, you would use:
X
X@verbatim(3 label-function-key "save file")
X
X Notice the 4 spaces after "save". This forces "file" to begin on
Xthe second line of the label.
X@newpage
X@appendixsection(Atari 520/1040ST)
X
X The ATARI ST family of computers have a dual personality. They
Xmay use either a monochrome or a color screen. EMACS supports two
Xscreen resolutions on each monitor.
X
X@begin(verbatim)
X@u(Monitor $sres size #color $palette format)
XColor LOW 40x25 16 000111222333444555666777
X MEDIUM 80x25 4 000111222333
XMono HIGH 80x25 2 000
X DENSE 80x50 2 000
X@end(verbatim)
X
X The $palette environment variable can be used to change what
Xcolor is associated with each color name. With a color monitor, each
Xgroup of three digits indicates an octal number specifying the RED,
XGREEN and BLUE levels of that color. Each color digit can vary from 0
Xto 7. For example, the initial setting of $palette in LOW resolution is:
X
X@begin(verbatim)
X 000700070770007707077777
X
X which broken up is:
X
X 000 700 070 770 007 707 077 777
X
X which means:
X
X 000 Black
X 700 Red
X 070 Green
X 770 Yellow
X 007 Blue
X 707 Magenta
X 077 Cyan
X 777 White
X@end(verbatim)
X
X Also the mouse generates FN prefix codes when moved, or when one
Xof the two buttons is pressed. Initially the movement of the mouse is
Xbound to movement of the cursor, and the left mouse button generates a
Xset-mark (M-space) command. The cursor keys and the function keys are
Xbound similarly to to IBM-PC.
X
X Files generated by EMACS on the ATARI ST have a single return
Xcharacter at the end of each line, unlike the desktop files which want
Xto have tow returns. This makes it display files strangly from GEM's
X[SHOW] option, but makes the files port to other computers much nicer.
X
X Currently, when operating under the Mark Williams MSH program,
XEMACS can shell out and perform external commands. This capability will
Xbe added later for the Beckmeyer shell and under GEMDOS.
X@newpage
X@appendixsection(Amiga 1000)
X
X The Commodore AMIGA 1000 version of MicroEMACS does not have
Xextensive support of the mouse or of pull down menus as of yet. It does
Xhowever come up in a window, and it is possible to re-size it to run in
Xdifferent sized windows. The @b(M-^S) @i(change-screen-size)
X@index(change-screen-size) takes its numeric argument as the new number
Xof lines for EMACS to use. The @b(M-^T) @i(change-screen-width)
X@index(change-screen-width) command allows you to change the number of
Xcolumns EMACS will use. The defaults for these are 23 lines and 77
Xcharacters across for a full screen window.
X
X@center(Note about Compiling MicroEMACS)
X
X@begin(quotation)
X If you are compiling the sources on the AMIGA to produce an
Xexecutable image, and you are using the Lattice compiler, be sure to
Xgive the CLI command 'STACK 40000' before compiling to make sure the
Xcompiler has sufficient stack space to successfully complete
Xcompiliation.
X@end(quotation)
X@newpage
X@appendixsection(UNIX V5, V7, and BSD4.[23])
X
X MicroEMACS under UNIX utilizes the @b(TERMCAP) @index(termcap)
Xlibrary to provide machine independent screen functions. Make sure that
Xtermcap is availible and properly set on your account before attempting
Xto use MicroEMACS.
X
X Under systems which support job control, you can use the
X@b(^X-D) @i(suspend-emacs) @index(suspend-emacs) command to place EMACS
Xinto the background. This carries a much smaller overhead than bringing
Xup a new shell under EMACS. EMACS will properly redraw the screen when
Xyou bring it back to the foreground.
X
X If the symbol VT100 has been set to 1 in the @i(estruct.h)
Xoptions file, EMACS will recognize the key sequence <ESC>[ as the lead
Xin sequence for the FN function key prefix.
X
X With the addition of some very machine/operating system specific
Xcode, EMACS can prevent two or more people from modifying the same file
Xat the same time. @index(file locking) The upper level of a set of
Xfunctions to provide file locking exist in the source file @b(LOCK.C).
XIt requires two machine specific functions written and linked into EMACS
Xfor it to operate properly.
X
X@begin(verbatim)
X char *dolock(fname)
X
X char *fname;
X
X dolock() locks a file, preventing others from modifying it. If
X it succeeds, it returns NULL, otherwise it returns a pointer to
X a string in the form "LOCK ERROR: explaination".
X
X char *undolock(fname)
X
X char *fname;
X
X undolock() unlocks a file, allowing others to modifying it. If
X it succeeds, it returns NULL, otherwise it returns a pointer to
X a string in the form "LOCK ERROR: explaination".
X@end(verbatim)
X@newpage
X@appendix(Mode Flags)
X
X The two environment variables, $cmode and $gmode, contain a
Xnumber the corresponds to the modes set for the current buffer and
Xthe editor as a whole. These are encoded as the sum of the following
Xnumbers for each of the possible modes:
X
X@begin(verbatim)
XWRAP 1 Word wrap
XCMODE 2 C indentation and fence match
XSPELL 4 Interactive spell checking (Not Implemented Yet)
XEXACT 8 Exact matching for searches
XVIEW 16 Read-only buffer
XOVER 32 Overwrite mode
XMAGIC 64 Regular expressions in search
XCRYPT 128 Encrytion mode active
XASAVE 256 Auto-save mode
X@end(verbatim)
X
X So, if you wished to set the current buffer to have CMODE,
XEXACT, and MAGIC on, and all the others off, you would add up the values
Xfor those three, CMODE 2 + EXACT 8 + MAGIC 64 = 74, and use a
Xstatement like:
X
Xset $cmode 74
X
X or, use the binary or operator to combine the different modes:
X
Xset $cmode &bor &bor 2 8 64
X
X@flushleft(@big[Internal Flags])
X
X Some of the ways EMACS controls its internal functions can be
Xmodified by the value in the $gflags environment variable. Each bit in
Xthis variable will be used to control a different function.
X
X@begin(verbatim)
XGFFLAG 1 If this bit is set to zero, EMACS will not
X automatically switch to the buffer of the
X first file after executing the startup macros.
X@end(verbatim)
FRIDAY_NIGHT
echo extracting - emacs.txt
sed 's/^X//' > emacs.txt << 'FRIDAY_NIGHT'
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X MicroEMACS
X
X Full Screen Text Editor
X Reference Manual (preliminary draft)
X
X Version 3.9e
X November 4, 1987
X
X (C)opyright 1987 by Daniel M. Lawrence
X Reference Manual (C)opyright 1987
X by Brian Straight and Daniel M. Lawrence
X All Rights Reserved
X
X MicroEMACS 3.9e can be copied and distributed
X freely
X for any non-commercial purposes. MicroEMACS 3.9e
X can
X only be incorporated into commercial software
X with
X the permission of the current author.
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X Introduction
X
X MicroEMACS is a tool for creating and changing documents,
X programs, and other text files. It is both relatively easy for
X the novice to use, but also very powerful in the hands of an
X expert. MicroEMACS can be extensively customized for the needs of
X the individual user.
X
X MicroEMACS allows several files to be edited at the same
X time. The screen can be split into different windows, and text
X may be moved freely from one window to the next. Depending on
X the type of file being edited, MicroEMACS can change how it
X behaves to make editing simple. Editing standard text files,
X program files and word processing documents are all possible at
X the same time.
X
X There are extensive capabilities to make word processing
X and editing easier. These include commands for string searching
X and replacing, paragraph reformatting and deleting, automatic
X word wrapping, word move and deletes, easy case controlling, and
X automatic word counts.
X
X For complex and repetitive editing tasks editing macroes
X can be written. These macroes allow the user a great degree of
X flexibility in determining how MicroEMACS behaves. Also, any and
X all the commands can be used by any keystroke by changing, or
X rebinding, what commands various keys are connected, or bound,
X to.
X
X Special features are also available to perform a diverse
X set of operations such as file encryption, automatic backup file
X generation, entabbing and detabbing lines, executing of DOS
X commands and filtering of text through other programs (like SORT
X to allow sorting text).
X
X History
X
X EMACS was originally a text editor written by Richard
X Stahlman at MIT in the early 1970s for Digital Equipment
X computers. Various versions, rewrites and clones have made an
X appearence since.
X
X This version of MicroEMACS is derived from code written
X by Dave G. Conroy in 1985. Later modifications were performed by
X Steve Wilhite and George Jones. In December of 1985 Daniel
X Lawrence picked up the then current source (version 2.0) and made
X extensive modifications and additions to it over the course of
X the next two years. Updates and support for the current version
X are still availible. The current program author can be contacted
X by writing to:
X
X USMAIL: Daniel Lawrence
X 617 New York St
X Lafayette, IN 47901
X
X
X
X
X
X
X
X
X
X
X
X UUCP: ihnp4!pur-ee!pur-phy!duncan!lawrence
X ARPA: nwd@j.cc.purdue.edu
X FIDO: Fido 201/2 The Programmer's Room (317) 742-5533
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X Basic Concepts MicroEMACS Reference Manual
X
X
X
X
X
X
X
X
X Chapter 1
X
X Basic Concepts
X
X
X The current version of MicroEMACS is 3.9e (Third major
X re-write, ninth public release, fifth minor edit), and for the
X rest of this document, we shall simply refer to this version as
X "EMACS". Any modifications for later versions will be listed in
X the appendixes at the end of this manual.
X
X
X 1.1 Keys and the Keyboard
X
X
X Many times throughout this manual we will be talking
X about commands and the keys on the keyboard needed to use them.
X There are a number of "special" keys which can be used and are
X listed here:
X
X <NL> NewLine which is also called RETURN or ENTER, this
X key is used to end different commands.
X
X ^ The control key can be used before any alphabetic
X character and some symbols. For example, ^C means
X to hold down the <CONTROL> key and type the C key
X at the same time.
X
X ^X The CONTROL-X key is used at the beginning of many
X different commands.
X
X META or M- This is a special EMACS key used to begin many
X commands as well. This key is pressed and then
X released before typing the next character. On
X most systems, this is the <ESC> key, but it can be
X changed. (consult appendix E to learn what key is
X used for META on your computer).
X
X Whenever a command is described, the manual will list the
X actual keystrokes needed to execute it in boldface using the
X above conventions, and also the name of the command in italics.
X
X
X 1.2 Getting Started
X
X
X In order to use EMACS, you must call it up from your
X system or computer's command prompt. On UNIX and MSDOS machines,
X
X
X 1
X
X
X
X
X
X
X MicroEMACS Reference Manual Basic Concepts
X
X
X just type "emacs" from the main command prompt and follow it with
X the <RETURN> or <ENTER> key (we will refer to this key as <NL>
X for "new-line" for the remainder of this manual). On the
X Macintosh, the Amiga, the ATARI ST and other icon based operating
X systems, double click on the uEMACS icon. Shortly after this, a
X screen similar to the one below should appear.
X
X
X 1.3 Parts and Pieces
X
X
X The screen is divided into a number of areas or windows.
X On some systems the top window contains a function list of
X unshifted and shifted function keys. We will discuss these keys
X later. Below them is an EMACS mode line which, as we will see,
X informs you of the present mode of operation of the editor--for
X example "(WRAP)" if you set EMACS to wrap at the end of each
X line. Under the mode line is the text window where text appears
X and is manipulated. Since each window has its own mode line,
X below the text window is it's mode line. The last line of the
X screen is the command line where EMACS takes commands and reports
X on what it is doing.
X
X ===============================================================================
X f1 search-> f2 <-search | MicroEMACS: Text Editor
X f3 hunt-> f4 <-hunt |
X f5 fkeys f6 help | Available function key Pages include:
X f7 nxt wind f8 pg[ ] | WORD PROG BOX
X f9 save f10 exit | [use the f8 key to load Pages]
X ===============================================================================
X -- MicroEMACS 3.9e () -- Function Keys
X ---------------------------------------
X ===============================================================================
X
X
X
X
X
X
X
X
X
X
X
X
X ===============================================================================
X -- MicroEMACS 3.9e () -- Main
X ------------------------------------------------
X ===============================================================================
X
X
X
X
X
X
X
X 2
X
X
X
X
X
X
X Basic Concepts MicroEMACS Reference Manual
X
X
X Fig 1: EMACS screen on an IBM-PC
X
X
X 1.4 Entering Text
X
X
X Entering text in EMACS is simple. Type the following
X sentence fragment:
X
X Fang Rock lighthouse, center of a series of mysterious
X and
X
X The text is displayed at the top of the text window. Now type:
X
X terrifying events at the turn of the century
X
X Notice the text to the left of the cursor disappears and
X a '$' sign appears. Don't panic--your text is safe!!! You've
X just discovered that EMACS doesn't "wrap" text to the next line
X like most word processors unless you hit <NL>. But since EMACS
X is used for both word processing, and text editing, it has a bit
X of a dual personality. You can change the way it works by
X setting various modes. In this case, you need to set WRAP mode,
X using the add-mode command, by typing ^X-M. The command line at
X the base of the screen will prompt you for the mode you wish to
X add. Type wrap followed by the <NL> key and any text you now
X enter will be wrapped. However, the command doesn't wrap text
X already entered. To get rid of the truncated line, delete
X characters with the <BACKSPACE> key until the '$' goes away. Now
X type in the words you deleted, watch how EMACS goes down to the
X next line at the right time. (In some versions of EMACS, WRAP is
X a default mode in which case you don't have to worry about the
X instructions relating to adding this mode.)
X
X Now let's type a longer insert. Hit <NL> a couple of
X times to tab down from the text you just entered. Now type the
X following paragraphs. Press <NL> twice to indicate a paragraph
X break.
X
X Fang Rock lighthouse, center of a series of mysterious
X and terrifying events at the turn of the century, is
X built on a rocky island a few miles of the Channel
X coast. So small is the island that wherever you stand
X its rocks are wet with sea spray.
X
X The lighthouse tower is in the center of the island. A
X steep flight of steps leads to the heavy door in its
X base. Winding stairs lead up to the crew room.
X
X
X
X
X
X
X
X
X 3
X
X
X
X
X
X
X MicroEMACS Reference Manual Basic Concepts
X
X
X 1.5 Basic cursor movement
X
X
X Now let's practice moving around in this text. To move
X the cursor back to the word "Winding," enter M-B previous-word.
X This command moves the cursor backwards by one word at a time.
X Note you have to press the key combination every time the cursor
X steps back by one word. Continuously pressing META and toggling
X B produces an error message. To move forward to the word
X "stairs" enter M-F, which moves the cursor forward by one word at
X a time.
X
X Notice that EMACS commands are usually mnemonic--F for
X forward, B for backward, for example.
X
X To move the cursor up one line, enter ^P previous-line,
X down one line ^N next-line. Practice this movement by moving the
X cursor to the word "terrifying" in the second line.
X
X The cursor may also be moved forward or backward in
X smaller increments. To move forward by one character, enter ^F
X forward-character, to move backward, ^B backward-character.
X EMACS also allows you to specify a number which is normally used
X to tell a command to execute many times. To repeat most
X commands, press META and then the number before you enter the
X command. Thus, the command META 5 ^F (M-5^F) will move the
X cursor forward by five characters. Try moving around in the text
X by using these commands. For extra practice, see how close you
X can come to the word "small" in the first paragraph by giving an
X argument to the commands listed here.
X
X Two other simple cursor commands that are useful to help
X us move around in the text are M-N next-paragraph which moves the
X cursor to the second paragraph, and M-P previous-paragraph which
X moves it back to the previous paragraph. The cursor may also be
X moved rapidly from one end of the line to the other. Move the
X cursor to the word "few" in the second line. Press ^A beginning-
X of-line. Notice the cursor moves to the word "events" at the
X beginning of the line. Pressing ^E end-of-line moves the cursor
X to the end of the line.
X
X Finally, the cursor may be moved from any point in the
X file to the end or beginning of the file. Entering M-> end-of-
X file moves the cursor to the end of the buffer, M-< beginning-of-
X file to the first character of the file.
X
X On the IBM-PC, the ATARI ST and many other machines, the
X cursor keys can also be used to move the cursor about. Also, if
X there is one available, moving the mouse will move the cursor.
X
X Practice moving the cursor in the text until you are
X comfortable with the commands we've explored in this chapter.
X
X
X
X
X 4
X
X
X
X
X
X
X Basic Concepts MicroEMACS Reference Manual
X
X
X 1.6 Saving your text
X
X
X When you've finished practicing cursor movement, save
X your file. Your file currently resides in a BUFFER. The buffer
X is a temporary storage area for your text, and is lost when the
X computer is turned off. You can save the buffer to a file by
X entering ^X-^S save-file. Notice that EMACS informs you that
X your file has no name and will not let you save it.
X
X To save your buffer to a file with a different name than
X it's current one (which is empty), press ^X^W write-file. EMACS
X will prompt you for the filename you wish to write. Enter the
X name fang.txt and press return. On a micro, the drive light will
X come on, and EMACS will inform you it is writing the file. When
X it finishes, it will inform you of the number of lines it has
X written to the disk.
X
X Congratulations!! You've just saved your first EMACS
X file!
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X 5
X
X
X
X
X
X
X MicroEMACS Reference Manual Basic Concepts
X
X
X
X
X
X
X Chapter 1 Summary
X
X
X In chapter 1, you learned how to enter text, how to use
X wrap mode, how to move the cursor, and to save a buffer. The
X following is a table of the commands covered in this chapter and
X their corresponding key bindings:
X
X Key Binding Keystroke Effect
X
X abort-command ^G aborts current command
X
X add-mode ^XM allows addition of EMACS
X mode such as WRAP
X
X backward-character ^B moves cursor left one character
X
X beginning-of-file M-< moves cursor to beginning of file
X
X beginning-of-line ^A moves cursor to beginning of line
X
X end-of-file M-> moves cursor to end of file
X
X end-of-line ^E moves cursor to end of line
X
X forward-character ^F moves cursor right one character
X
X next-line ^N moves cursor to next line
X
X next-paragraph M-N moves cursor to next paragraph
X
X next-word M-F moves cursor forward one word
X
X previous-line ^P moves cursor backward by one line
X
X previous-paragraph M-P moves cursor to previous paragraph
X
X previous-word M-B moves cursor backward by one word
X
X save-file ^X-^S saves current buffer to a file
X
X write-file ^X-^W save current buffer under a new
X name
X
X
X
X
X
X
X
X
X
X 6
X
X
X
X
X
X
X Basic Editing--Simple Insertions and Deletions MicroEMACS
X Reference Manual
X
X
X
X
X
X
X
X
X Chapter 2
X
X Basic Editing--Simple Insertions and Deletions
X
X
X 2.1 A Word About Windows, Buffers, Screens, and Modes
X
X
X In the first chapter, you learned how to create and save
X a file in EMACS. Let's do some more editing on this file. Call
X up emacs by typing in the following command.
X
X emacs fang.txt
X
X On icon oriented systems, double click on the uEMACS
X icon, usually a file dialog box of some sort will appear. Choose
X FANG.TXT from the appropriate folder.
X
X Shortly after you invoke EMACS, the text should appear on
X the screen ready for you to edit. The text you are looking at
X currently resides in a buffer. A buffer is a temporary area of
X computer memory which is the primary unit internal to EMACS --
X this is the place where EMACS goes to work. The mode line at the
X bottom of the screen lists the buffer name, FANG.TXT and the name
X of the file with which this buffer is associated, FANG.TXT
X
X The computer talks to you through the use of its screen.
X This screen usually has an area of 24 lines each of 80 characters
X across. You can use EMACS to subdivide the screen into several
X separate work areas, or windows, each of which can be 'looking
X into' different files or sections of text. Using windows, you
X can work on several related texts at one time, copying and moving
X blocks of text between windows with ease. To keep track of what
X you are editing, each window is identified by a mode line on the
X last line of the window which lists the name of the buffer which
X it is looking into, the file from which the text was read, and
X how the text is being edited.
X
X An EMACS mode tells EMACS how to deal with user input.
X As we have already seen, the mode 'WRAP' controls how EMACS deals
X with long lines (lines with over 79 characters) while the user is
X typing them in. The 'VIEW' mode, allows you to read a file
X without modifying it. Modes are associated with buffers and not
X with files; hence, a mode needs to be explicitly set or removed
X every time you edit a file. A new file read into a buffer with a
X previously specified mode will be edited under this mode. If you
X
X
X
X 7
X
X
X
X
X
X
X MicroEMACS Reference Manual Basic Editing--Simple Insertions and
X Deletions
X
X
X use specific modes frequently, EMACS allows you to set the modes
X which are used by all new buffers, called global modes.
X
X
X 2.2 Insertions
X
X
X Your previously-saved text should look like this:
X
X Fang Rock lighthouse, center of a series of mysterious
X and terrifying events at the turn of the century, is
X built on a rocky island a few miles of the Channel
X coast. So small is the island that wherever you stand
X its rocks are wet with sea spray.
X
X The lighthouse tower is in the center of the island. A
X steep flight of steps leads to the heavy door in its
X base. Winding stairs lead up to the crew room.
X
X Let's assume you want to add a sentence in the second
X paragraph after the word "base." Move the cursor until it is on
X the "W" of "Winding". Now type the following:
X
X This gives entry to the lower floor where the big steam
X generator throbs steadily away, providing power for the
X electric lantern.
X
X If the line fails to wrap and you end up with a '$' sign
X in the right margin, just enter M-Q fill-paragraph to reformat
X the paragraph. This new command attempts to fill out a
X paragraph. Long lines are divided up, and words are shuffled
X around to make the paragraph look nicer.
X
X Notice that all visible EMACS characters are self-
X inserting -- all you had to do was type the characters to insert
X and the existing text made space for it. With a few exceptions
X discussed later, all non-printing characters (such as control or
X escape sequences) are commands. To insert spaces, simply use the
X space bar. Now move to the first line of the file and type ^O
X open-line (Oh, not zero). You've just learned how to insert a
X blank line in your text.
X
X
X 2.3 Deletions
X
X
X EMACS offers a number of deletion options. For example,
X move the cursor until it's under the period at the end of the
X insertion you just did. Press the backspace key. Notice the "n"
X on "lantern" disappeared. The backspace implemented on EMACS is