-This is ../info/lispref.info, produced by makeinfo version 3.12s from
+This is ../info/lispref.info, produced by makeinfo version 4.0 from
lispref/lispref.texi.
INFO-DIR-SECTION XEmacs Editor
Foundation instead of in the original English.
\1f
+File: lispref.info, Node: Menu Format, Next: Menubar Format, Up: Menus
+
+Format of Menus
+===============
+
+ A menu is described using a "menu description", which is a list of
+menu items, keyword-value pairs, strings, and submenus. The menu
+description specifies which items are present in the menu, what function
+each item invokes, and whether the item is selectable or not. Pop-up
+menus are directly described with a menu description, while menubars are
+described slightly differently (see below).
+
+ The first element of a menu must be a string, which is the name of
+the menu. This is the string that will be displayed in the parent menu
+or menubar, if any. This string is not displayed in the menu itself,
+except in the case of the top level pop-up menu, where there is no
+parent. In this case, the string will be displayed at the top of the
+menu if `popup-menu-titles' is non-`nil'.
+
+ Immediately following the first element there may optionally be up
+to four keyword-value pairs, as follows:
+
+`:included FORM'
+ This can be used to control the visibility of a menu. The form is
+ evaluated and the menu will be omitted if the result is `nil'.
+
+`:config SYMBOL'
+ This is an efficient shorthand for `:included (memq SYMBOL
+ menubar-configuration)'. See the variable `menubar-configuration'.
+
+`:filter FUNCTION'
+ A menu filter is used to sensitize or incrementally create a
+ submenu only when it is selected by the user and not every time
+ the menubar is activated. The filter function is passed the list
+ of menu items in the submenu and must return a list of menu items
+ to be used for the menu. It is called only when the menu is about
+ to be displayed, so other menus may already be displayed. Vile
+ and terrible things will happen if a menu filter function changes
+ the current buffer, window, or frame. It also should not raise,
+ lower, or iconify any frames. Basically, the filter function
+ should have no side-effects.
+
+`:accelerator KEY'
+ A menu accelerator is a keystroke which can be pressed while the
+ menu is visible which will immediately activate the item. KEY
+ must be a char or the symbol name of a key. *Note Menu
+ Accelerators::.
+
+ The rest of the menu consists of elements as follows:
+
+ * A "menu item", which is a vector in the following form:
+
+ `[ NAME CALLBACK :KEYWORD VALUE :KEYWORD VALUE ... ]'
+
+ NAME is a string, the name of the menu item; it is the string to
+ display on the menu. It is filtered through the resource
+ database, so it is possible for resources to override what string
+ is actually displayed.
+
+ CALLBACK is a form that will be invoked when the menu item is
+ selected. If the callback of a menu item is a symbol, then it
+ must name a command. It will be invoked with
+ `call-interactively'. If it is a list, then it is evaluated with
+ `eval'.
+
+ The valid keywords and their meanings are described below.
+
+ Note that for compatibility purposes, the form
+
+ `[ NAME CALLBACK ACTIVE-P ]'
+
+ is also accepted and is equivalent to
+
+ `[ NAME CALLBACK :active ACTIVE-P ]'
+
+ and the form
+
+ `[ NAME CALLBACK ACTIVE-P SUFFIX]'
+
+ is accepted and is equivalent to
+
+ `[ NAME CALLBACK :active ACTIVE-P :suffix SUFFIX]'
+
+ However, these older forms are deprecated and should generally not
+ be used.
+
+ * If an element of a menu is a string, then that string will be
+ presented in the menu as unselectable text.
+
+ * If an element of a menu is a string consisting solely of hyphens,
+ then that item will be presented as a solid horizontal line.
+
+ * If an element of a menu is a string beginning with `--:', then a
+ particular sort of horizontal line will be displayed, as follows:
+
+ `"--:singleLine"'
+ A solid horizontal line. This is equivalent to a string
+ consisting solely of hyphens.
+
+ `"--:doubleLine"'
+ A solid double horizontal line.
+
+ `"--:singleDashedLine"'
+ A dashed horizontal line.
+
+ `"--:doubleDashedLine"'
+ A dashed double horizontal line.
+
+ `"--:noLine"'
+ No line (but a small space is left).
+
+ `"--:shadowEtchedIn"'
+ A solid horizontal line with a 3-d recessed appearance.
+
+ `"--:shadowEtchedOut"'
+ A solid horizontal line with a 3-d pushed-out appearance.
+
+ `"--:shadowDoubleEtchedIn"'
+ A solid double horizontal line with a 3-d recessed appearance.
+
+ `"--:shadowDoubleEtchedOut"'
+ A solid double horizontal line with a 3-d pushed-out
+ appearance.
+
+ `"--:shadowEtchedInDash"'
+ A dashed horizontal line with a 3-d recessed appearance.
+
+ `"--:shadowEtchedOutDash"'
+ A dashed horizontal line with a 3-d pushed-out appearance.
+
+ `"--:shadowDoubleEtchedInDash"'
+ A dashed double horizontal line with a 3-d recessed
+ appearance.
+
+ `"--:shadowDoubleEtchedOutDash"'
+ A dashed double horizontal line with a 3-d pushed-out
+ appearance.
+
+ * If an element of a menu is a list, it is treated as a submenu.
+ The name of that submenu (the first element in the list) will be
+ used as the name of the item representing this menu on the parent.
+
+ The possible keywords are as follows:
+
+:active FORM
+ FORM will be evaluated when the menu that this item is a part of
+ is about to be displayed, and the item will be selectable only if
+ the result is non-`nil'. If the item is unselectable, it will
+ usually be displayed grayed-out to indicate this.
+
+:suffix FORM
+ FORM will be evaluated when the menu that this item is a part of
+ is about to be displayed, and the resulting string is appended to
+ the displayed name. This provides a convenient way of adding the
+ name of a command's "argument" to the menu, like `Kill Buffer
+ NAME'.
+
+:keys STRING
+ Normally, the keyboard equivalents of commands in menus are
+ displayed when the "callback" is a symbol. This can be used to
+ specify keys for more complex menu items. It is passed through
+ `substitute-command-keys' first.
+
+:style STYLE
+ Specifies what kind of object this menu item is. STYLE be one of
+ the symbols
+
+ `nil'
+ A normal menu item.
+
+ `toggle'
+ A toggle button.
+
+ `radio'
+ A radio button.
+
+ `button'
+ A menubar button.
+
+ The only difference between toggle and radio buttons is how they
+ are displayed. But for consistency, a toggle button should be
+ used when there is one option whose value can be turned on or off,
+ and radio buttons should be used when there is a set of mutually
+ exclusive options. When using a group of radio buttons, you
+ should arrange for no more than one to be marked as selected at a
+ time.
+
+:selected FORM
+ Meaningful only when STYLE is `toggle', `radio' or `button'. This
+ specifies whether the button will be in the selected or unselected
+ state. FORM is evaluated, as for `:active'.
+
+:included FORM
+ This can be used to control the visibility of a menu item. The
+ form is evaluated and the menu item is only displayed if the
+ result is non-`nil'. Note that this is different from `:active':
+ If `:active' evaluates to `nil', the item will be displayed grayed
+ out, while if `:included' evaluates to `nil', the item will be
+ omitted entirely.
+
+:config SYMBOL
+ This is an efficient shorthand for `:included (memq SYMBOL
+ menubar-configuration)'. See the variable `menubar-configuration'.
+
+:accelerator KEY
+ A menu accelerator is a keystroke which can be pressed while the
+ menu is visible which will immediately activate the item. KEY
+ must be a char or the symbol name of a key. *Note Menu
+ Accelerators::.
+
+ - Variable: menubar-configuration
+ This variable holds a list of symbols, against which the value of
+ the `:config' tag for each menubar item will be compared. If a
+ menubar item has a `:config' tag, then it is omitted from the
+ menubar if that tag is not a member of the `menubar-configuration'
+ list.
+
+ For example:
+
+ ("File"
+ :filter file-menu-filter ; file-menu-filter is a function that takes
+ ; one argument (a list of menu items) and
+ ; returns a list of menu items
+ [ "Save As..." write-file]
+ [ "Revert Buffer" revert-buffer :active (buffer-modified-p) ]
+ [ "Read Only" toggle-read-only :style toggle :selected buffer-read-only ]
+ )
+
+\1f
+File: lispref.info, Node: Menubar Format, Next: Menubar, Prev: Menu Format, Up: Menus
+
+Format of the Menubar
+=====================
+
+ A menubar is a list of menus, menu items, and strings. The format is
+similar to that of a menu, except:
+
+ * The first item need not be a string, and is not treated specially.
+
+ * A string consisting solely of hyphens is not treated specially.
+
+ * If an element of a menubar is `nil', then it is used to represent
+ the division between the set of menubar items which are flush-left
+ and those which are flush-right. (Note: this isn't completely
+ implemented yet.)
+
+\1f
+File: lispref.info, Node: Menubar, Next: Modifying Menus, Prev: Menubar Format, Up: Menus
+
+Menubar
+=======
+
+ - Variable: current-menubar
+ This variable holds the description of the current menubar. This
+ may be buffer-local. When the menubar is changed, the function
+ `set-menubar-dirty-flag' has to be called in order for the menubar
+ to be updated on the screen.
+
+ - Constant: default-menubar
+ This variable holds the menubar description of the menubar that is
+ visible at startup. This is the value that `current-menubar' has
+ at startup.
+
+ - Function: set-menubar-dirty-flag
+ This function tells XEmacs that the menubar widget has to be
+ updated. Changes to the menubar will generally not be visible
+ until this function is called.
+
+ The following convenience functions are provided for setting the
+menubar. They are equivalent to doing the appropriate action to change
+`current-menubar', and then calling `set-menubar-dirty-flag'. Note
+that these functions copy their argument using `copy-sequence'.
+
+ - Function: set-menubar menubar
+ This function sets the default menubar to be MENUBAR (*note Menu
+ Format::). This is the menubar that will be visible in buffers
+ that have not defined their own, buffer-local menubar.
+
+ - Function: set-buffer-menubar menubar
+ This function sets the buffer-local menubar to be MENUBAR. This
+ does not change the menubar in any buffers other than the current
+ one.
+
+ Miscellaneous:
+
+ - Variable: menubar-show-keybindings
+ If true, the menubar will display keyboard equivalents. If false,
+ only the command names will be displayed.
+
+ - Variable: activate-menubar-hook
+ Function or functions called before a menubar menu is pulled down.
+ These functions are called with no arguments, and should
+ interrogate and modify the value of `current-menubar' as desired.
+
+ The functions on this hook are invoked after the mouse goes down,
+ but before the menu is mapped, and may be used to activate,
+ deactivate, add, or delete items from the menus. However, using a
+ filter (with the `:filter' keyword in a menu description) is
+ generally a more efficient way of accomplishing the same thing,
+ because the filter is invoked only when the actual menu goes down.
+ With a complex menu, there can be a quite noticeable and
+ sometimes aggravating delay if all menu modification is
+ implemented using the `activate-menubar-hook'. See above.
+
+ These functions may return the symbol `t' to assert that they have
+ made no changes to the menubar. If any other value is returned,
+ the menubar is recomputed. If `t' is returned but the menubar has
+ been changed, then the changes may not show up right away.
+ Returning `nil' when the menubar has not changed is not so bad;
+ more computation will be done, but redisplay of the menubar will
+ still be performed optimally.
+
+ - Variable: menu-no-selection-hook
+ Function or functions to call when a menu or dialog box is
+ dismissed without a selection having been made.
+
+\1f
+File: lispref.info, Node: Modifying Menus, Next: Pop-Up Menus, Prev: Menubar, Up: Menus
+
+Modifying Menus
+===============
+
+ The following functions are provided to modify the menubar of one of
+its submenus. Note that these functions modify the menu in-place,
+rather than copying it and making a new menu.
+
+ Some of these functions take a "menu path", which is a list of
+strings identifying the menu to be modified. For example, `("File")'
+names the top-level "File" menu. `("File" "Foo")' names a hypothetical
+submenu of "File".
+
+ Others take a "menu item path", which is similar to a menu path but
+also specifies a particular item to be modified. For example, `("File"
+"Save")' means the menu item called "Save" under the top-level "File"
+menu. `("Menu" "Foo" "Item")' means the menu item called "Item" under
+the "Foo" submenu of "Menu".
+
+ - Function: add-submenu menu-path submenu &optional before in-menu
+ This function adds a menu to the menubar or one of its submenus.
+ If the named menu exists already, it is changed.
+
+ MENU-PATH identifies the menu under which the new menu should be
+ inserted. If MENU-PATH is `nil', then the menu will be added to
+ the menubar itself.
+
+ SUBMENU is the new menu to add (*note Menu Format::).
+
+ BEFORE, if provided, is the name of a menu before which this menu
+ should be added, if this menu is not on its parent already. If
+ the menu is already present, it will not be moved.
+
+ If IN-MENU is present use that instead of `current-menubar' as the
+ menu to change.
+
+ - Function: add-menu-button menu-path menu-leaf &optional before
+ in-menu
+ This function adds a menu item to some menu, creating the menu
+ first if necessary. If the named item exists already, it is
+ changed.
+
+ MENU-PATH identifies the menu under which the new menu item should
+ be inserted.
+
+ MENU-LEAF is a menubar leaf node (*note Menu Format::).
+
+ BEFORE, if provided, is the name of a menu before which this item
+ should be added, if this item is not on the menu already. If the
+ item is already present, it will not be moved.
+
+ If IN-MENU is present use that instead of `current-menubar' as the
+ menu to change.
+
+ - Function: delete-menu-item menu-item-path &optional from-menu
+ This function removes the menu item specified by MENU-ITEM-PATH
+ from the menu hierarchy.
+
+ If FROM-MENU is present use that instead of `current-menubar' as
+ the menu to change.
+
+ - Function: enable-menu-item menu-item-path
+ This function makes the menu item specified by MENU-ITEM-PATH be
+ selectable.
+
+ - Function: disable-menu-item menu-item-path
+ This function makes the menu item specified by MENU-ITEM-PATH be
+ unselectable.
+
+ - Function: relabel-menu-item menu-item-path new-name
+ This function changes the string of the menu item specified by
+ MENU-ITEM-PATH. NEW-NAME is the string that the menu item will be
+ printed as from now on.
+
+ The following function can be used to search for a particular item in
+a menubar specification, given a path to the item.
+
+ - Function: find-menu-item menubar menu-item-path &optional parent
+ This function searches MENUBAR for the item given by
+ MENU-ITEM-PATH starting from PARENT (`nil' means start at the top
+ of MENUBAR). This function returns `(ITEM . PARENT)', where
+ PARENT is the immediate parent of the item found (a menu
+ description), and ITEM is either a vector, list, or string,
+ depending on the nature of the menu item.
+
+ This function signals an error if the item is not found.
+
+ The following deprecated functions are also documented, so that
+existing code can be understood. You should not use these functions in
+new code.
+
+ - Function: add-menu menu-path menu-name menu-items &optional before
+ This function adds a menu to the menubar or one of its submenus.
+ If the named menu exists already, it is changed. This is
+ obsolete; use `add-submenu' instead.
+
+ MENU-PATH identifies the menu under which the new menu should be
+ inserted. If MENU-PATH is `nil', then the menu will be added to
+ the menubar itself.
+
+ MENU-NAME is the string naming the menu to be added; MENU-ITEMS is
+ a list of menu items, strings, and submenus. These two arguments
+ are the same as the first and following elements of a menu
+ description (*note Menu Format::).
+
+ BEFORE, if provided, is the name of a menu before which this menu
+ should be added, if this menu is not on its parent already. If the
+ menu is already present, it will not be moved.
+
+ - Function: add-menu-item menu-path item-name function enabled-p
+ &optional before
+ This function adds a menu item to some menu, creating the menu
+ first if necessary. If the named item exists already, it is
+ changed. This is obsolete; use `add-menu-button' instead.
+
+ MENU-PATH identifies the menu under which the new menu item should
+ be inserted. ITEM-NAME, FUNCTION, and ENABLED-P are the first,
+ second, and third elements of a menu item vector (*note Menu
+ Format::).
+
+ BEFORE, if provided, is the name of a menu item before which this
+ item should be added, if this item is not on the menu already. If
+ the item is already present, it will not be moved.
+
+\1f
+File: lispref.info, Node: Menu Filters, Next: Menu Accelerators, Prev: Pop-Up Menus, Up: Menus
+
+Menu Filters
+============
+
+ The following filter functions are provided for use in
+`default-menubar'. You may want to use them in your own menubar
+description.
+
+ - Function: file-menu-filter menu-items
+ This function changes the arguments and sensitivity of these File
+ menu items:
+
+ `Delete Buffer'
+ Has the name of the current buffer appended to it.
+
+ `Print Buffer'
+ Has the name of the current buffer appended to it.
+
+ `Pretty-Print Buffer'
+ Has the name of the current buffer appended to it.
+
+ `Save Buffer'
+ Has the name of the current buffer appended to it, and is
+ sensitive only when the current buffer is modified.
+
+ `Revert Buffer'
+ Has the name of the current buffer appended to it, and is
+ sensitive only when the current buffer has a file.
+
+ `Delete Frame'
+ Sensitive only when there is more than one visible frame.
+
+ - Function: edit-menu-filter menu-items
+ This function changes the arguments and sensitivity of these Edit
+ menu items:
+
+ `Cut'
+ Sensitive only when XEmacs owns the primary X Selection (if
+ `zmacs-regions' is `t', this is equivalent to saying that
+ there is a region selected).
+
+ `Copy'
+ Sensitive only when XEmacs owns the primary X Selection.
+
+ `Clear'
+ Sensitive only when XEmacs owns the primary X Selection.
+
+ `Paste'
+ Sensitive only when there is an owner for the X Clipboard
+ Selection.
+
+ `Undo'
+ Sensitive only when there is undo information. While in the
+ midst of an undo, this is changed to `Undo More'.
+
+ - Function: buffers-menu-filter menu-items
+ This function sets up the Buffers menu. *Note Buffers Menu::, for
+ more information.
+
+\1f
File: lispref.info, Node: Pop-Up Menus, Next: Menu Filters, Prev: Modifying Menus, Up: Menus
Pop-Up Menus
============
- - Function: popup-menu menu-desc
- This function pops up a menu specified by MENU-DESC, which is a
- menu description (*note Menu Format::). The menu is displayed at
- the current mouse position.
+ - Function: popup-menu menu-description &optional event
+ This function pops up a menu specified by MENU-DESCRIPTION, which
+ is a menu description (*note Menu Format::). The menu is
+ displayed at the current mouse position.
- Function: popup-menu-up-p
This function returns `t' if a pop-up menu is up, `nil' otherwise.
The following convenience functions are provided for displaying
pop-up menus.
- - Function: popup-buffer-menu event
+ - Command: popup-buffer-menu event
This function pops up a copy of the `Buffers' menu (from the
- menubar) where the mouse is clicked.
+ menubar) where the mouse is clicked. It should be bound to a
+ mouse button event.
- - Function: popup-menubar-menu event
+ - Command: popup-menubar-menu event
This function pops up a copy of menu that also appears in the
- menubar.
+ menubar. It should be bound to a mouse button event.
\1f
File: lispref.info, Node: Menu Accelerators, Next: Buffers Menu, Prev: Menu Filters, Up: Menus
* Menu:
-* Creating Menu Accelerators:: How to add accelerator keys to a menu.
-* Keyboard Menu Traversal:: How to use and modify the keys which are used
- to traverse the menu structure.
-* Menu Accelerator Functions:: Functions for working with menu accelerators.
+* Creating Menu Accelerators:: How to add accelerator keys to a menu.
+* Keyboard Menu Traversal:: How to use and modify the keys which are used
+ to traverse the menu structure.
+* Menu Accelerator Functions:: Functions for working with menu accelerators.
\1f
File: lispref.info, Node: Creating Menu Accelerators, Next: Keyboard Menu Traversal, Up: Menu Accelerators
For example, the command
(add-submenu nil '("%_Test"
- ["One" (insert "1") :accelerator ?1 :active t]
- ["%_Two" (insert "2")]
- ["%_3" (insert "3")]))
+ ["One" (insert "1") :accelerator ?1 :active t]
+ ["%_Two" (insert "2")]
+ ["%_3" (insert "3")]))
will add a new menu to the top level menubar. The new menu can be
reached by pressing "t" while the top level menubar is active. When
Menu Accelerator Functions
--------------------------
- - Function: accelerate-menu
+ - Command: accelerate-menu
Make the menubar immediately active and place the cursor on the
left most entry in the top level menu. Menu items can be selected
as usual.
(setq menu-accelerator-modifiers '(meta control))
(setq menu-accelerator-enabled 'menu-force)
(add-submenu nil '("%_Test"
- ["One" (insert "1") :accelerator ?1 :active t]
- ["%_Two" (insert "2")]
- ["%_3" (insert "3")]))
+ ["One" (insert "1") :accelerator ?1 :active t]
+ ["%_Two" (insert "2")]
+ ["%_3" (insert "3")]))
will add the menu "Test" to the top level menubar. Pressing C-x
followed by C-M-T will activate the menubar and display the "Test"
The syntax, more precisely:
- form := <something to pass to `eval'>
- command := <a symbol or string, to pass to `call-interactively'>
- callback := command | form
- active-p := <t, nil, or a form to evaluate to decide whether this
- button should be selectable>
- name := <string>
- partition := 'nil'
- button := '[' name callback active-p ']'
- dialog := '(' name [ button ]+ [ partition [ button ]+ ] ')'
+ form := <something to pass to `eval'>
+ command := <a symbol or string, to pass to `call-interactively'>
+ callback := command | form
+ active-p := <t, nil, or a form to evaluate to decide whether this
+ button should be selectable>
+ name := <string>
+ partition := 'nil'
+ button := '[' name callback active-p ']'
+ dialog := '(' name [ button ]+ [ partition [ button ]+ ] ')'
\1f
File: lispref.info, Node: Dialog Box Functions, Prev: Dialog Box Format, Up: Dialog Boxes
using a dialog box.
\1f
-File: lispref.info, Node: Toolbar, Next: Scrollbars, Prev: Dialog Boxes, Up: Top
+File: lispref.info, Node: Toolbar, Next: Gutter, Prev: Dialog Boxes, Up: Top
Toolbar
*******
* Menu:
* Toolbar Intro:: An introduction.
-* Toolbar Descriptor Format:: How to create a toolbar.
+* Creating Toolbar:: How to create a toolbar.
+* Toolbar Descriptor Format:: Accessing and modifying a toolbar's
+ properties.
* Specifying the Toolbar:: Setting a toolbar's contents.
* Other Toolbar Variables:: Controlling the size of toolbars.
\1f
-File: lispref.info, Node: Toolbar Intro, Next: Toolbar Descriptor Format, Up: Toolbar
+File: lispref.info, Node: Toolbar Intro, Next: Creating Toolbar, Up: Toolbar
Toolbar Intro
=============
A "toolbar" is a bar of icons displayed along one edge of a frame.
-You can view a toolbar as a series of menu shortcuts - the most common
+You can view a toolbar as a series of menu shortcuts--the most common
menu options can be accessed with a single click rather than a series
of clicks and/or drags to select the option from a menu. Consistent
with this, a help string (called the "help-echo") describing what an
toolbar to the same position, it will just not be visible.
\1f
-File: lispref.info, Node: Toolbar Descriptor Format, Next: Specifying the Toolbar, Prev: Toolbar Intro, Up: Toolbar
+File: lispref.info, Node: Creating Toolbar, Next: Toolbar Descriptor Format, Prev: Toolbar Intro, Up: Toolbar
+
+Creating Toolbar
+================
+
+ - Function: make-toolbar-specifier spec-list
+ Return a new `toolbar' specifier object with the given
+ specification list. SPEC-LIST can be a list of specifications
+ (each of which is a cons of a locale and a list of instantiators),
+ a single instantiator, or a list of instantiators. *Note
+ Specifiers::, for more information about specifiers.
+
+ Toolbar specifiers are used to specify the format of a toolbar.
+ The values of the variables `default-toolbar', `top-toolbar',
+ `left-toolbar', `right-toolbar', and `bottom-toolbar' are always
+ toolbar specifiers.
+
+ Valid toolbar instantiators are called "toolbar descriptors" and
+ are lists of vectors. See `default-toolbar' for a description of
+ the exact format.
+
+\1f
+File: lispref.info, Node: Toolbar Descriptor Format, Next: Specifying the Toolbar, Prev: Creating Toolbar, Up: Toolbar
Toolbar Descriptor Format
=========================
Specifier for the toolbar at the right edge of the frame.
- Function: toolbar-specifier-p object
- This function returns non-nil if OBJECT is a toolbar specifier.
+ This function returns non-`nil' if OBJECT is a toolbar specifier.
Toolbar specifiers are the actual objects contained in the toolbar
variables described above, and their valid instantiators are
toolbar descriptors (*note Toolbar Descriptor Format::).
the left toolbar width for that frame to 68 pixels, then the frame will
be sized to fit 80 characters plus a 68-pixel left toolbar. If you then
set the left toolbar width to 0 for a particular buffer (or if that
-buffer does not specify a left toolbar or has a nil value specified for
-`left-toolbar-visible-p'), you will find that, when that buffer is
+buffer does not specify a left toolbar or has a `nil' value specified
+for `left-toolbar-visible-p'), you will find that, when that buffer is
displayed in the selected window, the window will have a width of 86 or
-87 characters - the frame is sized for a 68-pixel left toolbar but the
+87 characters--the frame is sized for a 68-pixel left toolbar but the
selected window specifies that the left toolbar is not visible, so it is
expanded to take up the slack.
startup.
\1f
-File: lispref.info, Node: Scrollbars, Next: Drag and Drop, Prev: Toolbar, Up: Top
-
-scrollbars
-**********
-
- Not yet documented.
-
-\1f
-File: lispref.info, Node: Drag and Drop, Next: Modes, Prev: Scrollbars, Up: Top
-
-Drag and Drop
-*************
-
- _WARNING_: the Drag'n'Drop API is still under development and the
-interface may change! The current implementation is considered
-experimental.
-
- Drag'n'drop is a way to transfer information between multiple
-applications. To do this several GUIs define their own protocols.
-Examples are OffiX, CDE, Motif, KDE, MSWindows, GNOME, and many more.
-To catch all these protocols, XEmacs provides a generic API.
-
- One prime idea behind the API is to use a data interface that is
-transparent for all systems. The author thinks that this is best
-archived by using URL and MIME data, cause any internet enabled system
-must support these for email already. XEmacs also already provides
-powerful interfaces to support these types of data (tm and w3).
-
-* Menu:
-
-* Supported Protocols:: Which low-level protocols are supported.
-* Drop Interface:: How XEmacs handles a drop from another application.
-* Drag Interface:: Calls to initiate a drag from XEmacs.
-
-\1f
-File: lispref.info, Node: Supported Protocols, Next: Drop Interface, Up: Drag and Drop
+File: lispref.info, Node: Gutter, Next: Scrollbars, Prev: Toolbar, Up: Top
-Supported Protocols
-===================
+Gutter
+******
- The current release of XEmacs only support a small set of Drag'n'drop
-protocols. Some of these only support limited options available in the
-API.
+ A gutter is a rectangle displayed along one edge of a frame. It can
+contain arbitrary text or graphics.
* Menu:
-* OffiX DND:: A generic X based protocol.
-* CDE dt:: Common Desktop Environment used on suns.
-* MSWindows OLE:: Mr. Gates way of live.
-* Loose ends:: The other protocols.
-
-\1f
-File: lispref.info, Node: OffiX DND, Next: CDE dt, Up: Supported Protocols
-
-OffiX DND
----------
-
- _WARNING_: If you compile in OffiX, you may not be able to use
-multiple X displays successfully. If the two servers are from
-different vendors, the results may be unpredictable.
-
- The OffiX Drag'n'Drop protocol is part of a X API/Widget library
-created by Cesar Crusius. It is based on X-Atoms and ClientMessage
-events, and works with any X platform supporting them.
-
- OffiX is supported if 'offix is member of the variable
-dragdrop-protocols, or the feature 'offix is defined.
-
- Unfortunately it uses it's own data types. Examples are: File, Files,
-Exe, Link, URL, MIME. The API tries to choose the right type for the
-data that is dragged from XEmacs (well, not yet...).
-
- XEmacs supports both MIME and URL drags and drops using this API. No
-application interaction is possible while dragging is in progress.
-
- For information about the OffiX project have a look at
-http://leb.net/~offix/
-
-\1f
-File: lispref.info, Node: CDE dt, Next: MSWindows OLE, Prev: OffiX DND, Up: Supported Protocols
-
-CDE dt
-------
-
- CDE stands for Common Desktop Environment. It is based on the Motif
-widget library. It's drag'n'drop protocol is also an abstraction of the
-Motif protocol (so it might be possible, that XEmacs will also support
-the Motif protocol soon).
-
- CDE has three different types: file, buffer, and text. XEmacs only
-uses file and buffer drags. The API will disallow full URL drags, only
-file method URLs are passed through.
-
- Buffer drags are always converted to plain text.
-
-\1f
-File: lispref.info, Node: MSWindows OLE, Next: Loose ends, Prev: CDE dt, Up: Supported Protocols
-
-MSWindows OLE
--------------
-
- Only allows file drags and drops.
-
-\1f
-File: lispref.info, Node: Loose ends, Prev: MSWindows OLE, Up: Supported Protocols
-
-Loose ends
-----------
-
- The following protocols will be supported soon: Xdnd, Motif, Xde (if
-I get some specs), KDE OffiX (if KDE can find XEmacs windows).
-
- In particular Xdnd will be one of the protocols that can benefit from
-the XEmacs API, cause it also uses MIME types to encode dragged data.
-
-\1f
-File: lispref.info, Node: Drop Interface, Next: Drag Interface, Prev: Supported Protocols, Up: Drag and Drop
-
-Drop Interface
-==============
-
- For each activated low-level protocol, a internal routine will catch
-incoming drops and convert them to a dragdrop-drop type misc-user-event.
-
- This misc-user-event has its function argument set to
-`dragdrop-drop-dispatch' and the object contains the data of the drop
-(converted to URL/MIME specific data). This function will search the
-variable `experimental-dragdrop-drop-functions' for a function that can
-handle the dropped data.
-
- To modify the drop behavior, the user can modify the variable
-`experimental-dragdrop-drop-functions'. Each element of this list
-specifies a possible handler for dropped data. The first one that can
-handle the data will return `t' and exit. Another possibility is to set
-a extent-property with the same name. Extents are checked prior to the
-variable.
-
- The customization group `drag-n-drop' shows all variables of user
-interest.
-
-\1f
-File: lispref.info, Node: Drag Interface, Prev: Drop Interface, Up: Drag and Drop
-
-Drag Interface
-==============
-
- This describes the drag API (not implemented yet).
-
-\1f
-File: lispref.info, Node: Modes, Next: Documentation, Prev: Drag and Drop, Up: Top
-
-Major and Minor Modes
-*********************
-
- A "mode" is a set of definitions that customize XEmacs and can be
-turned on and off while you edit. There are two varieties of modes:
-"major modes", which are mutually exclusive and used for editing
-particular kinds of text, and "minor modes", which provide features
-that users can enable individually.
-
- This chapter describes how to write both major and minor modes, how
-to indicate them in the modeline, and how they run hooks supplied by the
-user. For related topics such as keymaps and syntax tables, see *Note
-Keymaps::, and *Note Syntax Tables::.
-
-* Menu:
-
-* Major Modes:: Defining major modes.
-* Minor Modes:: Defining minor modes.
-* Modeline Format:: Customizing the text that appears in the modeline.
-* Hooks:: How to use hooks; how to write code that provides hooks.
-
-\1f
-File: lispref.info, Node: Major Modes, Next: Minor Modes, Up: Modes
-
-Major Modes
-===========
-
- Major modes specialize XEmacs for editing particular kinds of text.
-Each buffer has only one major mode at a time.
-
- The least specialized major mode is called "Fundamental mode". This
-mode has no mode-specific definitions or variable settings, so each
-XEmacs command behaves in its default manner, and each option is in its
-default state. All other major modes redefine various keys and options.
-For example, Lisp Interaction mode provides special key bindings for
-<LFD> (`eval-print-last-sexp'), <TAB> (`lisp-indent-line'), and other
-keys.
-
- When you need to write several editing commands to help you perform a
-specialized editing task, creating a new major mode is usually a good
-idea. In practice, writing a major mode is easy (in contrast to
-writing a minor mode, which is often difficult).
-
- If the new mode is similar to an old one, it is often unwise to
-modify the old one to serve two purposes, since it may become harder to
-use and maintain. Instead, copy and rename an existing major mode
-definition and alter the copy--or define a "derived mode" (*note
-Derived Modes::). For example, Rmail Edit mode, which is in
-`emacs/lisp/rmailedit.el', is a major mode that is very similar to Text
-mode except that it provides three additional commands. Its definition
-is distinct from that of Text mode, but was derived from it.
-
- Rmail Edit mode is an example of a case where one piece of text is
-put temporarily into a different major mode so it can be edited in a
-different way (with ordinary XEmacs commands rather than Rmail). In
-such cases, the temporary major mode usually has a command to switch
-back to the buffer's usual mode (Rmail mode, in this case). You might
-be tempted to present the temporary redefinitions inside a recursive
-edit and restore the usual ones when the user exits; but this is a bad
-idea because it constrains the user's options when it is done in more
-than one buffer: recursive edits must be exited most-recently-entered
-first. Using alternative major modes avoids this limitation. *Note
-Recursive Editing::.
-
- The standard XEmacs Lisp library directory contains the code for
-several major modes, in files including `text-mode.el', `texinfo.el',
-`lisp-mode.el', `c-mode.el', and `rmail.el'. You can look at these
-libraries to see how modes are written. Text mode is perhaps the
-simplest major mode aside from Fundamental mode. Rmail mode is a
-complicated and specialized mode.
-
-* Menu:
-
-* Major Mode Conventions:: Coding conventions for keymaps, etc.
-* Example Major Modes:: Text mode and Lisp modes.
-* Auto Major Mode:: How XEmacs chooses the major mode automatically.
-* Mode Help:: Finding out how to use a mode.
-* Derived Modes:: Defining a new major mode based on another major
- mode.
-
-\1f
-File: lispref.info, Node: Major Mode Conventions, Next: Example Major Modes, Up: Major Modes
-
-Major Mode Conventions
-----------------------
-
- The code for existing major modes follows various coding conventions,
-including conventions for local keymap and syntax table initialization,
-global names, and hooks. Please follow these conventions when you
-define a new major mode:
-
- * Define a command whose name ends in `-mode', with no arguments,
- that switches to the new mode in the current buffer. This command
- should set up the keymap, syntax table, and local variables in an
- existing buffer without changing the buffer's text.
-
- * Write a documentation string for this command that describes the
- special commands available in this mode. `C-h m'
- (`describe-mode') in your mode will display this string.
-
- The documentation string may include the special documentation
- substrings, `\[COMMAND]', `\{KEYMAP}', and `\<KEYMAP>', that
- enable the documentation to adapt automatically to the user's own
- key bindings. *Note Keys in Documentation::.
-
- * The major mode command should start by calling
- `kill-all-local-variables'. This is what gets rid of the local
- variables of the major mode previously in effect.
-
- * The major mode command should set the variable `major-mode' to the
- major mode command symbol. This is how `describe-mode' discovers
- which documentation to print.
-
- * The major mode command should set the variable `mode-name' to the
- "pretty" name of the mode, as a string. This appears in the mode
- line.
-
- * Since all global names are in the same name space, all the global
- variables, constants, and functions that are part of the mode
- should have names that start with the major mode name (or with an
- abbreviation of it if the name is long). *Note Style Tips::.
-
- * The major mode should usually have its own keymap, which is used
- as the local keymap in all buffers in that mode. The major mode
- function should call `use-local-map' to install this local map.
- *Note Active Keymaps::, for more information.
-
- This keymap should be kept in a global variable named
- `MODENAME-mode-map'. Normally the library that defines the mode
- sets this variable.
-
- * The mode may have its own syntax table or may share one with other
- related modes. If it has its own syntax table, it should store
- this in a variable named `MODENAME-mode-syntax-table'. *Note
- Syntax Tables::.
-
- * The mode may have its own abbrev table or may share one with other
- related modes. If it has its own abbrev table, it should store
- this in a variable named `MODENAME-mode-abbrev-table'. *Note
- Abbrev Tables::.
-
- * Use `defvar' to set mode-related variables, so that they are not
- reinitialized if they already have a value. (Such reinitialization
- could discard customizations made by the user.)
-
- * To make a buffer-local binding for an Emacs customization
- variable, use `make-local-variable' in the major mode command, not
- `make-variable-buffer-local'. The latter function would make the
- variable local to every buffer in which it is subsequently set,
- which would affect buffers that do not use this mode. It is
- undesirable for a mode to have such global effects. *Note
- Buffer-Local Variables::.
-
- It's ok to use `make-variable-buffer-local', if you wish, for a
- variable used only within a single Lisp package.
-
- * Each major mode should have a "mode hook" named
- `MODENAME-mode-hook'. The major mode command should run that
- hook, with `run-hooks', as the very last thing it does. *Note
- Hooks::.
-
- * The major mode command may also run the hooks of some more basic
- modes. For example, `indented-text-mode' runs `text-mode-hook' as
- well as `indented-text-mode-hook'. It may run these other hooks
- immediately before the mode's own hook (that is, after everything
- else), or it may run them earlier.
-
- * If something special should be done if the user switches a buffer
- from this mode to any other major mode, the mode can set a local
- value for `change-major-mode-hook'.
-
- * If this mode is appropriate only for specially-prepared text, then
- the major mode command symbol should have a property named
- `mode-class' with value `special', put on as follows:
-
- (put 'funny-mode 'mode-class 'special)
-
- This tells XEmacs that new buffers created while the current
- buffer has Funny mode should not inherit Funny mode. Modes such
- as Dired, Rmail, and Buffer List use this feature.
-
- * If you want to make the new mode the default for files with certain
- recognizable names, add an element to `auto-mode-alist' to select
- the mode for those file names. If you define the mode command to
- autoload, you should add this element in the same file that calls
- `autoload'. Otherwise, it is sufficient to add the element in the
- file that contains the mode definition. *Note Auto Major Mode::.
-
- * In the documentation, you should provide a sample `autoload' form
- and an example of how to add to `auto-mode-alist', that users can
- include in their `.emacs' files.
-
- * The top-level forms in the file defining the mode should be
- written so that they may be evaluated more than once without
- adverse consequences. Even if you never load the file more than
- once, someone else will.
-
- - Variable: change-major-mode-hook
- This normal hook is run by `kill-all-local-variables' before it
- does anything else. This gives major modes a way to arrange for
- something special to be done if the user switches to a different
- major mode. For best results, make this variable buffer-local, so
- that it will disappear after doing its job and will not interfere
- with the subsequent major mode. *Note Hooks::.
-
-\1f
-File: lispref.info, Node: Example Major Modes, Next: Auto Major Mode, Prev: Major Mode Conventions, Up: Major Modes
-
-Major Mode Examples
--------------------
-
- Text mode is perhaps the simplest mode besides Fundamental mode.
-Here are excerpts from `text-mode.el' that illustrate many of the
-conventions listed above:
-
- ;; Create mode-specific tables.
- (defvar text-mode-syntax-table nil
- "Syntax table used while in text mode.")
-
- (if text-mode-syntax-table
- () ; Do not change the table if it is already set up.
- (setq text-mode-syntax-table (make-syntax-table))
- (modify-syntax-entry ?\" ". " text-mode-syntax-table)
- (modify-syntax-entry ?\\ ". " text-mode-syntax-table)
- (modify-syntax-entry ?' "w " text-mode-syntax-table))
-
- (defvar text-mode-abbrev-table nil
- "Abbrev table used while in text mode.")
- (define-abbrev-table 'text-mode-abbrev-table ())
-
- (defvar text-mode-map nil) ; Create a mode-specific keymap.
-
- (if text-mode-map
- () ; Do not change the keymap if it is already set up.
- (setq text-mode-map (make-sparse-keymap))
- (define-key text-mode-map "\t" 'tab-to-tab-stop)
- (define-key text-mode-map "\es" 'center-line)
- (define-key text-mode-map "\eS" 'center-paragraph))
-
- Here is the complete major mode function definition for Text mode:
-
- (defun text-mode ()
- "Major mode for editing text intended for humans to read.
- Special commands: \\{text-mode-map}
- Turning on text-mode runs the hook `text-mode-hook'."
- (interactive)
- (kill-all-local-variables)
- (use-local-map text-mode-map) ; This provides the local keymap.
- (setq mode-name "Text") ; This name goes into the modeline.
- (setq major-mode 'text-mode) ; This is how `describe-mode'
- ; finds the doc string to print.
- (setq local-abbrev-table text-mode-abbrev-table)
- (set-syntax-table text-mode-syntax-table)
- (run-hooks 'text-mode-hook)) ; Finally, this permits the user to
- ; customize the mode with a hook.
-
- The three Lisp modes (Lisp mode, Emacs Lisp mode, and Lisp
-Interaction mode) have more features than Text mode and the code is
-correspondingly more complicated. Here are excerpts from
-`lisp-mode.el' that illustrate how these modes are written.
-
- ;; Create mode-specific table variables.
- (defvar lisp-mode-syntax-table nil "")
- (defvar emacs-lisp-mode-syntax-table nil "")
- (defvar lisp-mode-abbrev-table nil "")
-
- (if (not emacs-lisp-mode-syntax-table) ; Do not change the table
- ; if it is already set.
- (let ((i 0))
- (setq emacs-lisp-mode-syntax-table (make-syntax-table))
-
- ;; Set syntax of chars up to 0 to class of chars that are
- ;; part of symbol names but not words.
- ;; (The number 0 is `48' in the ASCII character set.)
- (while (< i ?0)
- (modify-syntax-entry i "_ " emacs-lisp-mode-syntax-table)
- (setq i (1+ i)))
- ...
- ;; Set the syntax for other characters.
- (modify-syntax-entry ? " " emacs-lisp-mode-syntax-table)
- (modify-syntax-entry ?\t " " emacs-lisp-mode-syntax-table)
- ...
- (modify-syntax-entry ?\( "() " emacs-lisp-mode-syntax-table)
- (modify-syntax-entry ?\) ")( " emacs-lisp-mode-syntax-table)
- ...))
- ;; Create an abbrev table for lisp-mode.
- (define-abbrev-table 'lisp-mode-abbrev-table ())
-
- Much code is shared among the three Lisp modes. The following
-function sets various variables; it is called by each of the major Lisp
-mode functions:
-
- (defun lisp-mode-variables (lisp-syntax)
- ;; The `lisp-syntax' argument is `nil' in Emacs Lisp mode,
- ;; and `t' in the other two Lisp modes.
- (cond (lisp-syntax
- (if (not lisp-mode-syntax-table)
- ;; The Emacs Lisp mode syntax table always exists, but
- ;; the Lisp Mode syntax table is created the first time a
- ;; mode that needs it is called. This is to save space.
- (progn (setq lisp-mode-syntax-table
- (copy-syntax-table emacs-lisp-mode-syntax-table))
- ;; Change some entries for Lisp mode.
- (modify-syntax-entry ?\| "\" "
- lisp-mode-syntax-table)
- (modify-syntax-entry ?\[ "_ "
- lisp-mode-syntax-table)
- (modify-syntax-entry ?\] "_ "
- lisp-mode-syntax-table)))
- (set-syntax-table lisp-mode-syntax-table)))
- (setq local-abbrev-table lisp-mode-abbrev-table)
- ...)
-
- Functions such as `forward-paragraph' use the value of the
-`paragraph-start' variable. Since Lisp code is different from ordinary
-text, the `paragraph-start' variable needs to be set specially to
-handle Lisp. Also, comments are indented in a special fashion in Lisp
-and the Lisp modes need their own mode-specific
-`comment-indent-function'. The code to set these variables is the rest
-of `lisp-mode-variables'.
-
- (make-local-variable 'paragraph-start)
- ;; Having `^' is not clean, but `page-delimiter'
- ;; has them too, and removing those is a pain.
- (setq paragraph-start (concat "^$\\|" page-delimiter))
- ...
- (make-local-variable 'comment-indent-function)
- (setq comment-indent-function 'lisp-comment-indent))
-
- Each of the different Lisp modes has a slightly different keymap.
-For example, Lisp mode binds `C-c C-l' to `run-lisp', but the other
-Lisp modes do not. However, all Lisp modes have some commands in
-common. The following function adds these common commands to a given
-keymap.
-
- (defun lisp-mode-commands (map)
- (define-key map "\e\C-q" 'indent-sexp)
- (define-key map "\177" 'backward-delete-char-untabify)
- (define-key map "\t" 'lisp-indent-line))
-
- Here is an example of using `lisp-mode-commands' to initialize a
-keymap, as part of the code for Emacs Lisp mode. First we declare a
-variable with `defvar' to hold the mode-specific keymap. When this
-`defvar' executes, it sets the variable to `nil' if it was void. Then
-we set up the keymap if the variable is `nil'.
-
- This code avoids changing the keymap or the variable if it is already
-set up. This lets the user customize the keymap.
-
- (defvar emacs-lisp-mode-map () "")
- (if emacs-lisp-mode-map
- ()
- (setq emacs-lisp-mode-map (make-sparse-keymap))
- (define-key emacs-lisp-mode-map "\e\C-x" 'eval-defun)
- (lisp-mode-commands emacs-lisp-mode-map))
-
- Finally, here is the complete major mode function definition for
-Emacs Lisp mode.
-
- (defun emacs-lisp-mode ()
- "Major mode for editing Lisp code to run in XEmacs.
- Commands:
- Delete converts tabs to spaces as it moves back.
- Blank lines separate paragraphs. Semicolons start comments.
- \\{emacs-lisp-mode-map}
- Entry to this mode runs the hook `emacs-lisp-mode-hook'."
- (interactive)
- (kill-all-local-variables)
- (use-local-map emacs-lisp-mode-map) ; This provides the local keymap.
- (set-syntax-table emacs-lisp-mode-syntax-table)
- (setq major-mode 'emacs-lisp-mode) ; This is how `describe-mode'
- ; finds out what to describe.
- (setq mode-name "Emacs-Lisp") ; This goes into the modeline.
- (lisp-mode-variables nil) ; This defines various variables.
- (run-hooks 'emacs-lisp-mode-hook)) ; This permits the user to use a
- ; hook to customize the mode.
+* Gutter Intro:: An introduction.
+* Creating Gutter:: How to create a gutter.
+* Gutter Descriptor Format:: Accessing and modifying a gutter's
+ properties.
+* Specifying a Gutter:: Setting a gutter's contents.
+* Other Gutter Variables:: Controlling the size of gutters.
+* Common Gutter Widgets:: Things to put in gutters.