home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume3 / mg2a / part02 < prev    next >
Encoding:
Text File  |  1989-02-03  |  55.0 KB  |  1,497 lines

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