diff options
| author | Chong Yidong | 2012-02-15 00:41:16 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-02-15 00:41:16 +0800 |
| commit | 3d8badf411c8749ea9fcd7c525471fe01c416d6b (patch) | |
| tree | e283c311ce2b24776aca0349566d69f330ecc34e | |
| parent | 835bdcba536b6df51ff97d1a914b42a7d9072298 (diff) | |
| download | emacs-3d8badf411c8749ea9fcd7c525471fe01c416d6b.tar.gz emacs-3d8badf411c8749ea9fcd7c525471fe01c416d6b.zip | |
Update Keymaps chapter of Lisp manual.
* doc/emacs/keymaps.texi (Format of Keymaps): The CACHE component of keymaps
was removed on 2009-09-10. Update lisp-mode-map example.
(Inheritance and Keymaps): Minor clarification.
(Searching Keymaps): Remove out-of-place enumeration.
(Key Lookup): Remove unnecessary example (one was already given in
Format of Keymaps).
(Changing Key Bindings): Update suppress-keymap example.
(Menu Bar, Tool Bar): Copyedits.
(Tool Bar): Update tool-bar-map example.
| -rw-r--r-- | admin/FOR-RELEASE | 2 | ||||
| -rw-r--r-- | doc/lispref/ChangeLog | 12 | ||||
| -rw-r--r-- | doc/lispref/keymaps.texi | 211 |
3 files changed, 91 insertions, 134 deletions
diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 75103ff3cec..f2c572cfd17 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE | |||
| @@ -204,7 +204,7 @@ hooks.texi | |||
| 204 | index.texi | 204 | index.texi |
| 205 | internals.texi | 205 | internals.texi |
| 206 | intro.texi cyd | 206 | intro.texi cyd |
| 207 | keymaps.texi | 207 | keymaps.texi cyd |
| 208 | lists.texi cyd | 208 | lists.texi cyd |
| 209 | loading.texi cyd | 209 | loading.texi cyd |
| 210 | locals.texi | 210 | locals.texi |
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index c5848ca8b2d..baab5113057 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2012-02-14 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * keymaps.texi (Format of Keymaps): The CACHE component of keymaps | ||
| 4 | was removed on 2009-09-10. Update lisp-mode-map example. | ||
| 5 | (Inheritance and Keymaps): Minor clarification. | ||
| 6 | (Searching Keymaps): Remove out-of-place enumeration. | ||
| 7 | (Key Lookup): Remove unnecessary example (one was already given in | ||
| 8 | Format of Keymaps). | ||
| 9 | (Changing Key Bindings): Update suppress-keymap example. | ||
| 10 | (Menu Bar, Tool Bar): Copyedits. | ||
| 11 | (Tool Bar): Update tool-bar-map example. | ||
| 12 | |||
| 1 | 2012-02-12 Chong Yidong <cyd@gnu.org> | 13 | 2012-02-12 Chong Yidong <cyd@gnu.org> |
| 2 | 14 | ||
| 3 | * debugging.texi (Debugger Commands): Continuing is now allowed | 15 | * debugging.texi (Debugger Commands): Continuing is now allowed |
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index a8528a548fc..5652d94114e 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi | |||
| @@ -173,13 +173,11 @@ ordinary binding applies to events of a particular @dfn{event type}, | |||
| 173 | which is always a character or a symbol. @xref{Classifying Events}. | 173 | which is always a character or a symbol. @xref{Classifying Events}. |
| 174 | In this kind of binding, @var{binding} is a command. | 174 | In this kind of binding, @var{binding} is a command. |
| 175 | 175 | ||
| 176 | @item (@var{type} @var{item-name} @r{[}@var{cache}@r{]} .@: @var{binding}) | 176 | @item (@var{type} @var{item-name} .@: @var{binding}) |
| 177 | This specifies a binding which is also a simple menu item that | 177 | This specifies a binding which is also a simple menu item that |
| 178 | displays as @var{item-name} in the menu. @var{cache}, if present, | 178 | displays as @var{item-name} in the menu. @xref{Simple Menu Items}. |
| 179 | caches certain information for display in the menu. @xref{Simple Menu | ||
| 180 | Items}. | ||
| 181 | 179 | ||
| 182 | @item (@var{type} @var{item-name} @var{help-string} @r{[}@var{cache}@r{]} .@: @var{binding}) | 180 | @item (@var{type} @var{item-name} @var{help-string} .@: @var{binding}) |
| 183 | This is a simple menu item with help string @var{help-string}. | 181 | This is a simple menu item with help string @var{help-string}. |
| 184 | 182 | ||
| 185 | @item (@var{type} menu-item .@: @var{details}) | 183 | @item (@var{type} menu-item .@: @var{details}) |
| @@ -234,8 +232,9 @@ other input events; thus, @kbd{M-@key{end}} has nothing to do with | |||
| 234 | @kbd{@key{ESC} @key{end}}. | 232 | @kbd{@key{ESC} @key{end}}. |
| 235 | 233 | ||
| 236 | Here as an example is the local keymap for Lisp mode, a sparse | 234 | Here as an example is the local keymap for Lisp mode, a sparse |
| 237 | keymap. It defines bindings for @key{DEL} and @key{TAB}, plus @kbd{C-c | 235 | keymap. It defines bindings for @key{DEL}, @kbd{C-c C-z}, |
| 238 | C-l}, @kbd{M-C-q}, and @kbd{M-C-x}. | 236 | @kbd{C-M-q}, and @kbd{C-M-x} (the actual value also contains a menu |
| 237 | binding, which is omitted here for the sake of brevity). | ||
| 239 | 238 | ||
| 240 | @example | 239 | @example |
| 241 | @group | 240 | @group |
| @@ -250,11 +249,8 @@ lisp-mode-map | |||
| 250 | @end group | 249 | @end group |
| 251 | @group | 250 | @group |
| 252 | (27 keymap | 251 | (27 keymap |
| 253 | ;; @r{@kbd{M-C-x}, treated as @kbd{@key{ESC} C-x}} | 252 | ;; @r{@kbd{C-M-x}, treated as @kbd{@key{ESC} C-x}} |
| 254 | (24 . lisp-send-defun) | 253 | (24 . lisp-send-defun)) |
| 255 | keymap | ||
| 256 | ;; @r{@kbd{M-C-q}, treated as @kbd{@key{ESC} C-q}} | ||
| 257 | (17 . indent-sexp)) | ||
| 258 | @end group | 254 | @end group |
| 259 | @group | 255 | @group |
| 260 | ;; @r{This part is inherited from @code{lisp-mode-shared-map}.} | 256 | ;; @r{This part is inherited from @code{lisp-mode-shared-map}.} |
| @@ -264,9 +260,8 @@ lisp-mode-map | |||
| 264 | @end group | 260 | @end group |
| 265 | @group | 261 | @group |
| 266 | (27 keymap | 262 | (27 keymap |
| 267 | ;; @r{@kbd{M-C-q}, treated as @kbd{@key{ESC} C-q}} | 263 | ;; @r{@kbd{C-M-q}, treated as @kbd{@key{ESC} C-q}} |
| 268 | (17 . indent-sexp)) | 264 | (17 . indent-sexp))) |
| 269 | (9 . lisp-indent-line)) | ||
| 270 | @end group | 265 | @end group |
| 271 | @end example | 266 | @end example |
| 272 | 267 | ||
| @@ -441,10 +436,10 @@ This function returns a new keymap composed of the existing keymap(s) | |||
| 441 | @var{maps}, and optionally inheriting from a parent keymap | 436 | @var{maps}, and optionally inheriting from a parent keymap |
| 442 | @var{parent}. @var{maps} can be a single keymap or a list of more | 437 | @var{parent}. @var{maps} can be a single keymap or a list of more |
| 443 | than one. When looking up a key in the resulting new map, Emacs | 438 | than one. When looking up a key in the resulting new map, Emacs |
| 444 | searches in each of the @var{maps}, and then in @var{parent}, stopping | 439 | searches in each of the @var{maps} in turn, and then in @var{parent}, |
| 445 | at the first match. A @code{nil} binding in any one of @var{maps} | 440 | stopping at the first match. A @code{nil} binding in any one of |
| 446 | overrides any binding in @var{parent}, but not a non-@code{nil} binding | 441 | @var{maps} overrides any binding in @var{parent}, but it does not |
| 447 | in any other of the @var{maps}. | 442 | override any non-@code{nil} binding in any other of the @var{maps}. |
| 448 | @end defun | 443 | @end defun |
| 449 | 444 | ||
| 450 | @noindent For example, here is how Emacs sets the parent of | 445 | @noindent For example, here is how Emacs sets the parent of |
| @@ -762,35 +757,23 @@ them: | |||
| 762 | @end lisp | 757 | @end lisp |
| 763 | 758 | ||
| 764 | @noindent | 759 | @noindent |
| 765 | The @var{find-in} and @var{find-in-any} are pseudo functions that | 760 | @var{find-in} and @var{find-in-any} are pseudo functions that search |
| 766 | search in one keymap and in an alist of keymaps, respectively. | 761 | in one keymap and in an alist of keymaps, respectively. (Searching a |
| 767 | (Searching a single keymap for a binding is called @dfn{key lookup}; | 762 | single keymap for a binding is called @dfn{key lookup}; see @ref{Key |
| 768 | see @ref{Key Lookup}.) If the key sequence starts with a mouse event, | 763 | Lookup}.) If the key sequence starts with a mouse event, or a |
| 769 | or a symbolic prefix event followed by a mouse event, that event's | 764 | symbolic prefix event followed by a mouse event, that event's position |
| 770 | position is used instead of point and the current buffer. Mouse | 765 | is used instead of point and the current buffer. Mouse events on an |
| 771 | events on an embedded string use non-@code{nil} text properties from | 766 | embedded string use non-@code{nil} text properties from that string |
| 772 | that string instead of the buffer. | 767 | instead of the buffer. |
| 773 | 768 | ||
| 774 | @enumerate | 769 | When a match is found (@pxref{Key Lookup}), if the binding in the |
| 775 | @item | ||
| 776 | The function finally found may be remapped | ||
| 777 | (@pxref{Remapping Commands}). | ||
| 778 | |||
| 779 | @item | ||
| 780 | Characters that are bound to @code{self-insert-command} are translated | ||
| 781 | according to @code{translation-table-for-input} before insertion. | ||
| 782 | |||
| 783 | @item | ||
| 784 | @code{current-active-maps} returns a list of the | ||
| 785 | currently active keymaps at point. | ||
| 786 | |||
| 787 | @item | ||
| 788 | When a match is found (@pxref{Key Lookup}), if the binding in the | ||
| 789 | keymap is a function, the search is over. However if the keymap entry | 770 | keymap is a function, the search is over. However if the keymap entry |
| 790 | is a symbol with a value or a string, Emacs replaces the input key | 771 | is a symbol with a value or a string, Emacs replaces the input key |
| 791 | sequences with the variable's value or the string, and restarts the | 772 | sequences with the variable's value or the string, and restarts the |
| 792 | search of the active keymaps. | 773 | search of the active keymaps. |
| 793 | @end enumerate | 774 | |
| 775 | The function finally found might also be remapped. @xref{Remapping | ||
| 776 | Commands}. | ||
| 794 | 777 | ||
| 795 | @node Controlling Active Maps | 778 | @node Controlling Active Maps |
| 796 | @section Controlling the Active Keymaps | 779 | @section Controlling the Active Keymaps |
| @@ -1088,21 +1071,9 @@ lookup form a complete key, and the object is its binding, but the | |||
| 1088 | binding is not executable as a command. | 1071 | binding is not executable as a command. |
| 1089 | @end table | 1072 | @end table |
| 1090 | 1073 | ||
| 1091 | In short, a keymap entry may be a keymap, a command, a keyboard macro, | 1074 | In short, a keymap entry may be a keymap, a command, a keyboard |
| 1092 | a symbol that leads to one of them, or an indirection or @code{nil}. | 1075 | macro, a symbol that leads to one of them, or an indirection or |
| 1093 | Here is an example of a sparse keymap with two characters bound to | 1076 | @code{nil}. |
| 1094 | commands and one bound to another keymap. This map is the normal value | ||
| 1095 | of @code{emacs-lisp-mode-map}. Note that 9 is the code for @key{TAB}, | ||
| 1096 | 127 for @key{DEL}, 27 for @key{ESC}, 17 for @kbd{C-q} and 24 for | ||
| 1097 | @kbd{C-x}. | ||
| 1098 | |||
| 1099 | @example | ||
| 1100 | @group | ||
| 1101 | (keymap (9 . lisp-indent-line) | ||
| 1102 | (127 . backward-delete-char-untabify) | ||
| 1103 | (27 keymap (17 . indent-sexp) (24 . eval-defun))) | ||
| 1104 | @end group | ||
| 1105 | @end example | ||
| 1106 | 1077 | ||
| 1107 | @node Functions for Key Lookup | 1078 | @node Functions for Key Lookup |
| 1108 | @section Functions for Key Lookup | 1079 | @section Functions for Key Lookup |
| @@ -1472,23 +1443,21 @@ that is used for some other purpose is likely to cause trouble; for | |||
| 1472 | example, suppressing @code{global-map} would make it impossible to use | 1443 | example, suppressing @code{global-map} would make it impossible to use |
| 1473 | most of Emacs. | 1444 | most of Emacs. |
| 1474 | 1445 | ||
| 1475 | Most often, @code{suppress-keymap} is used to initialize local | 1446 | This function can be used to initialize the local keymap of a major |
| 1476 | keymaps of modes such as Rmail and Dired where insertion of text is not | 1447 | mode for which insertion of text is not desirable. But usually such a |
| 1477 | desirable and the buffer is read-only. Here is an example taken from | 1448 | mode should be derived from @code{special-mode} (@pxref{Basic Major |
| 1478 | the file @file{emacs/lisp/dired.el}, showing how the local keymap for | 1449 | Modes}); then its keymap will automatically inherit from |
| 1479 | Dired mode is set up: | 1450 | @code{special-mode-map}, which is already suppressed. Here is how |
| 1451 | @code{special-mode-map} is defined: | ||
| 1480 | 1452 | ||
| 1481 | @smallexample | 1453 | @smallexample |
| 1482 | @group | 1454 | @group |
| 1483 | (setq dired-mode-map (make-keymap)) | 1455 | (defvar special-mode-map |
| 1484 | (suppress-keymap dired-mode-map) | 1456 | (let ((map (make-sparse-keymap))) |
| 1485 | (define-key dired-mode-map "r" 'dired-rename-file) | 1457 | (suppress-keymap map) |
| 1486 | (define-key dired-mode-map "\C-d" 'dired-flag-file-deleted) | 1458 | (define-key map "q" 'quit-window) |
| 1487 | (define-key dired-mode-map "d" 'dired-flag-file-deleted) | 1459 | @dots{} |
| 1488 | (define-key dired-mode-map "v" 'dired-view-file) | 1460 | map)) |
| 1489 | (define-key dired-mode-map "e" 'dired-find-file) | ||
| 1490 | (define-key dired-mode-map "f" 'dired-find-file) | ||
| 1491 | @dots{} | ||
| 1492 | @end group | 1461 | @end group |
| 1493 | @end smallexample | 1462 | @end smallexample |
| 1494 | @end defun | 1463 | @end defun |
| @@ -2064,12 +2033,10 @@ event type (it doesn't matter what event type) to a binding like this: | |||
| 2064 | @noindent | 2033 | @noindent |
| 2065 | The @sc{car}, @var{item-string}, is the string to be displayed in the | 2034 | The @sc{car}, @var{item-string}, is the string to be displayed in the |
| 2066 | menu. It should be short---preferably one to three words. It should | 2035 | menu. It should be short---preferably one to three words. It should |
| 2067 | describe the action of the command it corresponds to. Note that it is | 2036 | describe the action of the command it corresponds to. Note that not |
| 2068 | not generally possible to display non-@acronym{ASCII} text in menus. It will | 2037 | all graphical toolkits can display non-@acronym{ASCII} text in menus |
| 2069 | work for keyboard menus and will work to a large extent when Emacs is | 2038 | (it will work for keyboard menus and will work to a large extent with |
| 2070 | built with the Gtk+ toolkit.@footnote{In this case, the text is first | 2039 | the GTK+ toolkit). |
| 2071 | encoded using the @code{utf-8} coding system and then rendered by the | ||
| 2072 | toolkit as it sees fit.} | ||
| 2073 | 2040 | ||
| 2074 | You can also supply a second string, called the help string, as follows: | 2041 | You can also supply a second string, called the help string, as follows: |
| 2075 | 2042 | ||
| @@ -2418,18 +2385,6 @@ this; @key{SPC} is the default.) | |||
| 2418 | she should type the corresponding character---the one whose binding is | 2385 | she should type the corresponding character---the one whose binding is |
| 2419 | that alternative. | 2386 | that alternative. |
| 2420 | 2387 | ||
| 2421 | @ignore | ||
| 2422 | In a menu intended for keyboard use, each menu item must clearly | ||
| 2423 | indicate what character to type. The best convention to use is to make | ||
| 2424 | the character the first letter of the item string---that is something | ||
| 2425 | users will understand without being told. We plan to change this; by | ||
| 2426 | the time you read this manual, keyboard menus may explicitly name the | ||
| 2427 | key for each alternative. | ||
| 2428 | @end ignore | ||
| 2429 | |||
| 2430 | This way of using menus in an Emacs-like editor was inspired by the | ||
| 2431 | Hierarkey system. | ||
| 2432 | |||
| 2433 | @defvar menu-prompt-more-char | 2388 | @defvar menu-prompt-more-char |
| 2434 | This variable specifies the character to use to ask to see | 2389 | This variable specifies the character to use to ask to see |
| 2435 | the next line of a menu. Its initial value is 32, the code | 2390 | the next line of a menu. Its initial value is 32, the code |
| @@ -2512,21 +2467,17 @@ can do it this way: | |||
| 2512 | @subsection The Menu Bar | 2467 | @subsection The Menu Bar |
| 2513 | @cindex menu bar | 2468 | @cindex menu bar |
| 2514 | 2469 | ||
| 2515 | Most window systems allow each frame to have a @dfn{menu bar}---a | 2470 | On graphical displays, there is usually a @dfn{menu bar} at the top |
| 2516 | permanently displayed menu stretching horizontally across the top of | 2471 | of each frame. @xref{Menu Bars,,,emacs, The GNU Emacs Manual}. Menu |
| 2517 | the frame. (In order for a frame to display a menu bar, its | 2472 | bar items are subcommands of the fake ``function key'' |
| 2518 | @code{menu-bar-lines} parameter must be greater than zero. | 2473 | @code{menu-bar}, as defined in the active keymaps. |
| 2519 | @xref{Layout Parameters}.) | ||
| 2520 | |||
| 2521 | The items of the menu bar are the subcommands of the fake ``function | ||
| 2522 | key'' @code{menu-bar}, as defined in the active keymaps. | ||
| 2523 | 2474 | ||
| 2524 | To add an item to the menu bar, invent a fake ``function key'' of your | 2475 | To add an item to the menu bar, invent a fake ``function key'' of your |
| 2525 | own (let's call it @var{key}), and make a binding for the key sequence | 2476 | own (let's call it @var{key}), and make a binding for the key sequence |
| 2526 | @code{[menu-bar @var{key}]}. Most often, the binding is a menu keymap, | 2477 | @code{[menu-bar @var{key}]}. Most often, the binding is a menu keymap, |
| 2527 | so that pressing a button on the menu bar item leads to another menu. | 2478 | so that pressing a button on the menu bar item leads to another menu. |
| 2528 | 2479 | ||
| 2529 | When more than one active keymap defines the same fake function key | 2480 | When more than one active keymap defines the same ``function key'' |
| 2530 | for the menu bar, the item appears just once. If the user clicks on | 2481 | for the menu bar, the item appears just once. If the user clicks on |
| 2531 | that menu bar item, it brings up a single, combined menu containing | 2482 | that menu bar item, it brings up a single, combined menu containing |
| 2532 | all the subcommands of that item---the global subcommands, the local | 2483 | all the subcommands of that item---the global subcommands, the local |
| @@ -2541,11 +2492,6 @@ were @code{nil}. @xref{Active Keymaps}. | |||
| 2541 | 2492 | ||
| 2542 | @example | 2493 | @example |
| 2543 | @group | 2494 | @group |
| 2544 | (modify-frame-parameters (selected-frame) | ||
| 2545 | '((menu-bar-lines . 2))) | ||
| 2546 | @end group | ||
| 2547 | |||
| 2548 | @group | ||
| 2549 | ;; @r{Make a menu keymap (with a prompt string)} | 2495 | ;; @r{Make a menu keymap (with a prompt string)} |
| 2550 | ;; @r{and make it the menu bar item's definition.} | 2496 | ;; @r{and make it the menu bar item's definition.} |
| 2551 | (define-key global-map [menu-bar words] | 2497 | (define-key global-map [menu-bar words] |
| @@ -2618,20 +2564,17 @@ that the command does not actually have, it is ignored. | |||
| 2618 | @subsection Tool bars | 2564 | @subsection Tool bars |
| 2619 | @cindex tool bar | 2565 | @cindex tool bar |
| 2620 | 2566 | ||
| 2621 | A @dfn{tool bar} is a row of icons at the top of a frame, that execute | 2567 | A @dfn{tool bar} is a row of clickable icons at the top of a frame, |
| 2622 | commands when you click on them---in effect, a kind of graphical menu | 2568 | just below the menu bar. @xref{Tool Bars,,,emacs, The GNU Emacs |
| 2623 | bar. | 2569 | Manual}. |
| 2624 | |||
| 2625 | The frame parameter @code{tool-bar-lines} (X resource @samp{toolBar}) | ||
| 2626 | controls how many lines' worth of height to reserve for the tool bar. A | ||
| 2627 | zero value suppresses the tool bar. If the value is nonzero, and | ||
| 2628 | @code{auto-resize-tool-bars} is non-@code{nil}, the tool bar expands and | ||
| 2629 | contracts automatically as needed to hold the specified contents. | ||
| 2630 | 2570 | ||
| 2631 | If the value of @code{auto-resize-tool-bars} is @code{grow-only}, | 2571 | On each frame, the frame parameter @code{tool-bar-lines} controls |
| 2632 | the tool bar expands automatically, but does not contract automatically. | 2572 | how many lines' worth of height to reserve for the tool bar. A zero |
| 2633 | To contract the tool bar, the user has to redraw the frame by entering | 2573 | value suppresses the tool bar. If the value is nonzero, and |
| 2634 | @kbd{C-l}. | 2574 | @code{auto-resize-tool-bars} is non-@code{nil}, the tool bar expands |
| 2575 | and contracts automatically as needed to hold the specified contents. | ||
| 2576 | If the value is @code{grow-only}, the tool bar expands automatically, | ||
| 2577 | but does not contract automatically. | ||
| 2635 | 2578 | ||
| 2636 | The tool bar contents are controlled by a menu keymap attached to a | 2579 | The tool bar contents are controlled by a menu keymap attached to a |
| 2637 | fake ``function key'' called @code{tool-bar} (much like the way the menu | 2580 | fake ``function key'' called @code{tool-bar} (much like the way the menu |
| @@ -2683,17 +2626,17 @@ button in disabled state by applying an edge-detection algorithm to the | |||
| 2683 | image. | 2626 | image. |
| 2684 | 2627 | ||
| 2685 | The @code{:rtl} property specifies an alternative image to use for | 2628 | The @code{:rtl} property specifies an alternative image to use for |
| 2686 | right-to-left languages. Only the Gtk+ version of Emacs supports this | 2629 | right-to-left languages. Only the GTK+ version of Emacs supports this |
| 2687 | at present. | 2630 | at present. |
| 2688 | 2631 | ||
| 2689 | Like the menu bar, the tool bar can display separators (@pxref{Menu | 2632 | Like the menu bar, the tool bar can display separators (@pxref{Menu |
| 2690 | Separators}). Tool bar separators are vertical rather than | 2633 | Separators}). Tool bar separators are vertical rather than |
| 2691 | horizontal, though, and only a single style is supported. Separators | 2634 | horizontal, though, and only a single style is supported. They are |
| 2692 | are represented in the tool bar keymap in the same way as for the | 2635 | represented in the tool bar keymap by @code{(menu-item "--")} entries; |
| 2693 | menu bar, i.e. using a @code{(menu-item "--"}) entry. The Gtk+ and | 2636 | properties like @code{:visible} are not supported for tool bar |
| 2694 | Nextstep tool bars render separators natively, otherwise Emacs selects | 2637 | separators. Separators are rendered natively in GTK+ and Nextstep |
| 2695 | a separator image that is appropriate for the display. Note that tool | 2638 | tool bars; in the other cases, they are rendered using an image of a |
| 2696 | bar separators do not support any properties, such as @code{:visible}. | 2639 | vertical line. |
| 2697 | 2640 | ||
| 2698 | The default tool bar is defined so that items specific to editing do not | 2641 | The default tool bar is defined so that items specific to editing do not |
| 2699 | appear for major modes whose command symbol has a @code{mode-class} | 2642 | appear for major modes whose command symbol has a @code{mode-class} |
| @@ -2706,18 +2649,20 @@ using an indirection through @code{tool-bar-map}. | |||
| 2706 | 2649 | ||
| 2707 | @defvar tool-bar-map | 2650 | @defvar tool-bar-map |
| 2708 | By default, the global map binds @code{[tool-bar]} as follows: | 2651 | By default, the global map binds @code{[tool-bar]} as follows: |
| 2652 | |||
| 2709 | @example | 2653 | @example |
| 2710 | (global-set-key [tool-bar] | 2654 | (global-set-key [tool-bar] |
| 2711 | '(menu-item "tool bar" ignore | 2655 | `(menu-item ,(purecopy "tool bar") ignore |
| 2712 | :filter (lambda (ignore) tool-bar-map))) | 2656 | :filter tool-bar-make-keymap)) |
| 2713 | @end example | 2657 | @end example |
| 2658 | |||
| 2714 | @noindent | 2659 | @noindent |
| 2715 | Thus the tool bar map is derived dynamically from the value of variable | 2660 | The function @code{tool-bar-make-keymap}, in turn, derives the actual |
| 2716 | @code{tool-bar-map} and you should normally adjust the default (global) | 2661 | tool bar map dynamically from the value of the variable |
| 2717 | tool bar by changing that map. Major modes may replace the global bar | 2662 | @code{tool-bar-map}. Hence, you should normally adjust the default |
| 2718 | completely by making @code{tool-bar-map} buffer-local and set to a | 2663 | (global) tool bar by changing that map. Some major modes, such as |
| 2719 | keymap containing only the desired items. Info mode provides an | 2664 | Info mode, completely replace the global tool bar by making |
| 2720 | example. | 2665 | @code{tool-bar-map} buffer-local and setting it to a different keymap. |
| 2721 | @end defvar | 2666 | @end defvar |
| 2722 | 2667 | ||
| 2723 | There are two convenience functions for defining tool bar items, as | 2668 | There are two convenience functions for defining tool bar items, as |