home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / GNU / emacs.inst / emacs19.idb / usr / gnu / info / emacs-16.z / emacs-16
Encoding:
GNU Info File  |  1994-08-02  |  47.6 KB  |  1,130 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.54 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Minor Modes,  Next: Variables,  Up: Customization
  6.  
  7. Minor Modes
  8. ===========
  9.  
  10.    Minor modes are optional features which you can turn on or off.  For
  11. example, Auto Fill mode is a minor mode in which SPC breaks lines
  12. between words as you type.  All the minor modes are independent of each
  13. other and of the selected major mode.  Most minor modes say in the mode
  14. line when they are on; for example, `Fill' in the mode line means that
  15. Auto Fill mode is on.
  16.  
  17.    Append `-mode' to the name of a minor mode to get the name of a
  18. command function that turns the mode on or off.  Thus, the command to
  19. enable or disable Auto Fill mode is called `M-x auto-fill-mode'.  These
  20. commands are usually invoked with `M-x', but you can bind keys to them
  21. if you wish.  With no argument, the function turns the mode on if it was
  22. off and off if it was on.  This is known as "toggling".  A positive
  23. argument always turns the mode on, and an explicit zero argument or a
  24. negative argument always turns it off.
  25.  
  26.    Enabling or disabling some minor modes applies only to the current
  27. buffer; each buffer is independent of the other buffers.  Therefore, you
  28. can enable the mode in particular buffers and disable it in others.
  29.  
  30.    Auto Fill mode allows you to enter filled text without breaking lines
  31. explicitly.  Emacs inserts newlines as necessary to prevent lines from
  32. becoming too long.  *Note Filling::.
  33.  
  34.    Outline minor mode provides the same facilities as the major mode
  35. called Outline mode; but since it is a minor mode instead, you can
  36. combine it with any major mode.  *Note Outline Mode::.
  37.  
  38.    Overwrite mode causes ordinary printing characters to replace
  39. existing text instead of shoving it over.  For example, if the point is
  40. in front of the `B' in `FOOBAR', then in Overwrite mode typing a `G'
  41. changes it to `FOOGAR', instead of making it `FOOGBAR' as usual.
  42.  
  43.    Auto Save mode causes the contents of a buffer to be saved
  44. periodically to reduce the amount you will lose in case of a system
  45. crash.  *Note Auto Save::.
  46.  
  47.    ISO Accents mode makes the characters ``', `'', `"', `^', `/' and
  48. `~' combined with the following letter, to produce an accented letter
  49. in the ISO Latin-1 character set.  *Note European Display::.
  50.  
  51.    The following minor modes normally apply to all buffers at once.
  52. Since each is enabled or disabled by the value of a variable, you *can*
  53. set them differently for particular buffers, by explicitly making the
  54. corresponding variables local in those buffers.  *Note Locals::.
  55.  
  56.    Abbrev mode allows you to define abbreviations that automatically
  57. expand as you type them.  For example, `amd' might expand to `abbrev
  58. mode'.  *Note Abbrevs::, for full information.
  59.  
  60.    Line Number mode enables continuous display in the mode line of the
  61. line number of point.  *Note Mode Line::.
  62.  
  63.    Scroll Bar mode gives each window a scroll bar (*note Scroll
  64. Bars::.).  Menu Bar mode gives each frame a menu bar (*note Menu
  65. Bars::.).  Both of these modes are enabled by default when you use the
  66. X Window System.
  67.  
  68.    In Transient Mark mode, every change in the buffer "deactivates" the
  69. mark, so that commands that operate on the region will get an error.
  70. This means you must either set the mark, or explicitly "reactivate" it,
  71. before each command that uses the region.  The advantage of Transient
  72. Mark mode is that Emacs can display the region highlighted (currently
  73. only when using X).  *Note Setting Mark::.
  74.  
  75. 
  76. File: emacs,  Node: Variables,  Next: Keyboard Macros,  Prev: Minor Modes,  Up: Customization
  77.  
  78. Variables
  79. =========
  80.  
  81.    A "variable" is a Lisp symbol which has a value.  The symbol's name
  82. is also called the name of the variable.  A variable name can contain
  83. any characters that can appear in a file, but conventionally variable
  84. names consist of words separated by hyphens.  A variable can have a
  85. documentation string which describes what kind of value it should have
  86. and how the value will be used.
  87.  
  88.    Lisp allows any variable to have any kind of value, but most
  89. variables that Emacs uses require a value of a certain type.  Often the
  90. value should always be a string, or should always be a number.
  91. Sometimes we say that a certain feature is turned on if a variable is
  92. "non-`nil'," meaning that if the variable's value is `nil', the feature
  93. is off, but the feature is on for *any* other value.  The conventional
  94. value to use to turn on the feature--since you have to pick one
  95. particular value when you set the variable--is `t'.
  96.  
  97.    Emacs uses many Lisp variables for internal recordkeeping, as any
  98. Lisp program must, but the most interesting variables for you are the
  99. ones that exist for the sake of customization.  Emacs does not
  100. (usually) change the values of these variables; instead, you set the
  101. values, and thereby alter and control the behavior of certain Emacs
  102. commands.  These variables are called "options".  Most options are
  103. documented in this manual, and appear in the Variable Index (*note
  104. Variable Index::.).
  105.  
  106.    One example of a variable which is an option is `fill-column', which
  107. specifies the position of the right margin (as a number of characters
  108. from the left margin) to be used by the fill commands (*note
  109. Filling::.).
  110.  
  111. * Menu:
  112.  
  113. * Examining::           Examining or setting one variable's value.
  114. * Edit Options::        Examining or editing list of all variables' values.
  115. * Hooks::        Hook variables let you specify programs for parts
  116.               of Emacs to run on particular occasions.
  117. * Locals::              Per-buffer values of variables.
  118. * File Variables::      How files can specify variable values.
  119.  
  120. 
  121. File: emacs,  Node: Examining,  Next: Edit Options,  Up: Variables
  122.  
  123. Examining and Setting Variables
  124. -------------------------------
  125.  
  126. `C-h v VAR RET'
  127.      Print the value and documentation of variable VAR
  128.      (`describe-variable').
  129.  
  130. `M-x set-variable RET VAR RET VALUE RET'
  131.      Change the value of variable VAR to VALUE.
  132.  
  133.    To examine the value of a single variable, use `C-h v'
  134. (`describe-variable'), which reads a variable name using the
  135. minibuffer, with completion.  It prints both the value and the
  136. documentation of the variable.  For example,
  137.  
  138.      C-h v fill-column RET
  139.  
  140. prints something like this:
  141.  
  142.      fill-column's value is 75
  143.      
  144.      Documentation:
  145.      *Column beyond which automatic line-wrapping should happen.
  146.      Automatically becomes buffer-local when set in any fashion.
  147.  
  148. The star at the beginning of the documentation indicates that this
  149. variable is an option.  `C-h v' is not restricted to options; it allows
  150. any variable name.
  151.  
  152.    The most convenient way to set a specific option is with `M-x
  153. set-variable'.  This reads the variable name with the minibuffer (with
  154. completion), and then reads a Lisp expression for the new value using
  155. the minibuffer a second time.  For example,
  156.  
  157.      M-x set-variable RET fill-column RET 75 RET
  158.  
  159. sets `fill-column' to 75.
  160.  
  161.    You can set any variable with a Lisp expression using the function
  162. `setq'.  Here's how to use it to set `fill-column':
  163.  
  164.      (setq fill-column 75)
  165.  
  166.    Setting variables, like all means of customizing Emacs except where
  167. explicitly stated, affects only the current Emacs session.
  168.  
  169. 
  170. File: emacs,  Node: Edit Options,  Next: Hooks,  Prev: Examining,  Up: Variables
  171.  
  172. Editing Variable Values
  173. -----------------------
  174.  
  175.    These two functions make it easy to display all the user edit options
  176. and change some of them.
  177.  
  178. `M-x list-options'
  179.      Display a buffer listing names, values and documentation of all
  180.      options.
  181.  
  182. `M-x edit-options'
  183.      Change option values by editing a list of options.
  184.  
  185.    `M-x list-options' displays a list of all Emacs option variables, in
  186. an Emacs buffer named `*List Options*'.  Each option is shown with its
  187. documentation and its current value.  Here is what a portion of it might
  188. look like:
  189.  
  190.      ;; exec-path:
  191.      ("." "/usr/local/bin" "/usr/ucb" "/bin" "/usr/bin" "/u2/emacs/etc")
  192.      *List of directories to search programs to run in subprocesses.
  193.      Each element is a string (directory name)
  194.      or nil (try the default directory).
  195.      ;;
  196.      ;; fill-column:
  197.      75
  198.      *Column beyond which automatic line-wrapping should happen.
  199.      Automatically becomes buffer-local when set in any fashion.
  200.      ;;
  201.  
  202.    `M-x edit-options' goes one step further and immediately selects the
  203. `*List Options*' buffer; this buffer uses the major mode Options mode,
  204. which provides commands that allow you to point at an option and change
  205. its value:
  206.  
  207. `s'
  208.      Set the variable point is in or near to a new value read using the
  209.      minibuffer.
  210.  
  211. `x'
  212.      Toggle the variable point is in or near: if the value was `nil',
  213.      it becomes `t'; otherwise it becomes `nil'.
  214.  
  215. `1'
  216.      Set the variable point is in or near to `t'.
  217.  
  218. `0'
  219.      Set the variable point is in or near to `nil'.
  220.  
  221. `n'
  222. `p'
  223.      Move to the next or previous variable.
  224.  
  225.    Any changes take effect immediately, and last until you exit from
  226. Emacs.
  227.  
  228. 
  229. File: emacs,  Node: Hooks,  Next: Locals,  Prev: Edit Options,  Up: Variables
  230.  
  231. Hooks
  232. -----
  233.  
  234.    A "hook" is a variable where you can store a function or functions
  235. to be called on a particular occasion by an existing program.  Emacs
  236. provides a number of hooks for the sake of customization.
  237.  
  238.    Most of the hooks in Emacs are "normal hooks".  These variables
  239. contain lists of functions to be called with no arguments.  The reason
  240. most hooks are normal hooks is so that you can use them in a uniform
  241. way.  Every variable in Emacs whose name ends in `-hook' is a normal
  242. hook.
  243.  
  244.    Most major modes run hooks as the last step of initialization.  This
  245. makes it easy for a user to customize the behavior of the mode, by
  246. overriding the local variable assignments already made by the mode.  But
  247. hooks may also be used in other contexts.  For example, the hook
  248. `suspend-hook' runs just before Emacs suspends itself (*note
  249. Exiting::.).
  250.  
  251.    The recommended way to add a hook function to a normal hook is by
  252. calling `add-hook'.  You can use any valid Lisp function as the hook
  253. function.  For example, here's how to set up a hook to turn on Auto
  254. Fill mode when entering Text mode and other modes based on Text mode:
  255.  
  256.      (add-hook 'text-mode-hook 'turn-on-auto-fill)
  257.  
  258.    The next example shows how to use a hook to customize the indentation
  259. of C code.  (People often have strong personal preferences for one
  260. format compared to another.)  Here the hook function is an anonymous
  261. lambda expression.
  262.  
  263.      (add-hook 'c-mode-hook
  264.        (function (lambda ()
  265.                    (setq c-indent-level 4
  266.                          c-argdecl-indent 0
  267.                          c-label-offset -4
  268.                          c-continued-statement-indent 0
  269.                          c-brace-offset 0
  270.                          comment-column 40))))
  271.      
  272.      (setq c++-mode-hook c-mode-hook)
  273.  
  274.    It is best to design your hook functions so that the order in which
  275. they are executed does not matter.  Any dependence on the order is
  276. "asking for trouble."  However, the order is predictable: the most
  277. recently added hook functions are executed first.
  278.  
  279. 
  280. File: emacs,  Node: Locals,  Next: File Variables,  Prev: Hooks,  Up: Variables
  281.  
  282. Local Variables
  283. ---------------
  284.  
  285. `M-x make-local-variable RET VAR RET'
  286.      Make variable VAR have a local value in the current buffer.
  287.  
  288. `M-x kill-local-variable RET VAR RET'
  289.      Make variable VAR use its global value in the current buffer.
  290.  
  291. `M-x make-variable-buffer-local RET VAR RET'
  292.      Mark variable VAR so that setting it will make it local to the
  293.      buffer that is current at that time.
  294.  
  295.    Any variable can be made "local" to a specific Emacs buffer.  This
  296. means that its value in that buffer is independent of its value in other
  297. buffers.  A few variables are always local in every buffer.  Every other
  298. Emacs variable has a "global" value which is in effect in all buffers
  299. that have not made the variable local.
  300.  
  301.    `M-x make-local-variable' reads the name of a variable and makes it
  302. local to the current buffer.  Further changes in this buffer will not
  303. affect others, and further changes in the global value will not affect
  304. this buffer.
  305.  
  306.    `M-x make-variable-buffer-local' reads the name of a variable and
  307. changes the future behavior of the variable so that it will become local
  308. automatically when it is set.  More precisely, once a variable has been
  309. marked in this way, the usual ways of setting the variable automatically
  310. do `make-local-variable' first.  We call such variables "per-buffer"
  311. variables.
  312.  
  313.    Major modes (*note Major Modes::.) always make the variables they set
  314. local to the buffer.  This is why changing major modes in one buffer has
  315. no effect on other buffers.  Minor modes also work by setting
  316. variables--normally, each minor mode has one controlling variable which
  317. is non-`nil' when the mode is enabled (*note Minor Modes::.).  For most
  318. minor modes, the controlling variable is per buffer.
  319.  
  320.    Emacs contains a number of variables that are always per-buffer.
  321. These include `abbrev-mode', `auto-fill-function', `case-fold-search',
  322. `comment-column', `ctl-arrow', `fill-column', `fill-prefix',
  323. `indent-tabs-mode', `left-margin', `mode-line-format', `overwrite-mode',
  324. `selective-display-ellipses', `selective-display', `tab-width', and
  325. `truncate-lines'.  Some other variables are always local in every
  326. buffer, but they are used for internal purposes.
  327.  
  328.    `M-x kill-local-variable' reads the name of a variable and makes it
  329. cease to be local to the current buffer.  The global value of the
  330. variable henceforth is in effect in this buffer.  Setting the major
  331. mode kills all the local variables of the buffer except for a few
  332. specially marked variables that are "permanent locals".
  333.  
  334.    To set the global value of a variable, regardless of whether the
  335. variable has a local value in the current buffer, you can use the Lisp
  336. function `setq-default'.  It works like `setq'.  If there is a local
  337. value in the current buffer, the local value is not affected by
  338. `setq-default'; thus, the new global value may not be visible until you
  339. switch to another buffer.  For example,
  340.  
  341.      (setq-default fill-column 75)
  342.  
  343. `setq-default' is the only way to set the global value of a variable
  344. that has been marked with `make-variable-buffer-local'.
  345.  
  346.    Lisp programs can look at a variable's default value with
  347. `default-value'.  This function takes a symbol as argument and returns
  348. its default value.  The argument is evaluated; usually you must quote
  349. it explicitly.  For example,
  350.  
  351.      (default-value 'fill-column)
  352.  
  353. 
  354. File: emacs,  Node: File Variables,  Prev: Locals,  Up: Variables
  355.  
  356. Local Variables in Files
  357. ------------------------
  358.  
  359.    A file can specify local variable values for use when you edit the
  360. file with Emacs.  Visiting the file checks for local variables
  361. specifications; it automatically makes these variables local to the
  362. buffer, and sets them to the values specified in the file.
  363.  
  364.    There are two ways to specify local variable values: in the first
  365. line, or with a local variables list.  Here's how to do this with the
  366. first line:
  367.  
  368.      -*- mode: MODENAME; VAR: VALUE; ... -*-
  369.  
  370. You can specify any number of variables/value pairs in this way, each
  371. pair with a colon and semicolon as shown above.  The major mode should
  372. come first, if it is mentioned at all.  Here is an example that
  373. specifies Lisp mode and sets two variables with numeric values:
  374.  
  375.      ;; -*-Mode: Lisp; fill-column: 75; comment-column: 50; -*-
  376.  
  377.    A "local variables list" goes near the end of the file, in the last
  378. page.  (It is often best to put it on a page by itself.)  The local
  379. variables list starts with a line containing the string `Local
  380. Variables:', and ends with a line containing the string `End:'.  In
  381. between come the variable names and values, one set per line, as
  382. `VARIABLE: VALUE'.  The VALUEs are not evaluated; they are used
  383. literally.
  384.  
  385.    Here is an example of a local variables list:
  386.  
  387.      ;;; Local Variables: ***
  388.      ;;; mode:lisp ***
  389.      ;;; comment-column:0 ***
  390.      ;;; comment-start: ";;; "  ***
  391.      ;;; comment-end:"***" ***
  392.      ;;; End: ***
  393.  
  394.    As you see, each line starts with the prefix `;;; ' and each line
  395. ends with the suffix ` ***'.  Emacs recognizes these as the prefix and
  396. suffix based on the first line of the list, by finding them surrounding
  397. the magic string `Local Variables:'; so it automatically discards them
  398. from the other lines of the list.
  399.  
  400.    The usual reason for using a prefix and/or suffix is to embed the
  401. local variables list in a comment, so it won't confuse other programs
  402. that the file is intended as input for.  The example above is for a
  403. language where comment lines start with `;;; ' and end with `***'; the
  404. local values for `comment-start' and `comment-end' customize the rest
  405. of Emacs for this unusual syntax.  Don't use a prefix (or a suffix) if
  406. you don't need one.
  407.  
  408.    Two "variable names" have special meanings in a local variables
  409. list: a value for the variable `mode' really sets the major mode, and a
  410. value for the variable `eval' is simply evaluated as an expression and
  411. the value is ignored.  `mode' and `eval' are not real variables;
  412. setting such variables in any other context has no such effect.  If
  413. `mode' is used in a local variables list, it should be the first entry
  414. in the list.
  415.  
  416.    The start of the local variables list must be no more than 3000
  417. characters from the end of the file, and must be in the last page if the
  418. file is divided into pages.  Otherwise, Emacs will not notice it is
  419. there.  The purpose of this is so that a stray `Local Variables:' not
  420. in the last page does not confuse Emacs, and so that visiting a long
  421. file that is all one page and has no local variables list need not take
  422. the time to search the whole file.
  423.  
  424.    You may be tempted to try to turn on Auto Fill mode with a local
  425. variable list.  That is a mistake.  The choice of Auto Fill mode or not
  426. is a matter of individual taste, not a matter of the contents of
  427. particular files.  If you want to use Auto Fill, set up major mode
  428. hooks with your `.emacs' file to turn it on (when appropriate) for you
  429. alone (*note Init File::.).  Don't try to use a local variable list
  430. that would impose your taste on everyone.
  431.  
  432.    The variable `enable-local-variables' controls whether to process
  433. local variables lists, and thus gives you a chance to override them.
  434. Its default value is `t', which means to process local variables lists.
  435. If you set the value to `nil', Emacs simply ignores local variables
  436. lists.  Any other value says to query you about each local variables
  437. list, showing you the local variables list to consider.
  438.  
  439.    The `eval' "variable" creates special risks, so there is a separate
  440. variable `enable-local-eval' to control whether Emacs processes `eval'
  441. variables, as well variables with names that end in `-hook', `-hooks',
  442. `-function' or `-functions'.  The three possibilities for the value are
  443. `t', `nil', and anything else, just as for `enable-local-variables'.
  444. The default is `maybe', which is neither `t' nor `nil', so normally
  445. Emacs queries about `eval' variable settings.
  446.  
  447.    Use the command `normal-mode' to reset the local variables and major
  448. mode of a buffer according to the file name and contents, including the
  449. local variables list if any.  *Note Choosing Modes::.
  450.  
  451. 
  452. File: emacs,  Node: Keyboard Macros,  Next: Key Bindings,  Prev: Variables,  Up: Customization
  453.  
  454. Keyboard Macros
  455. ===============
  456.  
  457.    A "keyboard macro" is a command defined by the user to abbreviate a
  458. sequence of keys.  For example, if you discover that you are about to
  459. type `C-n C-d' forty times, you can speed your work by defining a
  460. keyboard macro to do `C-n C-d' and calling it with a repeat count of
  461. forty.
  462.  
  463. `C-x ('
  464.      Start defining a keyboard macro (`start-kbd-macro').
  465.  
  466. `C-x )'
  467.      End the definition of a keyboard macro (`end-kbd-macro').
  468.  
  469. `C-x e'
  470.      Execute the most recent keyboard macro (`call-last-kbd-macro').
  471.  
  472. `C-u C-x ('
  473.      Re-execute last keyboard macro, then add more keys to its
  474.      definition.
  475.  
  476. `C-x q'
  477.      When this point is reached during macro execution, ask for
  478.      confirmation (`kbd-macro-query').
  479.  
  480. `M-x name-last-kbd-macro'
  481.      Give a command name (for the duration of the session) to the most
  482.      recently defined keyboard macro.
  483.  
  484. `M-x insert-kbd-macro'
  485.      Insert in the buffer a keyboard macro's definition, as Lisp code.
  486.  
  487.    Keyboard macros differ from ordinary Emacs commands in that they are
  488. written in the Emacs command language rather than in Lisp.  This makes
  489. it easier for the novice to write them, and makes them more convenient
  490. as temporary hacks.  However, the Emacs command language is not powerful
  491. enough as a programming language to be useful for writing anything
  492. intelligent or general.  For such things, Lisp must be used.
  493.  
  494.    You define a keyboard macro while executing the commands which are
  495. the definition.  Put differently, as you define a keyboard macro, the
  496. definition is being executed for the first time.  This way, you can see
  497. what the effects of your commands are, so that you don't have to figure
  498. them out in your head.  When you are finished, the keyboard macro is
  499. defined and also has been, in effect, executed once.  You can then do
  500. the whole thing over again by invoking the macro.
  501.  
  502. * Menu:
  503.  
  504. * Basic Kbd Macro::     Defining and running keyboard macros.
  505. * Save Kbd Macro::      Giving keyboard macros names; saving them in files.
  506. * Kbd Macro Query::     Keyboard macros that do different things each use.
  507.  
  508. 
  509. File: emacs,  Node: Basic Kbd Macro,  Next: Save Kbd Macro,  Up: Keyboard Macros
  510.  
  511. Basic Use
  512. ---------
  513.  
  514.    To start defining a keyboard macro, type the `C-x (' command
  515. (`start-kbd-macro').  From then on, your keys continue to be executed,
  516. but also become part of the definition of the macro.  `Def' appears in
  517. the mode line to remind you of what is going on.  When you are
  518. finished, the `C-x )' command (`end-kbd-macro') terminates the
  519. definition (without becoming part of it!).  For example
  520.  
  521.      C-x ( M-f foo C-x )
  522.  
  523. defines a macro to move forward a word and then insert `foo'.
  524.  
  525.    The macro thus defined can be invoked again with the `C-x e' command
  526. (`call-last-kbd-macro'), which may be given a repeat count as a numeric
  527. argument to execute the macro many times.  `C-x )' can also be given a
  528. repeat count as an argument, in which case it repeats the macro that
  529. many times right after defining it, but defining the macro counts as
  530. the first repetition (since it is executed as you define it).  So,
  531. giving `C-x )' an argument of 4 executes the macro immediately 3
  532. additional times.  An argument of zero to `C-x e' or `C-x )' means
  533. repeat the macro indefinitely (until it gets an error or you type
  534. `C-g').
  535.  
  536.    If you wish to repeat an operation at regularly spaced places in the
  537. text, define a macro and include as part of the macro the commands to
  538. move to the next place you want to use it.  For example, if you want to
  539. change each line, you should position point at the start of a line, and
  540. define a macro to change that line and leave point at the start of the
  541. next line.  Then repeating the macro will operate on successive lines.
  542.  
  543.    After you have terminated the definition of a keyboard macro, you
  544. can add to the end of its definition by typing `C-u C-x ('.  This is
  545. equivalent to plain `C-x (' followed by retyping the whole definition
  546. so far.  As a consequence it re-executes the macro as previously
  547. defined.
  548.  
  549.    You can use function keys in a keyboard macro, just like keyboard
  550. keys.  You can even use mouse events, but be careful about that: when
  551. the macro replays the mouse event, it uses the original mouse position
  552. of that event, the position that the mouse had while you were defining
  553. the macro.  The effect of this may be hard to predict.  (Using the
  554. current mouse position would be even less predictable.)
  555.  
  556.    One thing that doesn't always work well in a keyboard macro is the
  557. command `C-M-c' (`exit-recursive-edit').  When this command exits a
  558. recursive edit that started within the macro, it works as you'd expect.
  559. But if it exits a recursive edit that started before you invoked the
  560. keyboard macro, it also necessarily exits the keyboard macro as part of
  561. the process.
  562.  
  563. 
  564. File: emacs,  Node: Save Kbd Macro,  Next: Kbd Macro Query,  Prev: Basic Kbd Macro,  Up: Keyboard Macros
  565.  
  566. Naming and Saving Keyboard Macros
  567. ---------------------------------
  568.  
  569.    If you wish to save a keyboard macro for longer than until you
  570. define the next one, you must give it a name using `M-x
  571. name-last-kbd-macro'.  This reads a name as an argument using the
  572. minibuffer and defines that name to execute the macro.  The macro name
  573. is a Lisp symbol, and defining it in this way makes it a valid command
  574. name for calling with `M-x' or for binding a key to with
  575. `global-set-key' (*note Keymaps::.).  If you specify a name that has a
  576. prior definition other than another keyboard macro, an error message is
  577. printed and nothing is changed.
  578.  
  579.    Once a macro has a command name, you can save its definition in a
  580. file.  Then it can be used in another editing session.  First, visit
  581. the file you want to save the definition in.  Then use this command:
  582.  
  583.      M-x insert-kbd-macro RET MACRONAME RET
  584.  
  585. This inserts some Lisp code that, when executed later, will define the
  586. same macro with the same definition it has now.  (You need not
  587. understand Lisp code to do this, because `insert-kbd-macro' writes the
  588. Lisp code for you.)  Then save the file.  You can load the file later
  589. with `load-file' (*note Lisp Libraries::.).  If the file you save in is
  590. your init file `~/.emacs' (*note Init File::.) then the macro will be
  591. defined each time you run Emacs.
  592.  
  593.    If you give `insert-kbd-macro' a prefix argument, it makes
  594. additional Lisp code to record the keys (if any) that you have bound to
  595. the keyboard macro, so that the macro will be reassigned the same keys
  596. when you load the file.
  597.  
  598. 
  599. File: emacs,  Node: Kbd Macro Query,  Prev: Save Kbd Macro,  Up: Keyboard Macros
  600.  
  601. Executing Macros with Variations
  602. --------------------------------
  603.  
  604.    Using `C-x q' (`kbd-macro-query'), you can get an effect similar to
  605. that of `query-replace', where the macro asks you each time around
  606. whether to make a change.  When you are defining the macro, type `C-x
  607. q' at the point where you want the query to occur.  During macro
  608. definition, the `C-x q' does nothing, but when you run the macro later,
  609. `C-x q' asks you interactively whether to continue.
  610.  
  611.    The valid responses when `C-x q' asks are SPC (or `y'), DEL (or
  612. `n'), ESC (or `q'), `C-l' and `C-r'.  The answers are the same as in
  613. query replace, though not all of the query-replace options are
  614. meaningful.
  615.  
  616.    Specifically, SPC means to continue.  DEL means to skip the
  617. remainder of this repetition of the macro and start right away with the
  618. next repetition.  ESC means to skip the remainder of this repetition
  619. and cancel further repetition.  `C-l' redraws the screen and asks you
  620. again for a character to say what to do.
  621.  
  622.    `C-r' enters a recursive editing level, in which you can perform
  623. editing which is not part of the macro.  When you exit the recursive
  624. edit using `C-M-c', you are asked again how to continue with the
  625. keyboard macro.  If you type a SPC at this time, the rest of the macro
  626. definition is executed.  It is up to you to leave point and the text in
  627. a state such that the rest of the macro will do what you want.
  628.  
  629.    `C-u C-x q', which is `C-x q' with a numeric argument, performs a
  630. different function.  It enters a recursive edit reading input from the
  631. keyboard, both when you type it during the definition of the macro, and
  632. when it is executed from the macro.  During definition, the editing you
  633. do inside the recursive edit does not become part of the macro.  During
  634. macro execution, the recursive edit gives you a chance to do some
  635. particularized editing.  *Note Recursive Edit::.
  636.  
  637. 
  638. File: emacs,  Node: Key Bindings,  Next: Keyboard Translations,  Prev: Keyboard Macros,  Up: Customization
  639.  
  640. Customizing Key Bindings
  641. ========================
  642.  
  643.    This section describes "key bindings" which map keys to commands,
  644. and the "keymaps" which record key bindings.  It also explains how to
  645. customize key bindings.
  646.  
  647.    Recall that a command is a Lisp function whose definition provides
  648. for interactive use.  Like every Lisp function, a command has a function
  649. name which usually consists of lower case letters and hyphens.
  650.  
  651. * Menu:
  652.  
  653. * Keymaps::          Generalities.  The global keymap.
  654. * Prefix Keymaps::   Keymaps for prefix keys.
  655. * Local Keymaps::    Major and minor modes have their own keymaps.
  656. * Minibuffer Maps::  The minibuffer uses its own local keymaps.
  657. * Rebinding::        How to redefine one key's meaning conveniently.
  658. * Init Rebinding::   Rebinding keys with your init file, `.emacs'.
  659. * Function Keys::    Rebinding terminal function keys.
  660. * Mouse Buttons::    Rebinding mouse buttons in Emacs.
  661. * Disabling::        Disabling a command means confirmation is required
  662.                        before it can be executed.  This is done to protect
  663.                        beginners from surprises.
  664.  
  665. 
  666. File: emacs,  Node: Keymaps,  Next: Prefix Keymaps,  Up: Key Bindings
  667.  
  668. Keymaps
  669. -------
  670.  
  671.    The bindings between key sequences and command functions are recorded
  672. in data structures called "keymaps".  Emacs has many of these, each
  673. used on particular occasions.
  674.  
  675.    Recall that a "key sequence" ("key", for short) is a sequence of
  676. "input events" that have a meaning as a unit.  Input events include
  677. characters, function keys and mouse buttons--all the inputs that you
  678. can send to the computer with your terminal.  A key sequence gets its
  679. meaning from its "binding", which says what command it runs.  The
  680. function of keymaps is to record these bindings.
  681.  
  682.    The "global" keymap is the most important keymap because it is
  683. always in effect.  The global keymap defines keys for Fundamental mode;
  684. most of these definitions are common to all (or most) major modes.  Each
  685. major or minor mode can have its own keymap which overrides the
  686. definitions of some keys.
  687.  
  688.    For example, a self-inserting character such as `g' is
  689. self-inserting because the global keymap binds it to the command
  690. `self-insert-command'.  The standard Emacs editing characters such as
  691. `C-a' also get their standard meanings from the global keymap.
  692. Commands to rebind keys, such as `M-x global-set-key', actually work by
  693. storing the new binding in the proper place in the global map.  *Note
  694. Rebinding::.
  695.  
  696.    Meta characters work differently; Emacs translates each Meta
  697. character into a pair of characters starting with ESC.  When you type
  698. the character `M-a' in a key sequence, Emacs replaces it with `ESC a'.
  699. A meta key comes in as a single input event, but becomes two events for
  700. purposes of key bindings.  The reason for this is historical, and we
  701. might change it someday.
  702.  
  703.    Most modern keyboards have function keys as well as character keys.
  704. Function keys send input events just as character keys do, and keymaps
  705. can have bindings for them.
  706.  
  707.    On many terminals, typing a function key actually sends the computer
  708. a sequence of characters; the precise details of the sequence depends on
  709. which function key and on the model of terminal you are using.  (Often
  710. he sequence starts with `ESC ['.)  If Emacs understands your terminal
  711. type properly, it recognizes the character sequences forming function
  712. keys wherever they occur in a key sequence (not just at the beginning).
  713. Thus, for most purposes, you can pretend the function keys reach Emacs
  714. directly and ignore their encoding as character sequences.
  715.  
  716.    Mouse buttons also produce input events.  These events come with
  717. other data--the window and position where you pressed or released the
  718. button, and a timestamp.  But only the choice of button matters for key
  719. bindings; the other data matters only if a command looks at it.
  720. (Commands designed for mouse invocation usually do look at the other
  721. data.)
  722.  
  723.    A keymap records definitions for single events.  Interpreting a key
  724. sequence of multiple events involves a chain of keymaps.  The first
  725. keymap gives a definition for the first event; this definition is
  726. another keymap, which is used to look up the second event in the
  727. sequence, and so on.
  728.  
  729.    Key sequences can mix function keys and characters.  For example,
  730. `C-x SELECT' makes sense.  If you make SELECT a prefix key, then
  731. `SELECT C-n' makes sense.  You can even mix mouse events with keyboard
  732. events, but we recommend against it, because such sequences are
  733. inconvenient to type in.
  734.  
  735. 
  736. File: emacs,  Node: Prefix Keymaps,  Next: Local Keymaps,  Prev: Keymaps,  Up: Key Bindings
  737.  
  738. Prefix Keymaps
  739. --------------
  740.  
  741.    A prefix key such as `C-x' or ESC has its own keymap, which holds
  742. the definition for the event that immediately follows that prefix.
  743.  
  744.    The definition of a prefix key is the keymap to use for looking up
  745. the following event.  The definition can also be a Lisp symbol whose
  746. function definition is the following keymap; the effect is the same, but
  747. it provides a command name for the prefix key that can be used as a
  748. description of what the prefix key is for.  Thus, the binding of `C-x'
  749. is the symbol `Ctl-X-Prefix', whose function definition is the keymap
  750. for `C-x' commands.  The definitions of `C-c', `C-x', `C-h' and ESC as
  751. prefix keys appear in the global map, so these prefix keys are always
  752. available.
  753.  
  754.    Some prefix keymaps are stored in variables with names:
  755.  
  756.    * `ctl-x-map' is the variable name for the map used for characters
  757.      that follow `C-x'.
  758.  
  759.    * `help-map' is for characters that follow `C-h'.
  760.  
  761.    * `esc-map' is for characters that follow ESC.  Thus, all Meta
  762.      characters are actually defined by this map.
  763.  
  764.    * `ctl-x-4-map' is for characters that follow `C-x 4'.
  765.  
  766.    * `mode-specific-map' is for characters that follow `C-c'.
  767.  
  768. 
  769. File: emacs,  Node: Local Keymaps,  Next: Minibuffer Maps,  Prev: Prefix Keymaps,  Up: Key Bindings
  770.  
  771. Local Keymaps
  772. -------------
  773.  
  774.    So far we have explained the ins and outs of the global map.  Major
  775. modes customize Emacs by providing their own key bindings in "local
  776. keymaps".  For example, C mode overrides TAB to make it indent the
  777. current line for C code.  Portions of text in the buffer can specify
  778. their own keymaps to substitute for the keymap of the buffer's major
  779. mode.
  780.  
  781.    Minor modes can also have local keymaps.  Whenever a minor mode is
  782. in effect, the definitions in its keymap override both the major mode's
  783. local keymap and the global keymap.
  784.  
  785.    The local keymaps for Lisp mode, C mode, and several other major
  786. modes always exist even when not in use.  These are kept in variables
  787. named `lisp-mode-map', `c-mode-map', and so on.  For major modes less
  788. often used, the local keymap is normally constructed only when the mode
  789. is used for the first time in a session.  This is to save space.
  790.  
  791.    All minor mode keymaps are created in advance.  There is no way to
  792. defer their creation until the minor mode is enabled.
  793.  
  794.    A local keymap can locally redefine a key as a prefix key by defining
  795. it as a prefix keymap.  If the key is also defined globally as a prefix,
  796. then its local and global definitions (both keymaps) effectively
  797. combine: both of them are used to look up the event that follows the
  798. prefix key.  Thus, if the mode's local keymap defines `C-c' as another
  799. keymap, and that keymap defines `C-z' as a command, this provides a
  800. local meaning for `C-c C-z'.  This does not affect other sequences that
  801. start with `C-c'; If those sequences don't have their own local
  802. bindings, their global bindings remain in effect.
  803.  
  804.    Another way to think of this is that Emacs handles a multi-event key
  805. sequence by looking in several keymaps, one by one, for a binding of the
  806. whole key sequence.  First it checks the minor mode keymaps for minor
  807. modes that are enabled, then it checks the major mode's keymap, and then
  808. it checks the global keymap.  This is not precisely how key lookup
  809. works, but it's good enough for understanding ordinary circumstances.
  810.  
  811. 
  812. File: emacs,  Node: Minibuffer Maps,  Next: Rebinding,  Prev: Local Keymaps,  Up: Key Bindings
  813.  
  814. Minibuffer Keymaps
  815. ------------------
  816.  
  817.    The minibuffer has its own set of local keymaps; they contain various
  818. completion and exit commands.
  819.  
  820.    * `minibuffer-local-map' is used for ordinary input (no completion).
  821.  
  822.    * `minibuffer-local-ns-map' is similar, except that SPC exits just
  823.      like RET.  This is used mainly for Mocklisp compatibility.
  824.  
  825.    * `minibuffer-local-completion-map' is for permissive completion.
  826.  
  827.    * `minibuffer-local-must-match-map' is for strict completion and for
  828.      cautious completion.
  829.  
  830. 
  831. File: emacs,  Node: Rebinding,  Next: Init Rebinding,  Prev: Minibuffer Maps,  Up: Key Bindings
  832.  
  833. Changing Key Bindings Interactively
  834. -----------------------------------
  835.  
  836.    The way to redefine an Emacs key is to change its entry in a keymap.
  837. You can change the global keymap, in which case the change is effective
  838. in all major modes (except those that have their own overriding local
  839. definitions for the same key).  Or you can change the current buffer's
  840. local map, which affects all buffers using the same major mode.
  841.  
  842. `M-x global-set-key RET KEY CMD RET'
  843.      Define KEY globally to run CMD.
  844.  
  845. `M-x local-set-key RET KEY CMD RET'
  846.      Define KEY locally (in the major mode now in effect) to run CMD.
  847.  
  848. `M-x global-unset-key RET KEY'
  849.      Make KEY undefined in the global map.
  850.  
  851. `M-x local-unset-key RET KEY'
  852.      Make KEY undefined locally (in the major mode now in effect).
  853.  
  854.    For example, suppose you like to execute commands in a subshell
  855. within an Emacs buffer, instead of suspending Emacs and executing
  856. commands in your login shell.  Normally, `C-z' is bound to the function
  857. `suspend-emacs', but you can change `C-z' to invoke an interactive
  858. subshell within Emacs, by binding it to `shell' as follows:
  859.  
  860.      M-x global-set-key RET C-z shell RET
  861.  
  862. `global-set-key' reads the command name after the key.   After you
  863. press the key, a message like this appears so that you can confirm that
  864. you are binding the key you want:
  865.  
  866.      Set key C-z to command:
  867.  
  868.    You can redefine function keys and mouse events in the same way; just
  869. type the function key or click the mouse when it's time to specify the
  870. key to rebind.
  871.  
  872.    You can rebind a key that contains more than one event in the same
  873. way.  Emacs keeps reading the key to rebind until it is a complete key
  874. (that is, not a prefix key).  Thus, if you type `C-f' for KEY, that's
  875. the end; the minibuffer is entered immediately to read CMD.  But if you
  876. type `C-x', another character is read; if that is `4', another
  877. character is read, and so on.  For example,
  878.  
  879.      M-x global-set-key RET C-x 4 $ spell-other-window RET
  880.  
  881. would redefine `C-x 4 $' to run the (fictitious) command
  882. `spell-other-window'.
  883.  
  884.    You can remove the global definition of a key with
  885. `global-unset-key'.  This makes the key "undefined"; if you type it,
  886. Emacs will just beep.  Similarly, `local-unset-key' makes a key
  887. undefined in the current major mode keymap, which makes the global
  888. definition (or lack of one) come back into effect in that major mode.
  889.  
  890.    If you have redefined (or undefined) a key and you subsequently wish
  891. to retract the change, undefining the key will not do the job--you need
  892. to redefine the key with its standard definition.  To find the name of
  893. the standard definition of a key, go to a Fundamental mode buffer and
  894. use `C-h c'.  The documentation of keys in this manual also lists their
  895. command names.
  896.  
  897.    If you want to prevent yourself from invoking a command by mistake,
  898. it is better to disable the command than to undefine the key.  A
  899. disabled command is less work to invoke when you really want to.  *Note
  900. Disabling::.
  901.  
  902. 
  903. File: emacs,  Node: Init Rebinding,  Next: Function Keys,  Prev: Rebinding,  Up: Key Bindings
  904.  
  905. Rebinding Keys in Your Init File
  906. --------------------------------
  907.  
  908.    If you have a set of default definitions that you like to use all
  909. the time, you can put commands in your `.emacs' file by using their
  910. Lisp syntax.  Thus, the first `global-set-key' command in this section
  911. could be put in an `.emacs' file in either of the two following formats:
  912.  
  913.      (global-set-key "\C-z" 'shell)
  914.  
  915.    or as:
  916.  
  917.      (global-set-key [?\C-z] 'shell)
  918.  
  919. When the key sequence consists of characters, like this one, you can
  920. write it as a string or as a vector.  The first format specifies the key
  921. sequence as a string, `"\C-z"'.  The second format uses a vector to
  922. specify the key sequence.  The square brackets (`[...]') delimit the
  923. contents of the vector.  The vector in this example contains just one
  924. element, which is the integer code corresponding to `C-z'.  The
  925. question mark is the Lisp syntax for a character constant; the
  926. character must follow with no intervening spaces.
  927.  
  928.    The single-quote before `shell' marks it as a constant symbol rather
  929. than a variable.  If you omit the quote, Emacs tries to evaluate
  930. `shell' immediately as a variable.  This probably causes an error; it
  931. certainly isn't what you want.
  932.  
  933.    Here is another example that binds a key sequence two characters
  934. long:
  935.  
  936.      (global-set-key "\C-xl" 'make-symbolic-link)
  937.  
  938.    or:
  939.  
  940.      (global-set-key [?\C-x ?l] 'make-symbolic-link)
  941.  
  942. 
  943. File: emacs,  Node: Function Keys,  Next: Mouse Buttons,  Prev: Init Rebinding,  Up: Key Bindings
  944.  
  945. Rebinding Function Keys
  946. -----------------------
  947.  
  948.    Key sequences can contain function keys as well as ordinary
  949. characters.  Just as Lisp characters (actually integers) represent
  950. keyboard characters, Lisp symbols represent function keys.  If the
  951. function key has a word as its label, then that word is also the name of
  952. the corresponding Lisp symbol.  Here are the conventional Lisp names for
  953. other function keys:
  954.  
  955. `left', `up', `right', `down'
  956.      Cursor arrow keys.
  957.  
  958. `begin', `end', `home', `next', `prior'
  959.      Other cursor repositioning keys.
  960.  
  961. `select', `print', `execute', `backtab'
  962. `insert', `undo', `redo', `clearline'
  963. `insertline', `deleteline', `insertchar', `deletechar',
  964.      Miscellaneous function keys.
  965.  
  966. `f1' ... `f35'
  967.      Numbered function keys (across the top of the keyboard).
  968.  
  969. `kp-add', `kp-subtract', `kp-multiply', `kp-divide'
  970. `kp-backtab', `kp-space', `kp-tab', `kp-enter'
  971. `kp-separator', `kp-decimal', `kp-equal'
  972.      Keypad keys (to the right of the regular keyboard), with names or
  973.      punctuation.
  974.  
  975. `kp-0', `kp-1', ... `kp-9'
  976.      Keypad keys with digits.
  977.  
  978. `kp-f1', `kp-f2', `kp-f3', `kp-f4'
  979.      Keypad PF keys.
  980.  
  981.    These names are conventional, but some systems (especially when using
  982. X windows) may use different names.  To make certain what symbol is used
  983. for a given function key on your terminal, type `C-h c' followed by
  984. that key.
  985.  
  986.    A key sequence which contains non-characters must be a vector rather
  987. than a string.  To write a vector, write square brackets containing the
  988. vector elements.  Write spaces to separate the elements.  If an element
  989. is a symbol, simply write the symbol's name--no delimiters or
  990. punctuation are needed.  If an element is a character, write a Lisp
  991. character constant, which is `?' followed by the character as it would
  992. appear in a string.
  993.  
  994.    Thus, to bind function key `f1' to the command `rmail', write the
  995. following:
  996.  
  997.      (global-set-key [f1] 'rmail)
  998.  
  999.    To bind the right-arrow key to the command `forward-char', you can
  1000. use this expression:
  1001.  
  1002.      (global-set-key [right] 'forward-char)
  1003.  
  1004. using the Lisp syntax for a vector containing the symbol `right'.
  1005. (This binding is present in Emacs by default.)
  1006.  
  1007.    You can mix function keys and characters in a key sequence.  This
  1008. example binds `C-x RIGHT' to the command `forward-page'.
  1009.  
  1010.      (global-set-key [?\C-x right] 'forward-page)
  1011.  
  1012. where `?\C-x' is the Lisp character constant for the character `C-x'.
  1013. The vector element `right' is a symbol and therefore does not take a
  1014. question mark.
  1015.  
  1016.    You can use the modifier keys CTRL, META, HYPER, SUPER, ALT and
  1017. SHIFT with function keys.  To represent these modifiers, prepend the
  1018. strings `C-', `M-', `H-', `s-', `A-' and `S-' to the symbol name.
  1019. Thus, here is how to make `Hyper-Meta-RIGHT' move forward a word:
  1020.  
  1021.      (global-set-key [H-M-right] 'forward-word)
  1022.  
  1023. 
  1024. File: emacs,  Node: Mouse Buttons,  Next: Disabling,  Prev: Function Keys,  Up: Key Bindings
  1025.  
  1026. Rebinding Mouse Buttons
  1027. -----------------------
  1028.  
  1029.    Emacs uses Lisp symbols to designate mouse buttons, too.  The
  1030. ordinary mouse events in Emacs are "click" events; these happen when you
  1031. press a button and release it without moving the mouse.  You can also
  1032. get "drag" events, when you move the mouse while holding the button
  1033. down.  Drag events happen when you finally let go of the button.
  1034.  
  1035.    The symbols for basic click events are `mouse-1' for the leftmost
  1036. button, `mouse-2' for the next, and so on.  Here is how you can
  1037. redefine the second mouse button to split the current window:
  1038.  
  1039.      (global-set-key [mouse-2] 'split-window-vertically)
  1040.  
  1041.    The symbols for drag events are similar, but have the prefix `drag-'
  1042. before the word `mouse'.  For example, dragging the left button
  1043. generates a `drag-mouse-1' event.
  1044.  
  1045.    You can also define events that occur when a mouse button is pressed
  1046. down.  These events start with `down-' instead of `drag-'.  Such events
  1047. are generated only if they have key bindings.  When you get a
  1048. button-down event, a corresponding click or drag event will always
  1049. follow.
  1050.  
  1051.    If you wish, you can distinguish single, double, and triple clicks.
  1052. A double click means clicking a mouse button twice in approximately the
  1053. same place.  The first click generates an ordinary click event.  The
  1054. second click, if it comes soon enough, generates a double-click event
  1055. instead.  The event type for a double click event starts with
  1056. `double-': for example, `double-mouse-3'.
  1057.  
  1058.    This means that you can give a special meaning to the second click at
  1059. the same place, but it must act on the assumption that the ordinary
  1060. single click definition has run when the first click was received.
  1061.  
  1062.    This constrains what you can do with double clicks, but user
  1063. interface designers say that this constraint ought to be followed in
  1064. any case.  A double click should do something similar to the single
  1065. click, only "more so".  The command for the double-click event should
  1066. perform the extra work for the double click.
  1067.  
  1068.    If a double-click event has no binding, it changes to the
  1069. corresponding single-click event.  Thus, if you don't define a
  1070. particular double click specially, it executes the single-click command
  1071. twice.
  1072.  
  1073.    Emacs also supports triple-click events whose names start with
  1074. `triple-'.  Emacs does not distinguish quadruple clicks as event types;
  1075. clicks beyond the third generate additional triple-click events.
  1076. However, the full number of clicks is recorded in the event list, so you
  1077. can distinguish if you really want to.  We don't recommend distinct
  1078. meanings for more than three clicks, but sometimes it is useful for
  1079. subsequent clicks to cycle through the same set of three meanings, so
  1080. that four clicks are equivalent to one click, five are equivalent to
  1081. two, and six are equivalent to three.
  1082.  
  1083.    Emacs also records multiple presses in drag and button-down events.
  1084. For example, when you press a button twice, then move the mouse while
  1085. holding the button, Emacs gets a `double-drag-' event.  And at the
  1086. moment when you press it down for the second time, Emacs gets a
  1087. `double-down-' event (which is ignored, like all button-down events, if
  1088. it has no binding).
  1089.  
  1090.    The variable `double-click-time' specifies how long may elapse
  1091. between clicks that are recognized as a pair.  Its value is measured in
  1092. milliseconds.  If the value is `nil', double clicks are not detected at
  1093. all.  If the value is `t', then there is no time limit.
  1094.  
  1095.    The symbols for mouse events also indicate the status of the modifier
  1096. keys, with the usual prefixes `C-', `M-', `H-', `s-', `A-' and `S-'.
  1097. These always precede `double-' or `triple-', which always precede
  1098. `drag-' or `down-'.
  1099.  
  1100.    A frame includes areas that don't show text from the buffer, such as
  1101. the mode line and the scroll bar.  You can tell whether a mouse button
  1102. comes from a special area of the screen by means of dummy "prefix
  1103. keys."  For example, if you click the mouse in the mode line, you get
  1104. the prefix key `mode-line' before the ordinary mouse-button symbol.
  1105. Thus, here is how to define the command for clicking the left button in
  1106. a mode line to run `scroll-up':
  1107.  
  1108.      (global-set-key [mode-line mouse-1] 'scroll-up)
  1109.  
  1110.    Here is the complete list of these dummy prefix keys and their
  1111. meanings:
  1112.  
  1113. `mode-line'
  1114.      The mouse was in the mode line of a window.
  1115.  
  1116. `vertical-line'
  1117.      The mouse was in the vertical line separating side-by-side windows.
  1118.  
  1119. `vertical-scroll-bar'
  1120.      The mouse was in a horizontal scroll bar.  This is the kind of
  1121.      scroll bar people normally use.
  1122.  
  1123. `horizontal-scroll-bar'
  1124.      The mouse was in a horizontal scroll bar.  Horizontal scroll bars
  1125.      do horizontal scrolling, and people don't use them often.
  1126.  
  1127.    You can put more than one mouse button in a key sequence, but it
  1128. isn't usual to do so.
  1129.  
  1130.