home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / EDITOR / MG2A_SRC.ZIP / MG.TEX < prev    next >
Encoding:
Text File  |  1988-08-23  |  51.1 KB  |  1,333 lines

  1. \batchmode %be nice to fellow VAXers
  2. \hoffset=0in \voffset=0in %correct dvi2ln3 bug
  3. \documentstyle[11pt,titlepage]{report}
  4. %\pagestyle{headings} %not sure on this one yet
  5. %\parindent=0in
  6. \textwidth=6in
  7. \oddsidemargin=0.25in
  8.  
  9. % definitions for DEFINE environment
  10. \newlength{\lblwide}
  11. \newcommand{\resetmarg}{\settowidth{\leftmargin}{\makebox[\lblwide]{}\makebox[\labelsep]{}}}
  12. \newcommand{\resetlbl}{\setlength{\labelwidth}{\lblwide}} 
  13. \newenvironment{define}[1]{\begin{list}{}{\settowidth{\lblwide}{\bf #1}\resetmarg \resetlbl}}{\end{list}}
  14.  
  15. % definitions for fn environment
  16.  
  17. \newcommand{\fname}[3]{\hspace{1em}\\{\tt #1}\index{#1} {\it #2}\hfill{\tt #3}}
  18. \newcommand{\fmore}[3]{\\{\tt #1}\index{#1} {\it #2}\hfill{\tt #3}}
  19. \newcommand{\fbody}{\\[0.5em]}
  20.  
  21. % definitions for making the index
  22. \newcommand{\indexentry}[2]{\item {\tt #1} \dotfill\  #2}
  23.  
  24.  
  25. \setcounter{secnumdepth}{5} %personal preference
  26. \setcounter{tocdepth}{5} %personal preference
  27. \author{Sandra J. Loosemore}
  28. \title{The MG Reference Manual \\ Release MG2A}
  29. \date{\vspace{1.5in}
  30. Copyright \copyright 1987, Sandra J. Loosemore \\[0.5em]
  31. \parbox{5 in}{This document, or sections of this document, may be freely
  32. redistributed provided that the copyright notice and the following disclaimer
  33. remain intact:  The author bears no responsibilities for errors in
  34. this document or the software it describes; and shall not be held liable
  35. for any indirect, incidental, or consequential damages.}}
  36.  
  37. \makeindex %usually not
  38.  
  39. \begin{document}
  40. \maketitle
  41.  
  42. \tableofcontents
  43.  
  44. \chapter{Introduction}
  45.  
  46. MG is a small, fast, and portable Emacs-style text editor intended to
  47. be used by people who can't run a real Emacs for one reason or another
  48. --- as their main editor on smaller machines with limited memory or
  49. file space, or as a ``quick-start'' editor on larger systems, useful
  50. for composing short mail messages and the like. 
  51.  
  52. We've made MG compatible with GNU Emacs because that is the ``big'',
  53. full-featured editor that many of us use regularly and are most
  54. familiar with.  GNU Emacs is the creation of Richard M. Stallman, who
  55. was also the author of the original Emacs editor.  However, MG is not
  56. associated in any way with the GNU project, and the MG authors
  57. individually may or may not agree with the opinions expressed by
  58. Richard Stallman and the GNU project. 
  59.  
  60. MG is largely public domain.  You can use, modify, and redistribute MG
  61. as you like.  A few modules, however, are copyrighted; specifically,
  62. the regular expression code, the VMS termcap routines, and the Amiga
  63. support code.  Look at the source code for the exact copyright
  64. restrictions. 
  65.  
  66. There are several other editors in existence which call themselves
  67. MicroEmacs.  The original public domain version was written by Dave
  68. Conroy and circulated as version 1.6.  Derived from this, there is
  69. another PD version by Dave Conroy numbered v30; a significantly larger
  70. PD version by Daniel Lawrence which is now up to version 3.9; at least
  71. one proprietary implementation; an implementation for the Atari ST
  72. with an integrated command shell, by Prabhaker Mateti; and probably
  73. others that we don't know about.
  74.  
  75. MG is derived from the v30 MicroEmacs, with key bindings, command
  76. names, and general functionality made more compatible with GNU Emacs.
  77. Like v30, MG is fairly small and quite robust.  We have generally
  78. resisted the temptation to overfeaturize.  Some features which are
  79. large and complex are flagged for conditional compilation.
  80.  
  81. Many people have contributed their time to developing, improving, and
  82. porting MG.  Mike Meyer, Mic Kaczmarczik, and Bob Larson deserve 
  83. particular mention for their efforts.  
  84.  
  85. Questions, suggestions, and offers of help should be addressed to:
  86.  
  87. \begin{verbatim}
  88.         mg-developers@ucbvax.berkeley.edu   (ARPA)
  89.         ucbvax!mg-developers                (UUCP)
  90. \end{verbatim}
  91.  
  92. \section{Implementations of MG}
  93.  
  94. MG runs on many different kinds of hardware under many different 
  95. operating systems.  Currently, these include:
  96.  
  97. \begin{itemize}
  98.  
  99. \item 4.2 and 4.3 BSD Unix (including Ultrix-32)
  100. \item System V Unix
  101. \item VAX/VMS
  102. \item Primos
  103. \item OS9/68k
  104. \item Amiga
  105. \item Atari ST
  106. \item MS-DOS
  107.  
  108. \end{itemize}
  109.  
  110. This document describes release MG2A.  When we talk of different
  111. versions of MG in this manual, the term {\em version\/} is used to
  112. refer to the different support MG provides for the various machines
  113. and operating systems it runs under, not to different releases of MG
  114. itself.  For example, we might speak of how the VMS version of MG
  115. differs from the Unix version.
  116.  
  117. As mentioned above, some MG commands may not be implemented in all
  118. versions; these are noted in the documentation.  Some versions of MG
  119. also support features (such as mouse handling) that are not described
  120. here.
  121.  
  122. \section{A Note on Character Sets}
  123.  
  124. MG uses the 128-character ASCII character set, and provides support for
  125. 8-bit characters.  Whether the particular version of MG that you are running
  126. knows about extended character sets depends on whether your terminal and
  127. the host operating system know about them.  Moreover, since there is no
  128. standard 8-bit character set, the same character codes will probably
  129. give different glyphs on different systems.  Most versions of MG use
  130. the DEC multinational character set.
  131.  
  132. \section{Notation and Conventions}
  133.  
  134. In this manual, commands and other things that must be typed in 
  135. literally are indicated in a typewriter font, like {\tt next-line}.
  136. Placeholders such as command argument names use an italic font.
  137.  
  138. The terms {\em command\/} and {\em function\/} are synonymous.  We often
  139. speak of a command being bound to a particular {\em key\/}, although you 
  140. may actually have to type more than one character to form a single key.
  141. Most commands are bound to keys with {\em control\/} and {\em meta\/} 
  142. modifiers.
  143.  
  144. To type a control character, use the control key on your
  145. keyboard like a shift key:  hold down the control key while typing the
  146. character.  In this manual, we will indicate control characters like
  147. \verb"C-x" --- here, typing the character ``x'' while holding down
  148. the control key.
  149.  
  150. Some keyboards also have a meta key that works like the control
  151. key.  (It may be labelled something else;  on the Atari ST, for example,
  152. the key marked  ``Alternate'' is the meta key.)  If your keyboard doesn't
  153. have a meta key, don't panic.  You can also use the escape key as a meta
  154. prefix; first type the escape, and {\em then\/} the character.  Meta
  155. characters will be indicated as \verb"M-x".
  156.  
  157. Besides the meta prefix, two other characters are used as prefixes:
  158. \verb"C-x" and \verb"C-h".  A few keys have special notation:  {\tt SPC} is
  159. the space character, {\tt DEL} is the delete or rubout character, {\tt RET}
  160. is carriage return, and {\tt ESC} is the escape character.  {\tt NUL} is 
  161. the null character (ASCII 0), which is usually equivalent to either 
  162. \verb"C-SPC" or \verb"C-@".
  163.  
  164. Uppercase and lowercase characters are generally equivalent in command
  165. keystrokes.
  166.  
  167. When you run MG from a shell, command line arguments are interpreted as the
  168. names of files you want to {\em visit\/}, or edit.  Each file is 
  169. read into a {\em buffer\/} in memory.  No changes are actually made to 
  170. the file until you ask it to be written out to disk.
  171.  
  172. Within MG, the large top part of the screen serves as a {\em window\/} into
  173. the buffer being edited.  Below this is the {\em mode line\/}, which 
  174. displays the name of the buffer.  Finally, at the very bottom of the screen,
  175. there is a one-line {\em minibuffer\/} which is used for displaying
  176. messages and answering questions.
  177.  
  178. MG keeps track of two pointers into each window, the {\em point\/} and the
  179. {\em mark\/}.  The {\em cursor\/} appears at the point in the current
  180. window, and we often speak of moving the cursor rather than of moving the
  181. point.  The text between the point and the mark is referred to as the {\em
  182. region\/}.
  183.  
  184. Some commands deal with {\em words\/} and {\em paragraphs\/}.
  185. Generally, whitespace and punctuation separate words.  Lines that are
  186. empty or that contain only spaces or tabs separate paragraphs without
  187. being part of a paragraph.  A non-empty line that starts with a space
  188. or tab also begins a new paragraph. 
  189.  
  190. A number of commands are defined as {\em toggles\/}.  If no prefix argument
  191. is supplied, these commands toggle an action.  The action is turned on if a 
  192. negative or zero argument is supplied, and turned on if a positive argument
  193. is supplied.
  194.  
  195. \section{Getting Started}
  196.  
  197. This document is intended primarily as a reference manual.  If you
  198. have never used any Emacs-like text editor before, it is strongly
  199. suggested that you run the on-line tutorial supplied with the MG
  200. distribution, instead of reading this manual.
  201.  
  202. Do not be put off by the large number of commands described in this
  203. manual!  It is possible to get by with only a handful of basic commands.
  204. Here are the ones that are probably used most frequently:
  205.  
  206. \begin{define}{\hspace{1in}}
  207. \item[{\tt C-p}\hfill] Move the cursor to the previous line
  208. \item[{\tt C-n}\hfill] Move the cursor to the next line
  209. \item[{\tt C-b}\hfill] Move the cursor backwards
  210. \item[{\tt C-f}\hfill] Move the cursor forwards
  211. \item[{\tt C-v}\hfill] Scroll forwards one screenful
  212. \item[{\tt M-v}\hfill] Scroll backwards one screenful
  213. \item[{\tt M-<}\hfill] Go to the beginning of the buffer
  214. \item[{\tt M->}\hfill] Go to the end of the buffer
  215. \item[{\tt C-a}\hfill] Go to the beginning of the line
  216. \item[{\tt C-e}\hfill] Go to the end of the line
  217. \item[{\tt DEL}\hfill] Delete the previous character
  218. \item[{\tt C-k}\hfill] Kill (delete) to the end of line
  219. \item[{\tt C-y}\hfill] Reinsert killed text.
  220. \item[{\tt C-x C-c}\hfill] Exit MG
  221. \item[{\tt C-x C-s}\hfill] Save the current buffer
  222. \end{define}
  223.  
  224. \chapter{Using Commands}
  225.  
  226. \section{Command Arguments}
  227.  
  228. Some commands require arguments.  For example, if you want to read a
  229. file into a buffer, you must type in the name of the file.  In the
  230. descriptions of commands in this manual, if arguments are required,
  231. they are listed following the command name.
  232.  
  233. MG prompts for command arguments in the minibuffer.  Within the minibuffer,
  234. the following characters can be used for editing:
  235.  
  236. \begin{define}{\hspace{1in}}
  237. \item[{\tt DEL, C-h}\hfill] Erase the last character. 
  238. \item[{\tt C-x, C-u}\hfill] Erase the entire input line. 
  239. \item[{\tt C-w}\hfill] Erase to the beginning of the previous word. 
  240. \item[{\tt C-q, $\backslash$}\hfill] Quote the next character typed. 
  241. \item[{\tt RET}\hfill] Signifies that you have completed typing in 
  242. the argument. 
  243. \item[{\tt C-g}\hfill] Abort the command in progress.
  244. \end{define}
  245.  
  246. \section{Prefix Arguments}
  247.  
  248. All commands accept an optional numeric prefix argument.  This is
  249. often interpreted as a repetition count.  For example, the function
  250. {\tt next-line}, if given a prefix argument, will move the cursor
  251. forward that many lines; without an argument, it will move the cursor
  252. forward one line.  A few commands behave differently if given a prefix
  253. argument than they do without one, and others ignore the prefix
  254. argument entirely. 
  255.  
  256. \fname{digit-argument}{}{M-0, M-1, M-2, M-3, M-4, M-5, M-6, M-7, M-8, M-9}
  257. \fmore{negative-argument}{}{M--} 
  258. \fbody One way to specify a command argument is to use the escape key
  259. as a meta prefix, and then type one or more digits.  A dash may be
  260. used for a negative argument.
  261.  
  262. \fname{universal-argument}{}{C-u}
  263. \fbody Another way to specify a command prefix is to type {\tt C-u}.
  264. Typing one {\tt C-u} is equivalent to a prefix argument of 4, typing
  265. two gives a value of 16, and so on.  In addition, you can type digits
  266. following {\tt C-u} to form a numeric prefix argument.
  267.  
  268. \section{Aborting}
  269.  
  270. \fname{keyboard-quit}{}{C-g}
  271. \fbody Typing {\tt C-g} cancels any command.  It is particularly useful
  272. for cancelling a command when MG is prompting for input in the minibuffer.
  273.  
  274. \section{Extended Commands}
  275.  
  276. \fname{execute-extended-command}{command}{M-x}
  277. \fbody Commands that are not bound to keys can be executed through 
  278. {\tt execute extended-command}.  If a prefix argument is supplied, it
  279. is passed to the command being executed.
  280.  
  281.  
  282. \chapter{Moving the Cursor}
  283.  
  284. The commands described in this chapter move the cursor (sometimes
  285. called the point or dot) within the current window.  Commands which
  286. set the mark are included here as well.
  287.  
  288. \fname{backward-char}{}{C-b}
  289. \fbody Moves the cursor backward (left) one character.  If the cursor
  290. is at the left margin, it will be moved to the end of the previous line.
  291.  
  292. \fname{backward-paragraph}{}{M-[}
  293. \fbody Moves the cursor backwards to the beginning of the current
  294. paragraph, or to the beginning of the previous paragraph if the cursor
  295. is already at the beginning of a paragraph.
  296.  
  297. \fname{backward-word}{}{M-b}
  298. \fbody Moves the cursor backwards to the beginning of the current word,
  299. or to the beginning of the previous word if the cursor is already at
  300. the beginning of a word.
  301.  
  302. \fname{beginning-of-buffer}{}{M-<}
  303. \fbody Moves the cursor backwards to the beginning of the buffer.
  304.  
  305. \fname{beginning-of-line}{}{C-a}
  306. \fbody Moves the cursor backwards to the beginning of the current
  307. line.  This command has no effect if the cursor is already at the beginning
  308. of the line.
  309.  
  310. \fname{end-of-buffer}{}{M->}
  311. \fbody Moves the cursor forwards to the end of the buffer.
  312.  
  313. \fname{end-of-line}{}{C-e}
  314. \fbody Moves the cursor forwards to the end of the current line.  This
  315. command has no effect if the cursor is already at the end of the line.
  316.  
  317. \fname{exchange-point-and-mark}{}{C-x C-x}
  318. \fbody Set the mark at the current cursor position, and move the cursor
  319. to the old location of the mark.
  320.  
  321. \fname{forward-char}{}{C-f}
  322. \fbody Moves the cursor forwards one character.  If the cursor is at the
  323. end of a line, it will be moved to the first character on the next line.
  324.  
  325. \fname{forward-paragraph}{}{M-]}
  326. \fbody Moves the cursor forwards to the next paragraph delimiter.
  327.  
  328. \fname{forward-word}{}{M-f}
  329. \fbody Moves the cursor forwards to the end of the current word, or to
  330. the end of the next word if the cursor is already at the end of a word.
  331.  
  332. \fname{goto-line}{line-number}{}
  333. \fbody Moves the cursor to the beginning of line {\em line-number\/} in
  334. the buffer.
  335.  
  336. \fname{next-line}{}{C-n}
  337. \fbody Moves the cursor down one line.  The cursor remains in the same
  338. column unless it would be past the end of the line, in which case it is
  339. moved to the end of the line.  At the end of the buffer, {\tt C-n} will
  340. create new lines.
  341.  
  342. \fname{previous-line}{}{C-p}
  343. \fbody Moves the cursor up one line.    The cursor remains in the same
  344. column unless it would be past the end of the line, in which case it is
  345. moved to the end of the line.
  346.  
  347. \fname{recenter}{}{C-l}
  348. \fbody Redraws the entire screen, scrolling the current window if necessary
  349. so that the cursor is near the center.  With a positive prefix argument 
  350. {\em n\/}, the window is scrolled so that the cursor is {\em n\/} lines
  351. from the top.  A negative prefix argument puts the cursor that many lines
  352. from the bottom of the window.
  353.  
  354. \fname{redraw-display}{}{}
  355. \fbody Redraws the entire screen, but never scrolls.
  356.  
  357. \fname{scroll-down}{}{M-v}
  358. \fbody Scrolls the display down (moving backward through the
  359. buffer).  Without 
  360. an argument, it scrolls slightly less than one windowful.  A prefix argument
  361. scrolls that many lines.
  362.  
  363. \fname{scroll-one-line-down}{}{}
  364. \fmore{scroll-one-line-up}{}{}
  365. \fbody These functions are similar to {\tt scroll-down} and {\tt scroll-up}
  366. (respectively), but when invoked without an argument, cause the display 
  367. to scroll by one line only.  These functions are enabled by defining the
  368. compile-time option GOSMACS.
  369.  
  370. \fname{scroll-other-window}{}{M-C-v}
  371. \fbody Scrolls the ``other'' window forward as for {\tt scroll-up}.
  372.  
  373. \fname{scroll-up}{}{C-v}
  374. \fbody Scrolls the display up (moving forward through the buffer).  Without an
  375. an argument, it scrolls slightly less than one windowful.  A prefix argument
  376. scrolls that many lines.
  377.  
  378. \fname{set-mark-command}{}{NUL}
  379. \fbody Set the mark at the current cursor position.
  380.  
  381. \fname{what-cursor-position}{}{C-x =}
  382. \fbody Prints some information in the minibuffer about where the cursor is.
  383.  
  384.  
  385. \chapter{Text Insertion Commands}
  386.  
  387. The usual way to insert text into a buffer is simply to type the
  388. characters.  The default binding for all of the printing characters
  389. ({\tt self-insert-command}) causes them to be inserted literally at
  390. the cursor position. 
  391.  
  392. \fname{insert}{string}{}
  393. \fbody Insert {\em string\/} into the current buffer at the cursor position.
  394.  
  395. \fname{newline}{}{RET}
  396. \fbody Insert a line break into the current buffer at the cursor position,
  397. moving the cursor forward to the beginning of the new line.
  398.  
  399. \fname{newline-and-indent}{}{C-j}
  400. \fbody Insert a line break into the current buffer at the cursor position,
  401. then add extra whitespace so that the cursor is aligned in the same
  402. column as the first non-whitespace character in the previous line.
  403.  
  404. \fname{open-line}{}{C-o}
  405. \fbody Inserts a line break into the current buffer at the current position,
  406. but does not move the cursor forward.
  407.  
  408. \fname{quoted-insert}{}{C-q} 
  409. \fbody This command acts as a prefix to
  410. cancel the normal interpretation of the next keystroke.  If {\tt C-q}
  411. is followed by one to three octal digits, it is interpreted as the
  412. code of the character to insert.  Otherwise a single key is read and
  413. the character typed is inserted into the buffer instead of interpreted
  414. as a command.  This is used for inserting literal control characters
  415. into a buffer. 
  416.  
  417. \fname{self-insert-command}{}{}
  418. \fbody This is the default binding for keys representing printable
  419. characters.  The character is inserted into the buffer at the cursor
  420. position, and the cursor moved forward.
  421.  
  422. \chapter{Killing, Deleting, and Moving Text}
  423.  
  424. When text is deleted, it is erased completely.  Killing text, on the
  425. other hand, moves it into a temporary storage area called the kill
  426. buffer.  The saved text in the kill buffer is erased when another
  427. block of text is killed.  Until then, however, you can retrieve text
  428. from the kill buffer.  This can be used to move or copy blocks of
  429. text, as well as to restore accidentally killed text.
  430.  
  431. \fname{backward-kill-word}{}{M-DEL}
  432. \fbody Kill the text backwards from the cursor position to the beginning
  433. of the current word.  Typing {\tt M-DEL} several times in succession 
  434. prepends each killed word to the kill buffer.
  435.  
  436. \fname{copy-region-as-kill}{}{M-w}
  437. \fbody Copies the text in the region into the kill buffer, without removing
  438. it from the current buffer.
  439.  
  440. \fname{delete-backward-char}{}{DEL}
  441. \fbody Deletes the character to the left of the cursor.
  442.  
  443. \fname{delete-blank-lines}{}{C-x C-o}
  444. \fbody Deletes all blank lines after the current line, and if the current
  445. line is blank, deletes it and all blank lines preceeding it as well.
  446.  
  447. \fname{delete-char}{}{C-d}
  448. \fbody Deletes the character underneath the cursor.
  449.  
  450. \fname{delete-horizontal-space}{}{M-$\backslash$}
  451. \fbody Deletes all spaces and tabs on either side of the cursor.
  452.  
  453. \fname{just-one-space}{}{M-SPC}
  454. \fbody This is like {\tt delete-horizontal-space}, except it leaves a single
  455. space at the cursor position.
  456.  
  457. \fname{kill-line}{}{C-k}
  458. \fbody If no prefix argument is specified, this function kills text up
  459. to the next newline; or if the cursor is at the end of a line, the newline
  460. is killed.  A prefix argument specifies how many lines to kill.  Typing
  461. {\tt C-k} several times in succession appends each line to the kill buffer.
  462.  
  463. \fname{kill-paragraph}{}{}
  464. \fbody This command kills the entire paragraph containing the cursor.
  465. If the cursor is positioned between paragraphs, the next paragraph is killed.
  466.  
  467. \fname{kill-region}{}{C-w}
  468. \fbody The region (all text between point and mark) is killed.
  469.  
  470. \fname{kill-word}{}{M-d}
  471. \fbody Text is killed forward from the cursor position to the next
  472. end of word.  If the cursor is at the end of the word, then the next
  473. word is killed.  Typing {\tt M-d} several times appends the killed
  474. text to the kill buffer.
  475.  
  476. \fname{yank}{}{C-y}
  477. \fbody Text is copied from the kill buffer into the current buffer at
  478. the cursor position.  The cursor is moved to the end of the inserted
  479. text.
  480.  
  481. \chapter{Searching and Replacing}
  482.  
  483. \section{Searching}
  484.  
  485. The ordinary search command in MG differs from that in many other editors
  486. in that it is incremental:  it begins searching as soon as you begin
  487. typing the search string, instead of waiting for you to type the entire
  488. string.
  489.  
  490. All of the search commands described in this section are case-insensitive.
  491.  
  492.  
  493. \fname{isearch-backward}{pattern}{C-r}
  494. \fmore{isearch-forward}{pattern}{C-s}
  495. \fbody These commands perform an incremental search backward and 
  496. forward (respectively) for {\em pattern\/}.  MG will move the cursor 
  497. to the place in the buffer that matches as much of the pattern as you 
  498. have typed so far, as each character is entered.
  499.  
  500.  
  501. Within the incremental search, the following characters are interpreted
  502. specially:
  503.  
  504. \begin{define}{\hspace{1in}}
  505.  
  506. \item[{\tt DEL}\hfill] Erase the last character in the search string. 
  507.  
  508. \item[{\tt ESC}\hfill] Stop searching; exit from incremental search
  509. mode, leaving the cursor where the search brought it. 
  510.  
  511. \item[{\tt C-g}\hfill] If a match has been found, exits from
  512. incremental search but leaves the cursor in its original position.  If
  513. the search has failed, this will just erase the characters which have
  514. not been found from the end of the search pattern.  In this case, you
  515. must type \verb"C-g" again to abort the search. 
  516.  
  517. \item[{\tt C-s}\hfill] Search forward for the next occurrence of the
  518. same pattern. 
  519.  
  520. \item[{\tt C-r}\hfill] Search backward for the previous occurrence of
  521. the same pattern. 
  522.  
  523. \item[{\tt C-q}\hfill] ``Quotes'' the next character typed, forcing it
  524. to be interpreted as a literal character in the search pattern.
  525. \end{define}
  526.  
  527. In addition, normal commands such as \verb"C-a" that do not have special
  528. meanings within incremental search cause the search to be terminated, and
  529. then are executed in the ordinary way.
  530.  
  531. \fname{search-again}{}{}
  532. \fmore{search-backward}{pattern}{M-r}
  533. \fmore{search-forward}{pattern}{M-s}
  534. \fbody These commands perform ordinary, non-incremental searches.
  535. {\tt Search-again} uses the same pattern and direction as the previous
  536. search.
  537.  
  538. \section{Replacing}
  539.  
  540. \fname{query-replace}{pattern replacement}{M-\%}
  541. \fbody The primary replace command in MG is an interactive query replace.
  542. MG searches forward for occurrences of {\em pattern\/}, and asks you what
  543. to do about each one.  The choices are:
  544.  
  545. \begin{define}{\hspace{1in}}
  546.  
  547. \item[{\tt SPC}\hfill] Replace this match with {\em replacement\/},
  548. and go on to the next. 
  549.  
  550. \item[{\tt DEL}\hfill] Skip to the next match without replacing this one. 
  551.  
  552. \item[{\tt .}\hfill] Replace this match, and then quit. 
  553.  
  554. \item[{\tt !}\hfill] Replace all remaining occurrences without asking again. 
  555.  
  556. \item[{\tt ESC}\hfill] Quit.
  557. \end{define}
  558.  
  559. By default, {\tt query-replace} adjusts the case of lower-case letters
  560. in the replacement string to match that of the
  561. particular occurrence of the pattern; for example, replacing ``Foo''
  562. with ``bar'' results in ``Bar''.  Upper case letters in the replacement
  563. string are always left uppercase.   In addition, supplying a prefix argument
  564. will also tell {\tt query-replace} to leave the case of the replacement
  565. string as-is.
  566.  
  567. Note that {\tt query-replace} always performs a case-insensitive search.
  568.  
  569.  
  570.  
  571. \section{Regular Expressions}
  572.  
  573. Regular expressions provide a means for specifying complex search
  574. patterns, instead of just a literal string.  The commands in this
  575. section are available only if MG is compiled with the REGEX option
  576. defined. 
  577.  
  578. Regular expression syntax uses the following rules.  Most characters
  579. in a regular expression are considered to be {\em ordinary\/} characters,
  580. and will match themselves and nothing else.  The exceptions are the
  581. special characters listed below.
  582.  
  583. \begin{define}{\hspace{1in}}
  584.  
  585. \item[{\tt .}\hfill] Matches any single character except a newline.  
  586.  
  587. \item[{\tt *}\hfill] A suffix operator that matches zero or more
  588. repetitions of the (smallest) preceding regular expression. 
  589.  
  590. \item[{\tt +}\hfill] A suffix operator that matches one or more
  591. repetitions of the (smallest) preceding regular expression. 
  592.  
  593. \item[{\tt ?}\hfill] A suffix operator that matches either zero or one
  594. occurence of the (smallest) preceding regular expression. 
  595.  
  596. \item[{\tt [\ldots]}\hfill] Matches any one character listed in the
  597. character set between the square brackets.  See examples below. 
  598.  
  599. \item[{\tt \^{ }}\hfill] Matches at the beginning of a line. 
  600.  
  601. \item[{\tt \$}\hfill] Matches at the end of a line. 
  602.  
  603. \item[{\tt $\backslash$}\hfill] Except for the situations listed
  604. below, acts as a prefix operator which causes the character following
  605. to be treated as an ordinary character. 
  606.  
  607. \item[{\tt $\backslash$|}\hfill] An infix binary {\em or\/} operator.
  608. It applies to the two largest surrounding expressions. 
  609.  
  610. \item[{\tt $\backslash$(\ldots$\backslash$)}\hfill] A grouping construct,
  611. usually used to specify a larger expression for postfix operators such
  612. as \verb"*" or to limit the scope of operands to \verb"\|". 
  613.  
  614. \item[{\tt $\backslash${\em digit\/}}\hfill] Matches the same text
  615. matched by the {\em digit\/}th \verb"\(...\)" construct.  These are
  616. numbered from 1 to 9 in the order that the open-parentheses appear. 
  617.  
  618. \item[{\tt $\backslash$`}\hfill] Matches at the beginning of the buffer. 
  619.  
  620. \item[{\tt $\backslash$'}\hfill] Matches at the end of the buffer. 
  621.  
  622. \item[{\tt $\backslash$b}\hfill] Matches at the beginning or end of a word. 
  623.  
  624. \item[{\tt $\backslash$B}\hfill] Matches anyplace {\em except\/} at
  625. the beginning or end of a word. 
  626.  
  627. \item[{\tt $\backslash$<}\hfill] Matches at the beginning of a word. 
  628.  
  629. \item[{\tt $\backslash$>}\hfill] Matches at the end of a word. 
  630.  
  631. \item[{\tt $\backslash$w}\hfill] Matches any word-constituent character. 
  632.  
  633. \item[{\tt $\backslash$W}\hfill] Matches any character which is {\em
  634. not\/} a word-constituent. 
  635.  
  636. \end{define}
  637.  
  638. Some examples may help clarify the rules.
  639.  
  640. \begin{define}{\hspace{1in}}
  641.  
  642. \item[{\tt foo}\hfill] Matches the literal string {\tt foo}. 
  643.  
  644. \item[{\tt ;.*}\hfill] Matches all strings which begin with a
  645. semicolon and continue to the end of a line. 
  646.  
  647. \item[{\tt c[ad]+r}\hfill] Matches strings of the form {\tt car}, {\tt
  648. cdr}, {\tt caar}, {\tt cadr}, and so on. 
  649.  
  650. \item[{\tt [a-z]}\hfill] Matches any lowercase letter. 
  651.  
  652. \item[{\tt [\^{ }a-z]}\hfill] Matches any character {\em except\/}
  653. lowercase letters. 
  654.  
  655. \item[{\tt [0-9+---]}\hfill] Matches a digit or sign. 
  656.  
  657. \item[{\tt $\backslash$(foo$\backslash$|bar$\backslash$)}\hfill]
  658. Matches either the string {\tt foo} or the string {\tt bar}. 
  659.  
  660. \end{define}
  661.  
  662. \fname{count-matches}{pattern}{}
  663. \fmore{count-non-matches}{pattern}{}
  664. \fbody These commands count the number of lines which do or do not
  665. (respectively) match the specified pattern.
  666.  
  667. \fname{delete-matching-lines}{pattern}{}
  668. \fmore{delete-non-matching-lines}{pattern}{}
  669. \fbody These commands delete all lines which do or do not (respectively)
  670. match the specified pattern.
  671.  
  672.  
  673. \fname{query-replace-regexp}{pattern replacement}{}
  674. \fbody This is the regular expression version of {\tt query-replace}.
  675.  
  676. The {\em replacement\/} string may be a constant, or it can refer to
  677. all or part of the string matched by the {\em pattern\/}.  \verb"\&" in
  678. the replacement string expands into the entire text being replaced,
  679. while \verb"\"{\em n\/} (where {\em n\/} is a number) replaces the 
  680. {\em n\/}th parenthesized expression in {\em pattern\/}.
  681.  
  682. \fname{re-search-again}{}{}
  683. \fmore{re-search-backward}{pattern}{}
  684. \fmore{re-search-forward}{pattern}{}
  685. \fbody These are the regular expression equivalents of the ordinary
  686. non-incremental search commands.
  687.  
  688. \fname{set-case-fold-search}{}{}
  689. \fbody This command toggles an internal variable that controls whether
  690. the regular expression search and replace commands pay attention to
  691. case.  By default, regular expression searches are case-insensitive.
  692. Ordinary searches are always case-insensitive and are not affected by
  693. the setting of this variable.
  694.  
  695.  
  696. \chapter{Windows}
  697.  
  698. MG initially has only one text window displayed.  However, you can have
  699. as many windows as will fit on the screen.  Each window has its own mode
  700. line and must display at least two lines of text.  (Note that a MG's
  701. ``windows'' are distinct from the ``windows'' handled by screen managers
  702. such as the X Window System.)
  703.  
  704. Multiple windows may be used to display different buffers.  You can also
  705. have the same buffer displayed in more than one window, which is useful
  706. if you want to see one part of a file at the same time as you are editing
  707. another part.
  708.  
  709. Although many windows can be displayed at once, only one window is active 
  710. at any given time.  This is the window where the cursor appears.
  711.  
  712. Some commands refer to the ``other'' window.  This is the window directly
  713. below the current window, or the top window if you are in the bottom window.
  714.  
  715. \fname{delete-other-windows}{}{C-x 1}
  716. \fbody Makes the current window the only window.
  717.  
  718. \fname{delete-window}{}{C-x 0}
  719. \fbody Deletes the current window, making the ``other'' window the
  720. current window.  This command doesn't do anything useful if there is only
  721. one window being displayed.
  722.  
  723. \fname{enlarge-window}{}{C-\^{ }}
  724. \fbody Makes the current window larger.  Without a prefix argument, the
  725. window grows one line; otherwise, the prefix argument specifies how many
  726. lines to grow.
  727.  
  728. \fname{other-window}{}{C-x o}
  729. \fbody Makes the ``other'' window the current window.
  730.  
  731. \fname{previous-window}{}{}
  732. \fbody This is like {\tt other-window}, except that it cycles through
  733. the windows in reverse order.  This command is available only if MG was
  734. compiled with the GOSMACS option defined.
  735.  
  736. \fname{shrink-window}{}{}
  737. \fbody Makes the current window smaller.  Without a prefix argument, the
  738. window loses one line; otherwise, the prefix argument specifies how many
  739. lines go away.
  740.  
  741. \fname{split-window-vertically}{}{C-x 2}
  742. \fbody Split the current window into two windows, both using the same
  743. buffer.
  744.  
  745.  
  746. \chapter{Files and Buffers}
  747.  
  748. Most buffers are used to contain a file being edited.  It is
  749. also possible to have buffers that are not associated with any file;
  750. MG uses these for purposes such as displaying help text, for example.
  751. However, since most commands for dealing with files also deal with
  752. buffers, we have grouped all of these commands together into one chapter.
  753.  
  754. \section{Buffer Manipulation}
  755.  
  756. \fname{insert-buffer}{buffer-name}{}
  757. \fbody Inserts the contents of the named buffer into the current buffer
  758. at the cursor location.  The cursor moves to the end of the inserted
  759. text.
  760.  
  761. \fname{kill-buffer}{buffer-name}{C-x k}
  762. \fbody The named buffer and its contents are deleted.  If the buffer has
  763. been marked as modified, MG will ask you if you really want to delete it.
  764. Note that, contrary to its name, this command {\em does not\/} save the
  765. buffer contents in the kill buffer.
  766.  
  767. If a buffer is being displayed in a window when it is deleted, MG will 
  768. find some other buffer to display in the same window.
  769.  
  770. \fname{list-buffers}{}{C-x C-b}
  771. \fbody This command writes information about the buffers currently in
  772. use to a buffer named {\tt *Buffer List*}.  This buffer is then displayed
  773. in the ``other'' window; if there is only one window, this command will
  774. split the screen into two windows.
  775.  
  776. \fname{not-modified}{}{M-\~{ }}
  777. \fbody This command makes MG think that the current buffer has not been
  778. modified, even if it really has been changed.  This affects the behavior
  779. of the {\tt kill-buffer} and the buffer-saving commands described below.
  780.  
  781. MG indicates modified buffers with two stars at the left end of the mode
  782. line.
  783.  
  784. \fname{switch-to-buffer}{buffer-name}{C-x b}
  785. \fbody The current window is mapped onto the named buffer.  If there
  786. isn't already a buffer with that name around, MG will create one.
  787.  
  788. \fname{switch-to-buffer-other-window}{buffer-name}{C-x 4 b}
  789. \fbody This command works like {\tt switch-to-buffer}, except that the
  790. ``other'' window is used.  If there is only one window, this command
  791. splits the screen into two windows and maps the named buffer onto one
  792. of them.
  793.  
  794. \section{Reading and Writing Files}
  795.  
  796. \fname{find-file}{file-name}{C-x f}
  797. \fmore{find-file-other-window}{file-name}{C-x 4 C-f}
  798. \fbody These commands are analagous to {\tt switch-to-buffer} and {\tt
  799. switch-to-buffer-other-window}, respectively.  The difference is that
  800. these commands look for a buffer associated with the named file.  If no
  801. matching buffer is found, MG will create a new buffer with a name
  802. derived from the filename, and attempt to read the file into the buffer.
  803. If the named file cannot be opened, the buffer remains empty.
  804.  
  805. \fname{insert-file}{file-name}{C-x i}
  806. \fbody This command reads in the contents of the named file into the
  807. current buffer at the cursor position.  The cursor remains in the same
  808. place.
  809.  
  810. \fname{save-buffer}{}{C-x C-s}
  811. \fbody If the current buffer has been modified, it is saved.  Buffers
  812. that are not associated with files cannot be written out with this
  813. command.
  814.  
  815. \fname{save-buffers-kill-emacs}{}{C-x C-c}
  816. \fbody This command is used to leave MG and return control to the shell
  817. or other program that was used to start MG.  If there are modified buffers,
  818. MG will ask you if you want to save them before exiting.
  819.  
  820. \fname{save-some-buffers}{}{C-x s}
  821. \fbody MG will ask you if you want to save modified buffers that are
  822. associated with files.
  823.  
  824. \fname{write-file}{file-name}{C-x C-w}
  825. \fbody The current buffer is written out using the file name supplied.
  826. This is useful for saving buffers that are not associated with files, or
  827. for writing out a file with a different name than what was used to read
  828. it in.
  829.  
  830. \section{Backup Files}
  831.  
  832. MG provides a way to save a copy of the original version of files which 
  833. have been modified and then written out again.  The backup copy reflects
  834. the state of the file as it existed the first time it was read into MG.
  835. The name used for the backup file varies, depending on the operating
  836. system.
  837.  
  838. This feature is disabled if MG is compiled with NO\_BACKUP defined.
  839.  
  840. \fname{make-backup-files}{}{} 
  841. \fbody This command is a toggle which
  842. controls the state of an internal variable that determines whether MG
  843. creates backup files. 
  844.  
  845. \section{Changing the Directory}
  846.  
  847. The commands in this section are disabled by defining NO\_DIR.
  848.  
  849. \fname{cd}{directory-name}{}
  850. \fbody This command changes MG's notion of the ``current'' directory
  851. or pathname.  This is used to supply defaults for functions that read 
  852. or write files.
  853.  
  854. The syntax for {\em directory-name\/} is obviously specific to the
  855. particular operating system MG is running on.
  856.  
  857. \fname{pwd}{}{}
  858. \fbody Display what MG thinks is the current directory.
  859.  
  860. \chapter{Modes}
  861.  
  862. Modes are used to locally alter the bindings of keys on a 
  863. buffer-by-buffer basis.  MG is normally in fundamental mode, and these
  864. are the bindings that are listed with the command descriptions in 
  865. this manual.  Modes define additional keymaps that are searched for
  866. bindings before the fundamental mode bindings are examined; see the
  867. section on key binding below for more details on how this works.
  868.  
  869. \fname{set-default-mode}{mode-name}{}
  870. \fbody Normally, when MG visits a file, it puts the associated buffer
  871. into fundamental mode.  Using the {\tt set-default-mode} command, you
  872. can specify that MG should default to use some other mode on all subsequent
  873. buffers that are created.  This command is a toggle.  With no prefix
  874. argument, if the named mode is not already on the list of
  875. default modes, then it will be added to the list; otherwise, it is removed
  876. from the list.
  877.  
  878. \section{No Tab Mode}
  879.  
  880. In notab mode, tabs are expanded into spaces instead of inserted
  881. literally into the buffer.  Literal tab characters are displayed as
  882. \verb"^I" (much like other control characters).  These commands are
  883. available if MG is compiled with the symbol NOTAB defined.  (This mode
  884. is mainly for use on systems such as PRIMOS that do not treat tab as a
  885. series of spaces.)
  886.  
  887. \fname{no-tab-mode}{}{}
  888. \fbody This command is a toggle to control whether notab mode is in effect.
  889.  
  890. \fname{space-to-tabstop}{}{}
  891. \fbody Insert enough spaces to move the cursor to the next tab stop.  In
  892. notab mode, this function is bound to {\tt C-i}.
  893.  
  894.  
  895. \section{Overwrite Mode}
  896.  
  897. Normally, when characters are inserted into the buffer, they are spliced
  898. into the existing text.  In overwrite mode, inserting a character causes
  899. the character already at the cursor position to be replaced.  This is
  900. useful for editing pictures, tables, and the like.
  901.  
  902. \fname{overwrite-mode}{}{}
  903. \fbody This command is a toggle which controls whether overwrite mode is
  904. in effect.
  905.  
  906. \section{Auto Fill}
  907.  
  908. Fill mode causes newlines to be added automatically at word
  909. breaks when text is added at the end of a line, extending past the
  910. right margin.  Auto fill is useful for editing text and documentation
  911. files.
  912.  
  913. \fname{auto-fill-mode}{}{}
  914. \fbody This command is a toggle which controls whether fill mode is
  915. in effect.
  916.  
  917. \fname{insert-with-wrap}{}{}
  918. \fbody This command works like {\tt self-insert}, except that it checks
  919. to see if the cursor has passed the right margin.  If so, it fills
  920. the line by inserting a line break between words.  This command is bound to 
  921. {\tt SPC} in fill mode.
  922.  
  923. \fname{fill-paragraph}{}{M-q}
  924. \fbody Fill the paragraph containing the cursor.
  925.  
  926. \fname{set-fill-column}{}{C-x f}
  927. \fbody Without a prefix argument, this command sets the right margin
  928. at the current cursor column.  If a prefix argument is supplied, it is used
  929. instead as the line width.
  930.  
  931. \section{Auto Indent}
  932.  
  933. Indent mode binds {\tt RET} to {\tt newline-and-indent}, so
  934. that each new line is indented to the same level as the preceeding
  935. line.  This mode is useful for editing code. 
  936.  
  937. \fname{auto-indent-mode}{}{}
  938. \fbody This command is a toggle which controls whether auto-indent mode
  939. is in effect.
  940.  
  941. \section{Blink}
  942.  
  943. Blink mode makes it easier to match parentheses, brackets, and other
  944. paired delimiters.  When the closing delimiter is typed, the cursor
  945. moves momentarily to the matching opening delimiter (if it is on the
  946. screen), or displays the line containing the matching delimiter on the
  947. echo line.  This is useful for editing Lisp or C code, or for
  948. preparing input files for text processors such as LaTeX that use
  949. paired delimiters. 
  950.  
  951. \fname{blink-matching-paren}{}{}
  952. \fbody This command is a toggle which controls whether blink mode is
  953. in effect.
  954.  
  955. \fname{blink-matching-paren-hack}{}{}
  956. \fbody This function behaves like {\tt self-insert}, except that it
  957. finds the matching delimiter as described above.  In blink mode, this
  958. function is bound to \verb")", which flashes the matching \verb"(".  This
  959. function also knows about the pairs \verb"{}", \verb"[]", and \verb"<>".
  960. All other characters match with themselves.
  961.  
  962. \section{Dired Mode}
  963.  
  964. ``Dired'' is an abbreviation for ``directory editor'', and it provides a way
  965. to browse through the contents of a directory from with MG.  Dired puts
  966. a directory listing into a buffer; you can use normal editing commands to
  967. move around the buffer, and a special group of commands to manipulate
  968. the files.  For example, there are commands to delete and rename files,
  969. and to read a file into an MG buffer.
  970.  
  971. Since dired mode rebinds many keys, a table may be helpful:
  972.  
  973. \begin{verbatim}
  974.     C-d      dired-flag-file-deleted
  975.     SPC      next-line
  976.     c        dired-copy-file
  977.     d        dired-flag-file-deleted
  978.     e        dired-find-file
  979.     f        dired-find-file
  980.     n        next-line
  981.     o        dired-find-file-other-window
  982.     p        previous-line
  983.     r        dired-renamefile
  984.     u        dired-unflag
  985.     x        dired-do-deletions
  986.     DEL      dired-backup-unflag
  987. \end{verbatim}
  988.  
  989. The commands in this section are disabled by defining NO\_DIRED.
  990.  
  991. \fname{dired}{directory-name}{C-x d}
  992. \fbody Creates a dired buffer for the given directory name, and displays
  993. it in the current window.  The files
  994. in the directory are listed, usually along with information about the
  995. file such as its size and timestamp.  The exact format of the information
  996. is system-specific.
  997.  
  998. \fname{dired-backup-unflag}{}{}
  999. \fbody This function removes the deletion flag from the file listed on
  1000. the previous line of the dired buffer.
  1001.  
  1002. \fname{dired-copy-file}{new-name}{}
  1003. \fbody Copy the file listed on the current line of the dired buffer.
  1004.  
  1005. \fname{dired-do-deletions}{}{}
  1006. \fbody Deletes the files that have been flagged for deletion.
  1007.  
  1008. \fname{dired-find-file}{}{}
  1009. \fmore{dired-find-file-other-window}{}{}
  1010. \fbody These function works like {\tt find-file} and 
  1011. {\tt find-file-other-window}, except that the filename is taken 
  1012. from the current line in the dired buffer.
  1013.  
  1014. \fname{dired-flag-file-deleted}{}{}
  1015. \fbody Flag the file listed on the current line for deletion.  This is
  1016. indicated in the buffer by putting a ``D'' at the left margin.  No
  1017. files are not actually deleted until the function {\tt dired-do-deletions}
  1018. is executed.
  1019.  
  1020. \fname{dired-other-window}{directory-name}{}
  1021. \fbody This function works just like {\tt dired}, except that it puts the
  1022. dired buffer in the ``other'' window.
  1023.  
  1024. \fname{dired-rename-file}{new-name}{}
  1025. \fbody Renames the file listed on the current line of the dired buffer.  
  1026. Note that the dired buffer is not updated to reflect the change.
  1027.  
  1028. \fname{dired-unflag}{}{}
  1029. \fbody Remove the deletion flag for the file on the current line.
  1030.  
  1031. \chapter{Miscellaneous}
  1032.  
  1033. \section{Help}
  1034.  
  1035. Most of the commands in this section write useful information to the
  1036. {\tt *help*} buffer, which is then displayed in the ``other'' window.
  1037.  
  1038. These commands can be disabled at compile-time by defining NO\_HELP.
  1039.  
  1040. \fname{apropos}{topic}{C-h a}
  1041. \fbody This command lists all functions whose names contain a string
  1042. matching {\em topic\/} in the {\tt *help*} buffer.
  1043.  
  1044. \fname{describe-bindings}{}{C-h b}
  1045. \fbody Information about the key bindings in effect in the current buffer
  1046. is listed in the {\tt *help*} buffer.
  1047.  
  1048. \fname{describe-key-briefly}{key}{C-h c}
  1049. \fbody Information about the binding of {\em key\/} is printed in the
  1050. minibuffer.
  1051.  
  1052. \fname{help-help}{option}{C-h C-h}
  1053. \fbody This command lists all of the help options available and
  1054. prompts for which one to run.  Currently, these include only {\tt a}
  1055. to run {\tt apropos}, {\tt b} to run {\tt describe-bindings}, and {\tt c}
  1056. to run {\tt describe-key-briefly}.
  1057.  
  1058.  
  1059. \section{Keyboard Macros}
  1060.  
  1061. A keyboard macro is a saved set of commands from the keyboard that can be
  1062. reexecuted later on.  There can only be one keyboard macro defined at
  1063. any one time.
  1064.  
  1065. The commands in this section are available unless they have been disabled
  1066. by defining NO\_MACRO.
  1067.  
  1068. \fname{call-last-kbd-macro}{}{C-x e}
  1069. \fbody Execute the saved keyboard macro.  A prefix argument can be used
  1070. to specify a repetition count.
  1071.  
  1072. \fname{end-kbd-macro}{}{C-x )}
  1073. \fmore{start-kbd-macro}{}{C-x (}
  1074. \fbody These functions are used to define a keyboard macro.  All keys
  1075. entered after {\tt start-kbd-macro} is executed, up to a {\tt end-kbd-macro},
  1076. are remembered as they are executed.  You can then reexecute the same
  1077. sequence of operations using {\tt call-last-kbd-macro}.
  1078.  
  1079.  
  1080. \section{Changing Case}
  1081.  
  1082. MG provides a number of functions for changing the case of text.
  1083.  
  1084. \fname{capitalize-word}{}{M-c}
  1085. \fmore{downcase-region}{}{C-x C-l}
  1086. \fmore{downcase-word}{}{M-l}
  1087. \fmore{upcase-region}{}{C-x C-u}
  1088. \fmore{upcase-word}{}{M-u}
  1089. \fbody All of these commands do the obvious.
  1090.  
  1091.  
  1092. \section{Odds and Ends}
  1093.  
  1094. This section describes miscellaneous commands that don't fit into any
  1095. particular category.
  1096.  
  1097. \fname{emacs-version}{}{}
  1098. \fbody Prints information about the version of MG you are running in
  1099. the minibuffer.
  1100.  
  1101. \fname{meta-key-mode}{}{}
  1102. \fbody If the particular version of MG you are running supports a meta key,
  1103. this function can be used to determine whether MG actually pays attention
  1104. to it or not.  If no prefix argument is supplied, the internal variable
  1105. that controls the use of the meta key is toggled; a positive value enables
  1106. the meta key, while a negative value disables it.
  1107.  
  1108. \fname{prefix-region}{}{}
  1109. \fmore{set-prefix-string}{string}{}
  1110. \fbody {\tt Prefix-region} is used to prefix each line of the region
  1111. with a string.  This is useful for indenting quoted text, making block
  1112. comments, and the like.  The function {\tt set-prefix-string} can be
  1113. used to set the string used as the prefix.
  1114.  
  1115. \fname{suspend-emacs}{}{C-z} 
  1116. \fbody This command temporarily suspends
  1117. MG so that you can run other programs, and later resume editing.  The
  1118. exact behavior depends on which operating system you are running MG
  1119. under.  Typically, MG will either spawn a new shell as a subprocess, or
  1120. return you to the parent process.
  1121.  
  1122. \fname{transpose-chars}{}{C-t}
  1123. \fbody This command transposes the previous two characters.
  1124.  
  1125.  
  1126. \chapter{Customization}
  1127.  
  1128. MG provides a limited support for customization.  However, unlike ``real'' 
  1129. Emacs, there is no extension language for interpretively defining new 
  1130. functions.
  1131.  
  1132. \section{Key Bindings}
  1133.  
  1134. MG allows keys to be rebound locally or globally.  To understand the
  1135. difference between the two, some discussion on how modes are implemented
  1136. is necessary.
  1137.  
  1138. An internal data structure called a keymap is used to look up the
  1139. function that is bound to a particular key.  The keymap for
  1140. fundamental mode contains all of the default bindings which are listed
  1141. with the command descriptions in this manual.  Modes define additional
  1142. keymaps that are searched for a binding before the fundamental mode
  1143. keymap is examined.  Keymaps have the same name as the mode they are
  1144. associated with.
  1145.  
  1146. MG does not provide commands for defining new modes, but you can alter
  1147. the keymaps for existing modes.
  1148.  
  1149. \fname{define-key}{keymap-name key command}{}
  1150. \fbody This command can be used to modify the keymap for the named mode.
  1151.  
  1152. \fname{global-set-key}{key command}{}
  1153. \fmore{global-unset-key}{key}{}
  1154. \fbody These commands modify the keymap for fundamental mode.  Bindings
  1155. established by {\tt global-set-key} will be inherited by all other modes, 
  1156. as long as they do not establish local rebindings of the same key.
  1157.  
  1158. \fname{local-set-key}{key command}{}
  1159. \fmore{local-unset-key}{key}{}
  1160. \fbody These commands modify the keymap currently in effect.
  1161.  
  1162.  
  1163. \section{Startup Files}
  1164.  
  1165. Although MG does not include a general-purpose extension language, it
  1166. does provide a way to read and evaluate commands using a somewhat
  1167. different syntax than that used for executing extended commands.  This
  1168. is typically used in a startup file to modify key bindings.
  1169.  
  1170. A startup file consists of one or more expressions.  Each expression must
  1171. appear on a separate line in the file; there may not be more than one
  1172. expression per line, nor may expressions span across line breaks.
  1173. Whitespace (spaces and tabs) separate the tokens in an expression.  For
  1174. historical reasons, parentheses are also considered to be whitespace in
  1175. this context.  A semicolon acts as a comment character, causing the rest
  1176. of the line to be discarded.
  1177.  
  1178. An expression consists of a function name, an optional prefix argument
  1179. (given as an integer constant), and arguments to be passed to the
  1180. function.  If an argument includes literal whitespace or nonprintable
  1181. characters (for example, as in a keystroke argument to one of the key
  1182. binding functions described in the previous section), it must be
  1183. supplied as a string constant enclosed in double quotes. 
  1184.  
  1185. Within string constants, the following backslash escapes are available
  1186. to specify nonprintable characters:
  1187.  
  1188. \begin{define}{\hspace{1in}}
  1189.  
  1190. \item[{\tt $\backslash$t, $\backslash$T}\hfill] Tab 
  1191. \item[{\tt $\backslash$n, $\backslash$N}\hfill] Newline 
  1192. \item[{\tt $\backslash$r, $\backslash$R}\hfill] Carriage return 
  1193. \item[{\tt $\backslash$e, $\backslash$E}\hfill] Escape (Meta prefix) 
  1194. \item[{\tt $\backslash$\^{ }}\hfill] Control prefix 
  1195.  
  1196. \item[{\tt $\backslash${\em n\/}}\hfill] Specifies a character by its
  1197. ASCII code, where {\em n\/} may consist of from one to three octal
  1198. digits
  1199.  
  1200. \item[{\tt $\backslash$f{\em n\/}, $\backslash$F{\em n\/}}\hfill]
  1201. Specifies the keycode for the {\em n\/}th function key.  {\em N\/} may
  1202. consist of one or two decimal digits. 
  1203.  
  1204. \end{define}
  1205.  
  1206. The following commands which deal with evaluation of expressions are
  1207. disabled by defining the compile-time option NO\_STARTUP.  See the
  1208. implementation notes for your particular version of MG for information
  1209. on how it handles startup files. 
  1210.  
  1211. \fname{eval-current-buffer}{}{}
  1212. \fbody Evaluate the expressions in the current buffer.
  1213.  
  1214. \fname{eval-expression}{expression}{}
  1215. \fbody Evaluate the expression supplied.
  1216.  
  1217. \fname{load}{file-name}{}
  1218. \fbody Read in the specified file and evaluate its contents.
  1219.  
  1220. \twocolumn[\Huge{\vspace{2em}{\bf Fundamental Mode Key Bindings}\vspace{1.5em}}]
  1221. \addcontentsline{toc}{chapter}{Fundamental Mode Key Bindings}
  1222. \begin{verbatim}
  1223. NUL       set-mark-command
  1224. C-a       beginning-of-line
  1225. C-b       backward-char
  1226. C-d       delete-char
  1227. C-e       end-of-line
  1228. C-f       forward-char
  1229. C-g       keyboard-quit
  1230. C-h       help
  1231. TAB       self-insert-command
  1232. C-j       newline-and-indent
  1233. C-k       kill-line
  1234. C-l       recenter
  1235. RET       newline
  1236. C-n       next-line
  1237. C-o       open-line
  1238. C-p       previous-line
  1239. C-q       quoted-insert
  1240. C-r       isearch-backward
  1241. C-s       isearch-forward
  1242. C-t       transpose-chars
  1243. C-u       universal-argument
  1244. C-v       scroll-up
  1245. C-w       kill-region
  1246. C-x       c-x prefix
  1247. C-y       yank
  1248. C-z       suspend-emacs
  1249. ESC       meta prefix
  1250. SPC .. ~  self-insert-command
  1251. DEL       delete-backward-char
  1252.  
  1253. C-h C-g   keyboard-quit
  1254. C-h C-h   help-help
  1255. C-h a     apropos
  1256. C-h b     describe-bindings
  1257. C-h c     describe-key-briefly
  1258.  
  1259. C-x C-b   list-buffers
  1260. C-x C-c   save-buffers-kill-emacs
  1261. C-x C-f   find-file
  1262. C-x C-g   keyboard-quit
  1263. C-x C-l   downcase-region
  1264. C-x C-o   delete-blank-lines
  1265. C-x C-s   save-buffer
  1266. C-x C-u   upcase-region
  1267. C-x C-w   write-file
  1268. C-x C-x   exchange-point-and-mark
  1269. C-x (     start-kbd-macro
  1270. C-x )     end-kbd-macro
  1271. C-x 0     delete-window
  1272. C-x 1     delete-other-windows
  1273. C-x 2     split-window-vertically
  1274. C-x 4     c-x 4 prefix
  1275. C-x =     what-cursor-position
  1276. C-x ^     enlarge-window
  1277. C-x b     switch-to-buffer
  1278. C-x d     dired
  1279. C-x e     call-last-kbd-macro
  1280. C-x f     set-fill-column
  1281. C-x i     insert-file
  1282. C-x k     kill-buffer
  1283. C-x o     other-window
  1284. C-x s     save-some-buffers
  1285. C-x 4 C-f find-file-other-window
  1286. C-x 4 C-g keyboard-quit
  1287. C-x 4 b   switch-to-buffer-other-window
  1288. C-x 4 f   find-file-other-window
  1289.  
  1290. M-C-g     keyboard-quit
  1291. M-C-v     scroll-other-window
  1292. M-SPC     just-one-space
  1293. M-%       query-replace
  1294. M--       negative-argument
  1295. M-0       digit-argument
  1296. M-1       digit-argument
  1297. M-2       digit-argument
  1298. M-3       digit-argument
  1299. M-4       digit-argument
  1300. M-5       digit-argument
  1301. M-6       digit-argument
  1302. M-7       digit-argument
  1303. M-8       digit-argument
  1304. M-9       digit-argument
  1305. M-<       beginning-of-buffer
  1306. M->       end-of-buffer
  1307. M-[       backward-paragraph
  1308. M-\       delete-horizontal-space
  1309. M-]       forward-paragraph
  1310. M-b       backward-word
  1311. M-c       capitalize-word
  1312. M-d       kill-word
  1313. M-f       forward-word
  1314. M-l       downcase-word
  1315. M-q       fill-paragraph
  1316. M-r       search-backward
  1317. M-s       search-forward
  1318. M-u       upcase-word
  1319. M-v       scroll-down
  1320. M-w       copy-region-as-kill
  1321. M-x       execute-extended-command
  1322. M-~       not-modified
  1323. M-DEL     backward-kill-word
  1324.  
  1325. \end{verbatim}
  1326.  
  1327. \begin{theindex}
  1328. \addcontentsline{toc}{chapter}{Index}
  1329. \input{mgidx.tex}
  1330. \end{theindex}
  1331.  
  1332. \end{document}
  1333.