home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / msdos / demacs / info / emacs.10 < prev    next >
Encoding:
Text File  |  1991-12-09  |  51.6 KB  |  1,133 lines

  1. Info file emacs, produced by texinfo-format-buffer   -*-Text-*-
  2. from file emacs.tex
  3.  
  4. This file documents the GNU Emacs editor.
  5.  
  6. Copyright (C) 1985, 1986 Richard M. Stallman.
  7.  
  8. Permission is granted to make and distribute verbatim copies of
  9. this manual provided the copyright notice and this permission notice
  10. are preserved on all copies.
  11.  
  12. Permission is granted to copy and distribute modified versions of this
  13. manual under the conditions for verbatim copying, provided also that the
  14. sections entitled "The GNU Manifesto", "Distribution" and "GNU Emacs
  15. General Public License" are included exactly as in the original, and
  16. provided that the entire resulting derived work is distributed under the
  17. terms of a permission notice identical to this one.
  18.  
  19. Permission is granted to copy and distribute translations of this manual
  20. into another language, under the above conditions for modified versions,
  21. except that the sections entitled "The GNU Manifesto", "Distribution"
  22. and "GNU Emacs General Public License" may be included in a translation
  23. approved by the author instead of in the original English.
  24.  
  25. 
  26. File: emacs  Node: Shell, Prev: Sorting, Up: Top, Next: Hardcopy
  27.  
  28. Running Shell Commands from Emacs
  29. =================================
  30.  
  31.   Emacs has commands for passing single command lines to inferior shell
  32. processes; it can also run a shell interactively with input and output to
  33. an Emacs buffer `*shell*'.
  34.  
  35. `M-!'     
  36.      Run a specified shell command line and display the output
  37.      (`shell-command').
  38. `M-|'     
  39.      Run a specified shell command line with region contents as input;
  40.      optionally replace the region with the output
  41.      (`shell-command-on-region').
  42. `M-x shell'     
  43.      Run a subshell with input and output through an Emacs buffer.
  44.      You can then give commands interactively.
  45.  
  46. * Menu:
  47.  
  48. * Single Shell::         How to run one shell command and return.
  49. * Interactive Shell::    Permanent shell taking input via Emacs.
  50. * Shell Mode::           Special Emacs commands used with permanent shell.
  51.  
  52. 
  53. File: emacs  Node: Single Shell, Prev: Shell, Up: Shell, Next: Interactive Shell
  54.  
  55. Single Shell Commands
  56. ---------------------
  57.  
  58.   `M-!' (`shell-command') reads a line of text using the
  59. minibuffer and creates an inferior shell to execute the line as a command.
  60. Standard input from the command comes from the null device.  If the shell
  61. command produces any output, the output goes into an Emacs buffer named
  62. `*Shell Command Output*', which is displayed in another window but not
  63. selected.  A numeric argument, as in `M-1 M-!', directs this command to
  64. insert any output into the current buffer.  In that case, point is left
  65. before the output and the mark is set after the output.
  66.  
  67.   `M-|' (`shell-command-on-region') is like `M-!' but passes the contents
  68. of the region as input to the shell command, instead of no input.  If a
  69. numeric argument is used, meaning insert output in the current buffer, then
  70. the old region is deleted first and the output replaces it as the contents
  71. of the region.
  72.  
  73.   Both `M-!' and `M-|' use `shell-file-name' to specify the shell to use.
  74. This variable is initialized based on your `SHELL' environment variable
  75. when Emacs is started.  If the file name does not specify a directory, the
  76. directories in the list `exec-path' are searched; this list is initialized
  77. based on the environment variable `PATH' when Emacs is started.  Your
  78. `.emacs' file can override either or both of these default initializations.
  79.  
  80.   With `M-!' and `M-|', Emacs has to wait until the shell command
  81. completes.  You can quit with `C-g'; that terminates the shell command.
  82.  
  83. 
  84. File: emacs  Node: Interactive Shell, Prev: Single Shell, Up: Shell, Next: Shell Mode
  85.  
  86. Interactive Inferior Shell
  87. --------------------------
  88.  
  89.   To run a subshell interactively, putting its typescript in an Emacs
  90. buffer, use `M-x shell'.  This creates (or reuses) a buffer named
  91. `*shell*' and runs a subshell with input coming from and output going
  92. to that buffer.  That is to say, any "terminal output" from the subshell
  93. will go into the buffer, advancing point, and any "terminal input" for
  94. the subshell comes from text in the buffer.  To give input to the subshell,
  95. go to the end of the buffer and type the input, terminated by RET.
  96.  
  97.   Emacs does not wait for the subshell to do anything.  You can switch
  98. windows or buffers and edit them while the shell is waiting, or while it is
  99. running a command.  Output from the subshell waits until Emacs has time to
  100. process it; this happens whenever Emacs is waiting for keyboard input or
  101. for time to elapse.
  102.  
  103.   If you would like multiple subshells, change the name of buffer
  104. `*shell*' to something different by using `M-x rename-buffer'.  The
  105. next use of `M-x shell' will create a new buffer `*shell*' with
  106. its own subshell.  By renaming this buffer as well you can create a third
  107. one, and so on.  All the subshells run independently and in parallel.
  108.  
  109.   The file name used to load the subshell is the value of the variable
  110. `explicit-shell-file-name', if that is non-`nil'.  Otherwise, the
  111. environment variable `ESHELL' is used, or the environment variable `SHELL'
  112. if there is no `ESHELL'.  If the file name specified is relative, the
  113. directories in the list `exec-path' are searched (*Note Single Shell
  114. Commands: Single Shell.).
  115.  
  116.   As soon as the subshell is started, it is sent as input the contents of
  117. the file `~/.emacs_SHELLNAME', if that file exists, where SHELLNAME is the
  118. name of the file that the shell was loaded from.  For example, if you use
  119. `csh', the file sent to it is `~/.emacs_csh'.
  120.  
  121.   `cd', `pushd' and `popd' commands given to the inferior shell are watched
  122. by Emacs so it can keep the `*shell*' buffer's default directory the same
  123. as the shell's working directory.  These commands are recognized
  124. syntactically by examining lines of input that are sent.  If you use
  125. aliases for these commands, you can tell Emacs to recognize them also.  For
  126. example, if the value of the variable `shell-pushd-regexp' matches the
  127. beginning of a shell command line, that line is regarded as a `pushd'
  128. command.  Change this variable when you add aliases for `pushd'.  Likewise,
  129. `shell-popd-regexp' and `shell-cd-regexp' are used to recognize commands
  130. with the meaning of `popd' and `cd'.  These commands are recognized only at
  131. the beginning of a shell command line.
  132.  
  133.   If Emacs gets an error while trying to handle what it believes is a `cd',
  134. `pushd' or `popd' command, and the value of
  135. `shell-set-directory-error-hook' is non-`nil', that value is called as a
  136. function with no arguments.
  137.  
  138. 
  139. File: emacs  Node: Shell Mode, Prev: Interactive Shell, Up: Shell
  140.  
  141. Shell Mode
  142. ----------
  143.  
  144.   The shell buffer uses Shell mode, which defines several special keys
  145. attached to the `C-c' prefix.  They are chosen to resemble the usual
  146. editing and job control characters present in shells that are not under
  147. Emacs, except that you must type `C-c' first.  Here is a complete list
  148. of the special key bindings of Shell mode:
  149.  
  150. `RET'     
  151.      At end of buffer send line as input; otherwise, copy current line to end of
  152.      buffer and send it (`send-shell-input').  When a line is copied, any
  153.      text at the beginning of the line that matches the variable
  154.      `shell-prompt-pattern' is left out; this variable's value should be a
  155.      regexp string that matches the prompts that you use in your subshell.
  156. `C-c C-d'     
  157.      Send end-of-file as input, probably causing the shell or its current
  158.      subjob to finish (`shell-send-eof').
  159. `C-c C-u'     
  160.      Kill all text that has yet to be sent as input (`kill-shell-input').
  161. `C-c C-w'     
  162.      Kill a word before point (`backward-kill-word').
  163. `C-c C-c'     
  164.      Interrupt the shell or its current subjob if any
  165.      (`interrupt-shell-subjob').
  166. `C-c C-z'     
  167.      Stop the shell or its current subjob if any (`stop-shell-subjob').
  168. `C-c C-\'     
  169.      Send quit signal to the shell or its current subjob if any
  170.      (`quit-shell-subjob').
  171. `C-c C-o'     
  172.      Delete last batch of output from shell (`kill-output-from-shell').
  173. `C-c C-r'     
  174.      Scroll top of last batch of output to top of window
  175.      (`show-output-from-shell').
  176. `C-c C-y'     
  177.      Copy the previous bunch of shell input, and insert it into the
  178.      buffer before point (`copy-last-shell-input').  No final newline
  179.      is inserted, and the input copied is not resubmitted until you type
  180.      RET.
  181.  
  182. 
  183. File: emacs  Node: Hardcopy, Prev: Shell, Up: Top, Next: Dissociated Press
  184.  
  185. Hardcopy Output
  186. ===============
  187.  
  188.   The Emacs commands for making hardcopy derive their names from the
  189. Unix commands `print' and `lpr'.
  190.  
  191. `M-x print-buffer'     
  192.      Print hardcopy of current buffer using Unix command `print'
  193.      (`lpr -p').  This makes page headings containing the file name
  194.      and page number.
  195. `M-x lpr-buffer'     
  196.      Print hardcopy of current buffer using Unix command `lpr'.
  197.      This makes no page headings.
  198. `M-x print-region'     
  199.      Like `print-buffer' but prints only the current region.
  200. `M-x lpr-region'     
  201.      Like `lpr-buffer' but prints only the current region.
  202.  
  203.   All the hardcopy commands pass extra switches to the `lpr' program
  204. based on the value of the variable `lpr-switches'.  Its value should
  205. be a list of strings, each string a switch starting with `-'.  For
  206. example, the value could be `("-Pfoo")' to print on printer
  207. `foo'.
  208.  
  209. 
  210. File: emacs  Node: Dissociated Press, Prev: Hardcopy, Up: Top, Next: Amusements
  211.  
  212. Dissociated Press
  213. =================
  214.  
  215.   `M-x dissociated-press' is a command for scrambling a file of text
  216. either word by word or character by character.  Starting from a buffer of
  217. straight English, it produces extremely amusing output.  The input comes
  218. from the current Emacs buffer.  Dissociated Press writes its output in a
  219. buffer named `*Dissociation*', and redisplays that buffer after every
  220. couple of lines (approximately) to facilitate reading it.
  221.  
  222.   `dissociated-press' asks every so often whether to continue
  223. operating.  Answer `n' to stop it.  You can also stop at any time by
  224. typing `C-g'.  The dissociation output remains in the `*Dissociation*'
  225. buffer for you to copy elsewhere if you wish.
  226.  
  227.   Dissociated Press operates by jumping at random from one point in the
  228. buffer to another.  In order to produce plausible output rather than
  229. gibberish, it insists on a certain amount of overlap between the end of one
  230. run of consecutive words or characters and the start of the next.  That is,
  231. if it has just printed out `president' and then decides to jump to a
  232. different point in the file, it might spot the `ent' in `pentagon' and
  233. continue from there, producing `presidentagon'.  Long sample texts produce
  234. the best results.
  235.  
  236.   A positive argument to `M-x dissociated-press' tells it to operate
  237. character by character, and specifies the number of overlap characters.  A
  238. negative argument tells it to operate word by word and specifies the number
  239. of overlap words.  In this mode, whole words are treated as the elements to
  240. be permuted, rather than characters.  No argument is equivalent to an
  241. argument of two.  For your againformation, the output goes only into the
  242. buffer `*Dissociation*'.  The buffer you start with is not changed.
  243.  
  244.   Dissociated Press produces nearly the same results as a Markov chain
  245. based on a frequency table constructed from the sample text.  It is,
  246. however, an independent, ignoriginal invention.  Dissociated Press
  247. techniquitously copies several consecutive characters from the sample
  248. between random choices, whereas a Markov chain would choose randomly for
  249. each word or character.  This makes for more plausible sounding results,
  250. and runs faster.
  251.  
  252.   It is a mustatement that too much use of Dissociated Press can be a
  253. developediment to your real work.  Sometimes to the point of outragedy.
  254. And keep dissociwords out of your documentation, if you want it to be well
  255. userenced and properbose.  Have fun.  Your buggestions are welcome.
  256.  
  257. 
  258. File: emacs  Node: Amusements, Prev: Dissociated Press, Up: Top, Next: Emulation
  259.  
  260. Other Amusements
  261. ================
  262.  
  263.   If you are a little bit bored, you can try `M-x hanoi'.  If you are
  264. considerably bored, give it a numeric argument.  If you are very very
  265. bored, try an argument of 9.  Sit back and watch.
  266.  
  267.   When you are frustrated, try the famous Eliza program.  Just do
  268. `M-x doctor'.  End each input by typing `RET' twice.
  269.  
  270.   When you are feeling strange, type `M-x yow'.
  271.  
  272. 
  273. File: emacs  Node: Emulation, Prev: Amusements, Up: Top, Next: Customization
  274.  
  275. Emulation
  276. =========
  277.  
  278.   GNU Emacs can be programmed to emulate (more or less) most other
  279. editors.  Standard facilities can emulate these:
  280.  
  281. EDT (DEC VMS editor)     
  282.      Turn on EDT emulation with `M-x edt-emulation-on'.  `M-x
  283.      edt-emulation-off' restores normal Emacs command bindings.
  284.      
  285.      Most of the EDT emulation commands are keypad keys, and most standard Emacs
  286.      key bindings are still available.  The EDT emulation rebindings are done in
  287.      the global keymap, so there is no problem switching buffers or major modes
  288.      while in EDT emulation.
  289.      
  290. Gosling Emacs     
  291.      Turn on emulation of Gosling Emacs (aka Unipress Emacs) with `M-x
  292.      set-gosmacs-bindings'.  This redefines many keys, mostly on the
  293.      `C-x' and `ESC' prefixes, to work as they do in Gosmacs.
  294.      `M-x set-gnu-bindings' returns to normal GNU Emacs by rebinding
  295.      the same keys to the definitions they had at the time `M-x
  296.      set-gosmacs-bindings' was done.
  297.      
  298.      It is also possible to run Mocklisp code written for Gosling Emacs.
  299.      *Note Mocklisp::.
  300.      
  301. vi (Berkeley Unix editor)     
  302.      Turn on vi emulation with `M-x vi-mode'.  This is a major mode
  303.      that replaces the previously established major mode.  All of the
  304.      vi commands that, in real vi, enter "input" mode are programmed
  305.      in the Emacs emulator to return to the previous major mode.  Thus,
  306.      ordinary Emacs serves as vi's "input" mode.
  307.      
  308.      Because vi emulation works through major modes, it does not work
  309.      to switch buffers during emulation.  Return to normal Emacs first.
  310.      
  311.      If you plan to use vi emulation much, you probably want to bind a key
  312.      to the `vi-mode' command.
  313.      
  314. vi (alternate emulator)     
  315.      Another vi emulator said to resemble real vi more thoroughly is
  316.      invoked by `M-x vip-mode'.  "Input" mode in this emulator is
  317.      changed from ordinary Emacs so you can use ESC to go back to
  318.      emulated vi command mode.  To get from emulated vi command mode back
  319.      to ordinary Emacs, type `C-z'.
  320.      
  321.      This emulation does not work through major modes, and it is possible
  322.      to switch buffers in various ways within the emulator.  It is not
  323.      so necessary to assign a key to the command `vip-mode' as
  324.      it is with `vi-mode' because terminating insert mode does
  325.      not use it.
  326.      
  327.      For full information, see the long comment at the beginning of the
  328.      source file, which is `lisp/vip.el' in the Emacs distribution.
  329.  
  330. I am interested in hearing which vi emulator users prefer, as well as in
  331. receiving more complete user documentation for either or both emulators.
  332. Warning: loading both at once may cause name conficts; no one has checked.
  333.  
  334. 
  335. File: emacs  Node: Customization, Prev: Emulation, Up: Top, Next: Quitting
  336.  
  337. Customization
  338. *************
  339.  
  340.   This chapter talks about various topics relevant to adapting the
  341. behavior of Emacs in minor ways.
  342.  
  343.   All kinds of customization affect only the particular Emacs job that you
  344. do them in.  They are completely lost when you kill the Emacs job, and have
  345. no effect on other Emacs jobs you may run at the same time or later.  The
  346. only way an Emacs job can affect anything outside of it is by writing a
  347. file; in particular, the only way to make a customization `permanent' is to
  348. put something in your `.emacs' file or other appropriate file to do the
  349. customization in each session.  *Note Init File::.
  350.  
  351. * Menu:
  352.  
  353. * Minor Modes::     Each minor mode is one feature you can turn on
  354.                      independently of any others.
  355. * Variables::       Many Emacs commands examine Emacs variables
  356.                      to decide what to do; by setting variables,
  357.                      you can control their functioning.
  358. * Keyboard Macros:: A keyboard macro records a sequence of keystrokes
  359.                      to be replayed with a single command.
  360. * Key Bindings::    The keymaps say what command each key runs.
  361.                      By changing them, you can "redefine keys".
  362. * Syntax::          The syntax table controls how words and expressions
  363.                      are parsed.
  364. * Init File::       How to write common customizations in the `.emacs' file.
  365.  
  366. 
  367. File: emacs  Node: Minor Modes, Prev: Customization, Up: Customization, Next: Variables
  368.  
  369. Minor Modes
  370. ===========
  371.  
  372.   Minor modes are options which you can use or not.  For example, Auto Fill
  373. mode is a minor mode in which SPC breaks lines between words as you
  374. type.  All the minor modes are independent of each other and of the
  375. selected major mode.  Most minor modes say in the mode line when they are
  376. on; for example, `Fill' in the mode line means that Auto Fill mode is
  377. on.
  378.  
  379.   Append `-mode' to the name of a minor mode to get the name of a
  380. command function that turns the mode on or off.  Thus, the command to
  381. enable or disable Auto Fill mode is called `M-x auto-fill-mode'.  These
  382. commands are usually invoked with `M-x', but you can bind keys to them
  383. if you wish.  With no argument, the function turns the mode on if it was
  384. off and off if it was on.  This is known as "toggling".  A positive
  385. argument always turns the mode on, and an explicit zero argument or a
  386. negative argument always turns it off.
  387.  
  388.   Auto Fill mode allows you to enter filled text without breaking lines
  389. explicitly.  Emacs inserts newlines as necessary to prevent lines from
  390. becoming too long.  *Note Filling::.
  391.  
  392.   Overwrite mode causes ordinary printing characters to replace existing
  393. text instead of shoving it over.  For example, if the point is in front of
  394. the `B' in `FOOBAR', then in Overwrite mode typing a `G' changes it to
  395. `FOOGAR', instead of making it `FOOGBAR' as usual.
  396.  
  397.   Abbrev mode allows you to define abbreviations that automatically expand
  398. as you type them.  For example, `amd' might expand to `abbrev
  399. mode'.  *Note Abbrevs::, for full information.
  400.  
  401. 
  402. File: emacs  Node: Variables, Prev: Minor Modes, Up: Customization, Next: Keyboard Macros
  403.  
  404. Variables
  405. =========
  406.  
  407.   A "variable" is a Lisp symbol which has a value.  The symbol's name
  408. is also called the name of the variable.  Variable names can contain any
  409. characters, but conventionally they are chosen to be words separated by
  410. hyphens.  A variable can have a documentation string which describes what
  411. kind of value it should have and how the value will be used.
  412.  
  413.   Lisp allows any variable to have any kind of value, but most variables
  414. that Emacs uses require a value of a certain type.  Often the value should
  415. always be a string, or should always be a number.  Sometimes we say that a
  416. certain feature is turned on if a variable is "non-`nil'," meaning
  417. that if the variable's value is `nil', the feature is off, but the
  418. feature is on for any other value.  The conventional value to use to
  419. turn on the feature---since you have to pick one particular value when you
  420. set the variable---is `t'.
  421.  
  422.   Emacs uses many Lisp variables for internal recordkeeping, as any Lisp
  423. program must, but the most interesting variables for you are the ones that
  424. exist for the sake of customization.  Emacs does not (usually) change the
  425. values of these variables; instead, you set the values, and thereby alter
  426. and control the behavior of certain Emacs commands.  These variables are
  427. called "options".  Most options are documented in this manual, and
  428. appear in the Variable Index (*Note Variable Index::).
  429.  
  430.   One example of a variable which is an option is `fill-column', which
  431. specifies the position of the right margin (as a number of characters from
  432. the left margin) to be used by the fill commands (*Note Filling::).
  433.  
  434. * Menu:
  435.  
  436. * Examining::           Examining or setting one variable's value.
  437. * Edit Options::        Examining or editing list of all variables' values.
  438. * Locals::              Per-buffer values of variables.
  439. * File Variables::      How files can specify variable values.
  440.  
  441. 
  442. File: emacs  Node: Examining, Prev: Variables, Up: Variables, Next: Edit Options
  443.  
  444. Examining and Setting Variables
  445. -------------------------------
  446.  
  447. `C-h v'     
  448. `M-x describe-variable'     
  449.      Print the value and documentation of a variable.
  450. `M-x set-variable'     
  451.      Change the value of a variable.
  452.  
  453.   To examine the value of a single variable, use `C-h v'
  454. (`describe-variable'), which reads a variable name using the
  455. minibuffer, with completion.  It prints both the value and the
  456. documentation of the variable.
  457.  
  458.      C-h v fill-column RET
  459. prints something like
  460.      fill-column's value is 75
  461.      
  462.      Documentation:
  463.      *Column beyond which automatic line-wrapping should happen.
  464.      Automatically becomes local when set in any fashion.
  465.  
  466. The star at the beginning of the documentation indicates that this variable
  467. is an option.  `C-h v' is not restricted to options; it allows any
  468. variable name.
  469.  
  470.   If you know which option you want to set, you can set it using `M-x
  471. set-variable'.  This reads the variable name with the minibuffer (with
  472. completion), and then reads a Lisp expression for the new value using the
  473. minibuffer a second time.  For example,
  474.  
  475.      M-x set-variable RET fill-column RET 75 RET
  476.  
  477. sets `fill-column' to 75, like executing the Lisp expression
  478.  
  479.      (setq fill-column 75)
  480.  
  481.   Setting variables in this way, like all means of customizing Emacs
  482. except where explicitly stated, affects only the current Emacs session.
  483.  
  484. 
  485. File: emacs  Node: Edit Options, Prev: Examining, Up: Variables, Next: Locals
  486.  
  487. Editing Variable Values
  488. -----------------------
  489.  
  490. `M-x list-options'     
  491.      Display a buffer listing names, values and documentation of all options.
  492. `M-x edit-options'     
  493.      Change option values by editing a list of options.
  494.  
  495.   `M-x list-options' displays a list of all Emacs option variables, in
  496. an Emacs buffer named `*List Options*'.  Each option is shown with its
  497. documentation and its current value.  Here is what a portion of it might
  498. look like:
  499.  
  500.      ;; exec-path:
  501.      ("." "/usr/local/bin" "/usr/ucb" "/bin" "/usr/bin" "/u2/emacs/etc")
  502.      *List of directories to search programs to run in subprocesses.
  503.      Each element is a string (directory name)
  504.      or nil (try the default directory).
  505.      ;;
  506.      ;; fill-column:
  507.      75
  508.      *Column beyond which automatic line-wrapping should happen.
  509.      Automatically becomes local when set in any fashion.
  510.      ;;
  511.  
  512.   `M-x edit-options' goes one step further and immediately selects the
  513. `*List Options*' buffer; this buffer uses the major mode Options mode,
  514. which provides commands that allow you to point at an option and change its
  515. value:
  516.  
  517. `s'     
  518.      Set the variable point is in or near to a new value read using the
  519.      minibuffer.
  520. `x'     
  521.      Toggle the variable point is in or near: if the value was `nil',
  522.      it becomes `t'; otherwise it becomes `nil'.
  523. `1'     
  524.      Set the variable point is in or near to `t'.
  525. `0'     
  526.      Set the variable point is in or near to `nil'.
  527. `n'     
  528. `p'     
  529.      Move to the next or previous variable.
  530.  
  531. 
  532. File: emacs  Node: Locals, Prev: Edit Options, Up: Variables, Next: File Variables
  533.  
  534. Local Variables
  535. ---------------
  536.  
  537. `M-x make-local-variable'     
  538.      Make a variable have a local value in the current buffer.
  539. `M-x kill-local-variable'     
  540.      Make a variable use its global value in the current buffer.
  541. `M-x make-variable-buffer-local'     
  542.      Mark a variable so that setting it will make it local to the
  543.      buffer that is current at that time.
  544.  
  545.   Any variable can be made "local" to a specific Emacs buffer.  This
  546. means that its value in that buffer is independent of its value in other
  547. buffers.  A few variables are always local in every buffer.  Every other
  548. Emacs variable has a "global" value which is in effect in all buffers
  549. that have not made the variable local.
  550.  
  551.   Major modes always make the variables they set local to the buffer.
  552. This is why changing major modes in one buffer has no effect on other
  553. buffers.
  554.  
  555.   `M-x make-local-variable' reads the name of a variable and makes it
  556. local to the current buffer.  Further changes in this buffer will not
  557. affect others, and further changes in the global value will not affect this
  558. buffer.
  559.  
  560.   `M-x make-variable-buffer-local' reads the name of a variable and
  561. changes the future behavior of the variable so that it will become local
  562. automatically when it is set.  More precisely, once a variable has been
  563. marked in this way, the usual ways of setting the variable will
  564. automatically do `make-local-variable' first.  We call such variables
  565. "per-buffer" variables.
  566.  
  567.   Some important variables have been marked per-buffer already.  These
  568. include `abbrev-mode', `auto-fill-hook', `case-fold-search',
  569. `comment-column', `ctl-arrow', `fill-column', `fill-prefix',
  570. `indent-tabs-mode', `left-margin', `mode-line-format', `overwrite-mode',
  571. `selective-display-ellipses', `selective-display', `tab-width', and
  572. `truncate-lines'.  Some other variables are always local in every buffer,
  573. but they are used for internal purposes.
  574.  
  575.   `M-x kill-local-variable' reads the name of a variable and makes it
  576. cease to be local to the current buffer.  The global value of the variable
  577. henceforth is in effect in this buffer.  Setting the major mode kills all
  578. the local variables of the buffer.
  579.  
  580.   To set the global value of a variable, regardless of whether the
  581. variable has a local value in the current buffer, you can use the
  582. Lisp function `setq-default'.  It works like `setq'.
  583. If there is a local value in the current buffer, the local value is
  584. not affected by `setq-default'; thus, the new global value may
  585. not be visible until you switch to another buffer.  For example,
  586.  
  587.      (setq-default fill-column 75)
  588.  
  589. `setq-default' is the only way to set the global value of a variable
  590. that has been marked with `make-variable-buffer-local'.
  591.  
  592.   Programs can look at a variable's default value with `default-value'.
  593. This function takes a symbol as argument and returns its default value.
  594. The argument is evaluated; usually you must quote it explicitly.  For
  595. example,
  596.  
  597.      (default-value 'fill-column)
  598.  
  599. 
  600. File: emacs  Node: File Variables, Prev: Locals, Up: Variables
  601.  
  602. Local Variables in Files
  603. ------------------------
  604.  
  605.   A file can contain a "local variables list", which specifies the
  606. values to use for certain Emacs variables when that file is edited.
  607. Visiting the file checks for a local variables list and makes each variable
  608. in the list local to the buffer in which the file is visited, with the
  609. value specified in the file.
  610.  
  611.   A local variables list goes near the end of the file, in the last page.
  612. (It is often best to put it on a page by itself.)  The local variables list
  613. starts with a line containing the string `Local Variables:', and ends
  614. with a line containing the string `End:'.  In between come the
  615. variable names and values, one set per line, as `VARIABLE:
  616. VALUE'.  The VALUEs are not evaluated; they are used literally.
  617.  
  618.   The line which starts the local variables list does not have to say just
  619. `Local Variables:'.  If there is other text before `Local Variables:', that
  620. text is called the "prefix", and if there is other text after, that is
  621. called the "suffix".  If these are present, each entry in the local
  622. variables list should have the prefix before it and the suffix after it.
  623. This includes the `End:' line.  The prefix and suffix are included to
  624. disguise the local variables list as a comment so that the compiler or text
  625. formatter will not be perplexed by it.  If you do not need to disguise the
  626. local variables list as a comment in this way, do not bother with a prefix
  627. or a suffix.
  628.  
  629.   Two "variable" names are special in a local variables list: a value for
  630. the variable `mode' really sets the major mode, and a value for the
  631. variable `eval' is simply evaluated as an expression and the value is
  632. ignored.  These are not real variables; setting such variables in any other
  633. context has no such effect.  If `mode' is used in a local variables
  634. list, it should be the first entry in the list.
  635.  
  636. Here is an example of a local variables list:
  637.      ;;; Local Variables: ***
  638.      ;;; mode:lisp ***
  639.      ;;; comment-column:0 ***
  640.      ;;; comment-start: ";;; "  ***
  641.      ;;; comment-end:"***" ***
  642.      ;;; End: ***
  643.  
  644.   Note that the prefix is `;;; ' and the suffix is ` ***'.  Note also
  645. that comments in the file begin with and end with the same strings.
  646. Presumably the file contains code in a language which is like Lisp
  647. (like it enough for Lisp mode to be useful) but in which comments start
  648. and end in that way.  The prefix and suffix are used in the local
  649. variables list to make the list appear as comments when the file is read
  650. by the compiler or interpreter for that    language.
  651.  
  652.   The start of the local variables list must be no more than 3000
  653. characters from the end of the file, and must be in the last page if the
  654. file is divided into pages.  Otherwise, Emacs will not notice it is there.
  655. The purpose of this is so that a stray `Local Variables:' not in the
  656. last page does not confuse Emacs, and so that visiting a long file that is
  657. all one page and has no local variables list need not take the time to
  658. search the whole file.
  659.  
  660.   You may be tempted to try to turn on Auto Fill mode with a local variable
  661. list.  That is a mistake.  The choice of Auto Fill mode or not is a matter
  662. of individual taste, not a matter of the contents of particular files.
  663. If you want to use Auto Fill, set up major mode hooks with your `.emacs'
  664. file to turn it on (when appropriate) for you alone (*Note Init File::).
  665. Don't try to use a local variable list that would impose your taste on
  666. everyone.
  667.  
  668. 
  669. File: emacs  Node: Keyboard Macros, Prev: Variables, Up: Customization, Next: Key Bindings
  670.  
  671. Keyboard Macros
  672. ===============
  673.  
  674.   A "keyboard macro" is a command defined by the user to abbreviate a
  675. sequence of keys.  For example, if you discover that you are about to type
  676. `C-n C-d' forty times, you can speed your work by defining a keyboard
  677. macro to do `C-n C-d' and calling it with a repeat count of forty.
  678.  
  679. `C-x ('     
  680.      Start defining a keyboard macro (`start-kbd-macro').
  681. `C-x )'     
  682.      End the definition of a keyboard macro (`end-kbd-macro').
  683. `C-x e'     
  684.      Execute the most recent keyboard macro (`call-last-kbd-macro').
  685. `C-u C-x ('     
  686.      Re-execute last keyboard macro, then add more keys to its definition.
  687. `C-x q'     
  688.      When this point is reached during macro execution, ask for confirmation
  689.      (`kbd-macro-query').
  690. `M-x name-last-kbd-macro'     
  691.      Give a command name (for the duration of the session) to the most
  692.      recently defined keyboard macro.
  693. `M-x insert-kbd-macro'     
  694.      Insert in the buffer a keyboard macro's definition, as Lisp code.
  695.  
  696.   Keyboard macros differ from ordinary Emacs commands in that they are
  697. written in the Emacs command language rather than in Lisp.  This makes it
  698. easier for the novice to write them, and makes them more convenient as
  699. temporary hacks.  However, the Emacs command language is not powerful
  700. enough as a programming language to be useful for writing anything
  701. intelligent or general.  For such things, Lisp must be used.
  702.  
  703.   You define a keyboard macro while executing the commands which are the
  704. definition.  Put differently, as you are defining a keyboard macro, the
  705. definition is being executed for the first time.  This way, you can see
  706. what the effects of your commands are, so that you don't have to figure
  707. them out in your head.  When you are finished, the keyboard macro is
  708. defined and also has been, in effect, executed once.  You can then do the
  709. whole thing over again by invoking the macro.
  710.  
  711. * Menu:
  712.  
  713. * Basic Kbd Macro::     Defining and running keyboard macros.
  714. * Save Kbd Macro::      Giving keyboard macros names; saving them in files.
  715. * Kbd Macro Query::     Keyboard macros that do different things each use.
  716.  
  717. 
  718. File: emacs  Node: Basic Kbd Macro, Prev: Keyboard Macros, Up: Keyboard Macros, Next: Save Kbd Macro
  719.  
  720. Basic Use
  721. ---------
  722.  
  723.   To start defining a keyboard macro, type the `C-x (' command
  724. (`start-kbd-macro').  From then on, your keys continue to be
  725. executed, but also become part of the definition of the macro.  `Def'
  726. appears in the mode line to remind you of what is going on.  When you are
  727. finished, the `C-x )' command (`end-kbd-macro') terminates the
  728. definition (without becoming part of it!).  For example
  729.  
  730.      C-x ( M-F foo C-x )
  731.  
  732. defines a macro to move forward a word and then insert `foo'.
  733.  
  734.   The macro thus defined can be invoked again with the `C-x e' command
  735. (`call-last-kbd-macro'), which may be given a repeat count as a
  736. numeric argument to execute the macro many times.  `C-x )' can also be
  737. given a repeat count as an argument, in which case it repeats the macro
  738. that many times right after defining it, but defining the macro counts as
  739. the first repetition (since it is executed as you define it).  So, giving
  740. `C-x )' an argument of 4 executes the macro immediately 3 additional
  741. times.  An argument of zero to `C-x e' or `C-x )' means repeat the
  742. macro indefinitely (until it gets an error or you type `C-g').
  743.  
  744.   If you wish to repeat an operation at regularly spaced places in the
  745. text, define a macro and include as part of the macro the commands to move
  746. to the next place you want to use it.  For example, if you want to change
  747. each line, you should position point at the start of a line, and define a
  748. macro to change that line and leave point at the start of the next line.
  749. Then repeating the macro will operate on successive lines.
  750.  
  751.   After you have terminated the definition of a keyboard macro, you can add
  752. to the end of its definition by typing `C-u C-x ('.  This is equivalent
  753. to plain `C-x (' followed by retyping the whole definition so far.  As
  754. a consequence it re-executes the macro as previously defined.
  755.  
  756. 
  757. File: emacs  Node: Save Kbd Macro, Prev: Basic Kbd Macro, Up: Keyboard Macros, Next: Kbd Macro Query
  758.  
  759. Naming and Saving Keyboard Macros
  760. ---------------------------------
  761.  
  762.   If you wish to save a keyboard macro for longer than until you define the
  763. next one, you must give it a name using `M-x name-last-kbd-macro'.
  764. This reads a name as an argument using the minibuffer and defines that name
  765. to execute the macro.  The macro name is a Lisp symbol, and defining it in
  766. this way makes it a valid command name for calling with `M-x' or for
  767. binding a key to with `global-set-key' (*Note Keymaps::).  If you
  768. specify a name that has a prior definition other than another keyboard
  769. macro, an error message is printed and nothing is changed.
  770.  
  771.   Once a macro has a command name, you can save its definition in a file.
  772. Then it can be used in another editing session.  First visit the file
  773. you want to save the definition in.  Then use the command
  774.  
  775.      M-x insert-kbd-macro RET MACRONAME RET
  776.  
  777. This inserts some Lisp code that, when executed later, will define the same
  778. macro with the same definition it has now.  You need not understand Lisp
  779. code to do this, because `insert-kbd-macro' writes the Lisp code for you.
  780. Then save the file.  The file can be loaded with `load-file'
  781. (*Note Lisp Libraries::).  If the file you save in is your init file
  782. `~/.emacs' (*Note Init File::) then the macro will be defined each
  783. time you run Emacs.
  784.  
  785.   If you give `insert-kbd-macro' a prefix argument, it makes
  786. additional Lisp code to record the keys (if any) that you have bound to the
  787. keyboard macro, so that the macro will be reassigned the same keys when you
  788. load the file.
  789.  
  790. 
  791. File: emacs  Node: Kbd Macro Query, Prev: Save Kbd Macro, Up: Keyboard Macros
  792.  
  793. Executing Macros with Variations
  794. --------------------------------
  795.  
  796.   Using `C-x q' (`kbd-macro-query'), you can get an effect similar
  797. to that of `query-replace', where the macro asks you each time around
  798. whether to make a change.  When you are defining the macro, type `C-x
  799. q' at the point where you want the query to occur.  During macro
  800. definition, the `C-x q' does nothing, but when the macro is invoked the
  801. `C-x q' reads a character from the terminal to decide whether to
  802. continue.
  803.  
  804.   The special answers are SPC, DEL, `C-d', `C-l' and `C-r'.  Any other
  805. character terminates execution of the keyboard macro and is then read as a
  806. command.  SPC means to continue.  DEL means to skip the remainder of this
  807. repetition of the macro, starting again from the beginning in the next
  808. repetition.  `C-d' means to skip the remainder of this repetition and
  809. cancel further repetition.  `C-l' redraws the screen and asks you again for
  810. a character to say what to do.  `C-r' enters a recursive editing level, in
  811. which you can perform editing which is not part of the macro.  When you
  812. exit the recursive edit using `C-M-c', you are asked again how to continue
  813. with the keyboard macro.  If you type a SPC at this time, the rest of the
  814. macro definition is executed.  It is up to you to leave point and the text
  815. in a state such that the rest of the macro will do what you want.
  816.  
  817.   `C-u C-x q', which is `C-x q' with a numeric argument, performs a
  818. different function.  It enters a recursive edit reading input from the
  819. keyboard, both when you type it during the definition of the macro, and
  820. when it is executed from the macro.  During definition, the editing you do
  821. inside the recursive edit does not become part of the macro.  During macro
  822. execution, the recursive edit gives you a chance to do some particularized
  823. editing.  *Note Recursive Edit::.
  824.  
  825. 
  826. File: emacs  Node: Key Bindings, Prev: Keyboard Macros, Up: Customization, Next: Syntax
  827.  
  828. Customizing Key Bindings
  829. ========================
  830.  
  831.   This section deals with the "keymaps" which define the bindings
  832. between keys and functions, and shows how you can customize these bindings.
  833.  
  834.   A command is a Lisp function whose definition provides for interactive
  835. use.  Like every Lisp function, a command has a function name, a Lisp
  836. symbol whose name usually consists of lower case letters and hyphens.
  837.  
  838. * Menu:
  839.  
  840. * Keymaps::    Definition of the keymap data structure.
  841.                Names of Emacs's standard keymaps.
  842. * Rebinding::  How to redefine one key's meaning conveniently.
  843. * Disabling::  Disabling a command means confirmation is required
  844.                 before it can be executed.  This is done to protect
  845.                 beginners from surprises.
  846.  
  847. 
  848. File: emacs  Node: Keymaps, Prev: Key Bindings, Up: Key Bindings, Next: Rebinding
  849.  
  850. Keymaps
  851. -------
  852.  
  853.   The bindings between characters and command functions are recorded in
  854. data structures called "keymaps".  Emacs has many of these.  One, the
  855. "global" keymap, defines the meanings of the single-character keys that
  856. are defined regardless of major mode.  It is the value of the variable
  857. `global-map'.
  858.  
  859.   Each major mode has another keymap, its "local keymap", which
  860. contains overriding definitions for the single-character keys that are to
  861. be redefined in that mode.  Each buffer records which local keymap is
  862. installed for it at any time, and the current buffer's local keymap is the
  863. only one that directly affects command execution.  The local keymaps for
  864. Lisp mode, C mode, and many other major modes always exist even when not in
  865. use.  They are the values of the variables `lisp-mode-map',
  866. `c-mode-map', and so on.  For major modes less often used, the local
  867. keymap is sometimes constructed only when the mode is used for the first
  868. time in a session.  This is to save space.
  869.  
  870.   There are local keymaps for the minibuffer too; they contain various
  871. completion and exit commands.
  872.  
  873.    * `minibuffer-local-map' is used for ordinary input (no completion).
  874.    * `minibuffer-local-ns-map' is similar, except that SPC exits
  875.      just like RET.  This is used mainly for Mocklisp compatibility.
  876.    * `minibuffer-local-completion-map' is for permissive completion.
  877.    * `minibuffer-local-must-match-map' is for strict completion and
  878.      for cautious completion.
  879.    * `repeat-complex-command-map' is for use in `C-x ESC'.
  880.  
  881.   Finally, each prefix key has a keymap which defines the key sequences
  882. that start with it.  For example, `ctl-x-map' is the keymap used for
  883. characters following a `C-x'.
  884.  
  885.    * `ctl-x-map' is the variable name for the map used for characters that
  886.      follow `C-x'.
  887.    * `help-map' is used for characters that follow `C-h'.
  888.    * `esc-map' is for characters that follow ESC.  Thus, all Meta
  889.      characters are actually defined by this map.
  890.    * `ctl-x-4-map' is for characters that follow `C-x 4'.
  891.    * `mode-specific-map' is for characters that follow `C-c'.
  892.  
  893.   The definition of a prefix key is just the keymap to use for looking up
  894. the following character.  Actually, the definition is sometimes a Lisp
  895. symbol whose function definition is the following character keymap.  The
  896. effect is the same, but it provides a command name for the prefix key that
  897. can be used as a description of what the prefix key is for.  Thus, the
  898. binding of `C-x' is the symbol `Ctl-X-Prefix', whose function definition is
  899. the keymap for `C-x' commands, the value of `ctl-x-map'.
  900.  
  901.   Prefix key definitions of this sort can appear in either the global map
  902. or a local map.  The definitions of `C-c', `C-x', `C-h' and ESC as prefix
  903. keys appear in the global map, so these prefix keys are always available.
  904. Major modes can locally redefine a key as a prefix by putting a prefix key
  905. definition for it in the local map.
  906.  
  907.   A mode can also put a prefix definition of a global prefix character such
  908. as `C-x' into its local map.  This is how major modes override the
  909. definitions of certain keys that start with `C-x'.  This case is special,
  910. because the local definition does not entirely replace the global one.
  911. When both the global and local definitions of a key are other keymaps, the
  912. next character is looked up in both keymaps, with the local definition
  913. overriding the global one as usual.  So, the character after the `C-x' is
  914. looked up in both the major mode's own keymap for redefined `C-x' commands
  915. and in `ctl-x-map'.  If the major mode's own keymap for `C-x' commands
  916. contains `nil', the definition from the global keymap for `C-x' commands is
  917. used.
  918.  
  919.   A keymap is actually a Lisp object.  The simplest form of keymap is a
  920. Lisp vector of length 128.  The binding for a character in such a keymap is
  921. found by indexing into the vector with the character as an index.  A keymap
  922. can also be a Lisp list whose car is the symbol `keymap' and whose
  923. remaining elements are pairs of the form `(CHAR . BINDING)'.
  924. Such lists are called "sparse keymaps" because they are used when most
  925. of the characters' entries will be `nil'.  Sparse keymaps are used
  926. mainly for prefix characters.
  927.  
  928.   Keymaps are only of length 128, so what about Meta characters, whose
  929. codes are from 128 to 255?  A key that contains a Meta character actually
  930. represents it as a sequence of two characters, the first of which is ESC.
  931. So the key `M-a' is really represented as `ESC a', and its binding is found
  932. at the slot for `a' in `esc-map'.
  933.  
  934. 
  935. File: emacs  Node: Rebinding, Prev: Keymaps, Up: Key Bindings, Next: Disabling
  936.  
  937. Changing Key Bindings Interactively
  938. -----------------------------------
  939.  
  940.   The way to redefine an Emacs key is to change its entry in a keymap.
  941. You can change the global keymap, in which case the change is effective in
  942. all major modes (except those that have their own overriding local
  943. definitions for the same key).  Or you can change the current buffer's
  944. local map, which affects all buffers using the same major mode.
  945.  
  946. `M-x global-set-key RET KEY CMD RET'     
  947.      Defines KEY globally to run CMD.
  948. `M-x local-set-key RET KEY CMD RET'     
  949.      Defines KEY locally (in the major mode now in effect) to run
  950.      CMD.
  951.  
  952.   For example,
  953.  
  954.      M-x global-set-key RET C-f next-line RET
  955.  
  956. would redefine `C-f' to move down a line.  The fact that CMD is
  957. read second makes it serve as a kind of confirmation for KEY.
  958.  
  959.   These functions offer no way to specify a particular prefix keymap as the
  960. one to redefine in, but that is not necessary, as you can include prefixes
  961. in KEY.  KEY is read by reading characters one by one until they amount to
  962. a complete key (that is, not a prefix key).  Thus, if you type `C-f' for
  963. KEY, that's the end; the minibuffer is entered immediately to read CMD.
  964. But if you type `C-x', another character is read; if that is `4', another
  965. character is read, and so on.  For example,
  966.  
  967.      M-x global-set-key RET C-x 4 $ spell-other-window RET
  968.  
  969. would redefine `C-x 4 $' to run the (fictitious) command
  970. `spell-other-window'.
  971.  
  972.   The most general way to modify a keymap is the function `define-key',
  973. used in Lisp code (such as your `.emacs' file).  `define-key'
  974. takes three arguments: the keymap, the key to modify in it, and the new
  975. definition.  *Note Init File::, for an example.  `substitute-key-definition'
  976. is used similarly; it takes three arguments, an old definition, a new
  977. definition and a keymap, and redefines in that keymap all keys that were
  978. previously defined with the old definition to have the new definition
  979. instead.
  980.  
  981. 
  982. File: emacs  Node: Disabling, Prev: Rebinding, Up: Key Bindings
  983.  
  984. Disabling Commands
  985. ------------------
  986.  
  987.   Disabling a command marks the command as requiring confirmation before it
  988. can be executed.  The purpose of disabling a command is to prevent
  989. beginning users from executing it by accident and being confused.
  990.  
  991.   The direct mechanism for disabling a command is to have a non-`nil'
  992. `disabled' property on the Lisp symbol for the command.  These
  993. properties are normally set up by the user's `.emacs' file with
  994. Lisp expressions such as
  995.  
  996.      (put 'delete-region 'disabled t)
  997.  
  998.   If the value of the `disabled' property is a string, that string
  999. is included in the message printed when the command is used:
  1000.  
  1001.      (put 'delete-region 'disabled
  1002.           "Text deleted this way cannot be yanked back!\n")
  1003.  
  1004.   You can make a command disabled either by editing the `.emacs' file
  1005. directly or with the command `M-x disable-command', which edits the
  1006. `.emacs' file for you.  *Note Init File::.
  1007.  
  1008.   Attempting to invoke a disabled command interactively in Emacs causes the
  1009. display of a window containing the command's name, its documentation, and
  1010. some instructions on what to do immediately; then Emacs asks for input
  1011. saying whether to execute the command as requested, enable it and execute,
  1012. or cancel it.  If you decide to enable the command, you are asked whether to
  1013. do this permanently or just for the current session.  Enabling permanently
  1014. works by automatically editing your `.emacs' file.  You can use
  1015. `M-x enable-command' at any time to enable any command permanently.
  1016.  
  1017.   Whether a command is disabled is independent of what key is used to
  1018. invoke it; it also applies if the command is invoked using `M-x'.
  1019. Disabling a command has no effect on calling it as a function from Lisp
  1020. programs.
  1021.  
  1022. 
  1023. File: emacs  Node: Syntax, Prev: Key Bindings, Up: Customization, Next: Init File
  1024.  
  1025. The Syntax Table
  1026. ================
  1027.  
  1028.   All the Emacs commands which parse words or balance parentheses are
  1029. controlled by the "syntax table".  The syntax table says which
  1030. characters are opening delimiters, which are parts of words, which are
  1031. string quotes, and so on.  Actually, each major mode has its own syntax
  1032. table (though sometimes related major modes use the same one) which it
  1033. installs in each buffer that uses that major mode.  The syntax table
  1034. installed in the current buffer is the one that all commands use, so we
  1035. call it "the" syntax table.  A syntax table is a Lisp object, a vector of
  1036. length 256 whose elements are numbers.
  1037.  
  1038. * Menu:
  1039.  
  1040. * Entry: Syntax Entry.    What the syntax table records for each character.
  1041. * Change: Syntax Change.  How to change the information.
  1042.  
  1043. 
  1044. File: emacs  Node: Syntax Entry, Prev: Syntax, Up: Syntax, Next: Syntax Change
  1045.  
  1046. Information about Each Character
  1047. --------------------------------
  1048.  
  1049.   The syntax table entry for a character is a number that encodes six
  1050. pieces of information:
  1051.  
  1052.    * The syntactic class of the character, represented as a small integer.
  1053.    * The matching delimiter, for delimiter characters only.
  1054.      The matching delimiter of `(' is `)', and vice versa.
  1055.    * A flag saying whether the character is the first character of a
  1056.      two-character comment starting sequence.
  1057.    * A flag saying whether the character is the second character of a
  1058.      two-character comment starting sequence.
  1059.    * A flag saying whether the character is the first character of a
  1060.      two-character comment ending sequence.
  1061.    * A flag saying whether the character is the second character of a
  1062.      two-character comment ending sequence.
  1063.  
  1064.   The syntactic classes are stored internally as small integers, but are
  1065. usually described to or by the user with characters.  For example, `('
  1066. is used to specify the syntactic class of opening delimiters.  Here is a
  1067. table of syntactic classes, with the characters that specify them.
  1068.  
  1069. ` '     
  1070.      The class of whitespace characters.
  1071. `w'     
  1072.      The class of word-constituent characters.
  1073. `_'     
  1074.      The class of characters that are part of symbol names but not words.
  1075.      This class is represented by `_' because the character `_'
  1076.      has this class in both C and Lisp.
  1077. `.'     
  1078.      The class of punctuation characters that do not fit into any other
  1079.      special class.
  1080. `('     
  1081.      The class of opening delimiters. 
  1082. `)'     
  1083.      The class of closing delimiters. 
  1084. `''     
  1085.      The class of expression-adhering characters.  These characters are
  1086.      part of a symbol if found within or adjacent to one, and are part
  1087.      of a following expression if immediately preceding one, but are like
  1088.      whitespace if surrounded by whitespace.
  1089. `"'     
  1090.      The class of string-quote characters.  They match each other in pairs,
  1091.      and the characters within the pair all lose their syntactic
  1092.      significance except for the `\' and `/' classes of escape
  1093.      characters, which can be used to include a string-quote inside the
  1094.      string.
  1095. `$'     
  1096.      The class of self-matching delimiters.  This is intended for TeX's
  1097.      `$', which is used both to enter and leave math mode.  Thus,
  1098.      a pair of matching `$' characters surround each piece of math mode
  1099.      TeX input.  A pair of adjacent `$' characters act like a single
  1100.      one for purposes of matching
  1101.      
  1102. `/'     
  1103.      The class of escape characters that always just deny the following
  1104.      character its special syntactic significance.  The character after one
  1105.      of these escapes is always treated as alphabetic.
  1106. `\'     
  1107.      The class of C-style escape characters.  In practice, these are
  1108.      treated just like `/'-class characters, because the extra
  1109.      possibilities for C escapes (such as being followed by digits) have no
  1110.      effect on where the containing expression ends.
  1111. `<'     
  1112.      The class of comment-starting characters.  Only single-character
  1113.      comment starters (such as `;' in Lisp mode) are represented this
  1114.      way.
  1115. `>'     
  1116.      The class of comment-ending characters.  Newline has this syntax in
  1117.      Lisp mode.
  1118.  
  1119.   The characters flagged as part of two-character comment delimiters can
  1120. have other syntactic functions most of the time.  For example, `/' and
  1121. `*' in C code, when found separately, have nothing to do with
  1122. comments.  The comment-delimiter significance overrides when the pair of
  1123. characters occur together in the proper order.  Only the list and sexp
  1124. commands use the syntax table to find comments; the commands specifically
  1125. for comments have other variables that tell them where to find comments.
  1126. And the list and sexp commands notice comments only if
  1127. `parse-sexp-ignore-comments' is non-`nil'.  This variable is set
  1128. to `nil' in modes where comment-terminator sequences are liable to
  1129. appear where there is no comment; for example, in Lisp mode where the
  1130. comment terminator is a newline but not every newline ends a comment.
  1131.  
  1132. 
  1133.