home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / unix / info / emacs.i11 < prev    next >
Encoding:
GNU Info File  |  1993-06-14  |  48.9 KB  |  1,169 lines

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