/[emacs]/emacs/lispref/modes.texi
ViewVC logotype

Diff of /emacs/lispref/modes.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.106 by teirllm, Wed May 18 16:50:23 2005 UTC revision 1.107 by teirllm, Thu May 19 23:35:18 2005 UTC
# Line 88  in Lisp Interaction mode: Line 88  in Lisp Interaction mode:
88  @end example  @end example
89    
90    At the appropriate time, Emacs uses the @code{run-hooks} function to    At the appropriate time, Emacs uses the @code{run-hooks} function to
91  run particular hooks.  This function calls the hook functions that have  run particular hooks.
 been added with @code{add-hook}.  
92    
93  @defun run-hooks &rest hookvars  @defun run-hooks &rest hookvars
94  This function takes one or more normal hook variable names as  This function takes one or more normal hook variable names as
# Line 470  and Buffer List use this feature. Line 469  and Buffer List use this feature.
469  @item  @item
470  If you want to make the new mode the default for files with certain  If you want to make the new mode the default for files with certain
471  recognizable names, add an element to @code{auto-mode-alist} to select  recognizable names, add an element to @code{auto-mode-alist} to select
472  the mode for those file names.  If you define the mode command to  the mode for those file names (@pxref{Auto Major Mode}).  If you
473  autoload, you should add this element in the same file that calls  define the mode command to autoload, you should add this element in
474  @code{autoload}.  If you use an autoload cookie for the mode command,  the same file that calls @code{autoload}.  If you use an autoload
475  you can also use an autoload cookie for the form that adds the element  cookie for the mode command, you can also use an autoload cookie for
476  (@pxref{autoload cookie}).  If you do not autoload the mode command,  the form that adds the element (@pxref{autoload cookie}).  If you do
477  it is sufficient to add the element in the file that contains the mode  not autoload the mode command, it is sufficient to add the element in
478  definition.  @xref{Auto Major Mode}.  the file that contains the mode definition.
479    
480  @item  @item
481  In the comments that document the file, you should provide a sample  In the comments that document the file, you should provide a sample
# Line 1011  The new mode has its own abbrev table, k Line 1010  The new mode has its own abbrev table, k
1010  @item  @item
1011  The new mode has its own mode hook, @code{@var{variant}-hook}.  It  The new mode has its own mode hook, @code{@var{variant}-hook}.  It
1012  runs this hook, after running the hooks of its ancestor modes, with  runs this hook, after running the hooks of its ancestor modes, with
1013  @code{run-mode-hooks} (@pxref{Mode Hooks}).  @code{run-mode-hooks}, as the last thing it does. @xref{Mode Hooks}.
1014  @end itemize  @end itemize
1015    
1016  In addition, you can specify how to override other aspects of  In addition, you can specify how to override other aspects of
1017  @var{parent} with @var{body}.  The command @var{variant}  @var{parent} with @var{body}.  The command @var{variant}
1018  evaluates the forms in @var{body} after setting up all its usual  evaluates the forms in @var{body} after setting up all its usual
1019  overrides, just before running @code{@var{variant}-hook}.  overrides, just before running the mode hooks.
1020    
1021  You can also specify @code{nil} for @var{parent}.  This gives the new  You can also specify @code{nil} for @var{parent}.  This gives the new
1022  mode no parent.  Then @code{define-derived-mode} behaves as described  mode no parent.  Then @code{define-derived-mode} behaves as described
# Line 1262  enable or disable the minor mode based o Line 1261  enable or disable the minor mode based o
1261    
1262  @item  @item
1263  Add an element to @code{minor-mode-alist} for each minor mode  Add an element to @code{minor-mode-alist} for each minor mode
1264  (@pxref{Mode Line Variables}), if you want to indicate the minor mode in  (@pxref{Definition of minor-mode-alist}), if you want to indicate the
1265  the mode line.  This element should be a list of the following form:  minor mode in the mode line.  This element should be a list of the
1266    following form:
1267    
1268  @smallexample  @smallexample
1269  (@var{mode-variable} @var{string})  (@var{mode-variable} @var{string})
# Line 1305  should also specify a @code{:set} method Line 1305  should also specify a @code{:set} method
1305  invoking the mode command.  Note in the variable's documentation string that  invoking the mode command.  Note in the variable's documentation string that
1306  setting the variable other than via Custom may not take effect.  setting the variable other than via Custom may not take effect.
1307    
1308    Also mark the definition with an autoload cookie (@pxref{Autoload}),    Also mark the definition with an autoload cookie (@pxref{autoload cookie}),
1309  and specify a @code{:require} so that customizing the variable will load  and specify a @code{:require} so that customizing the variable will load
1310  the library that defines the mode.  This will copy suitable definitions  the library that defines the mode.  This will copy suitable definitions
1311  into @file{loaddefs.el} so that users can use @code{customize-option} to  into @file{loaddefs.el} so that users can use @code{customize-option} to
# Line 1334  use either \\[customize] or the function Line 1334  use either \\[customize] or the function
1334    
1335    Each minor mode can have its own keymap, which is active when the mode    Each minor mode can have its own keymap, which is active when the mode
1336  is enabled.  To set up a keymap for a minor mode, add an element to the  is enabled.  To set up a keymap for a minor mode, add an element to the
1337  alist @code{minor-mode-map-alist}.  @xref{Active Keymaps}.  alist @code{minor-mode-map-alist}.  @xref{Definition of minor-mode-map-alist}.
1338    
1339  @cindex @code{self-insert-command}, minor modes  @cindex @code{self-insert-command}, minor modes
1340    One use of minor mode keymaps is to modify the behavior of certain    One use of minor mode keymaps is to modify the behavior of certain
# Line 1628  common form of mode-line construct. Line 1628  common form of mode-line construct.
1628    
1629  @item (:eval @var{form})  @item (:eval @var{form})
1630  A list whose first element is the symbol @code{:eval} says to evaluate  A list whose first element is the symbol @code{:eval} says to evaluate
1631  @var{form}, and use the result as a string to display.  @var{form}, and use the result as a string to display.  Make sure this
1632    evaluation cannot load any files, as doing so could cause infinite
1633    recursion.
1634    
1635  @item (:propertize @var{elt} @var{props}@dots{})  @item (:propertize @var{elt} @var{props}@dots{})
1636  A list whose first element is the symbol @code{:propertize} says to  A list whose first element is the symbol @code{:propertize} says to
# Line 1650  the value of @var{symbol} is @code{nil}. Line 1652  the value of @var{symbol} is @code{nil}.
1652  A list whose first element is an integer specifies truncation or  A list whose first element is an integer specifies truncation or
1653  padding of the results of @var{rest}.  The remaining elements  padding of the results of @var{rest}.  The remaining elements
1654  @var{rest} are processed recursively as mode-line constructs and  @var{rest} are processed recursively as mode-line constructs and
1655  concatenated together.  Then the result is space filled (if  concatenated together.  When @var{width} is positive, the result is
1656  @var{width} is positive) or truncated (to @minus{}@var{width} columns,  space filled on the right if its width is less than @var{width}.  When
1657  if @var{width} is negative) on the right.  @var{width} is negative, the result is truncated on the right to
1658    @minus{}@var{width} columns if its width exceeds @minus{}@var{width}.
1659    
1660  For example, the usual way to show what percentage of a buffer is above  For example, the usual way to show what percentage of a buffer is above
1661  the top of the window is to use a list like this: @code{(-3 "%p")}.  the top of the window is to use a list like this: @code{(-3 "%p")}.
# Line 1818  is @code{nil}. Line 1821  is @code{nil}.
1821  @end defvar  @end defvar
1822    
1823  @defvar minor-mode-alist  @defvar minor-mode-alist
1824    @anchor{Definition of minor-mode-alist}
1825  This variable holds an association list whose elements specify how the  This variable holds an association list whose elements specify how the
1826  mode line should indicate that a minor mode is active.  Each element of  mode line should indicate that a minor mode is active.  Each element of
1827  the @code{minor-mode-alist} should be a two-element list:  the @code{minor-mode-alist} should be a two-element list:
# Line 1889  specifies addition of text properties. Line 1893  specifies addition of text properties.
1893    
1894    The following table lists the recognized @code{%}-constructs and what    The following table lists the recognized @code{%}-constructs and what
1895  they mean.  In any construct except @samp{%%}, you can add a decimal  they mean.  In any construct except @samp{%%}, you can add a decimal
1896  integer after the @samp{%} to specify how many characters to display.  integer after the @samp{%} to specify a minimum field width.  If the
1897    width is less, the field is padded with spaces to the right.
1898    
1899  @table @code  @table @code
1900  @item %b  @item %b
# Line 1994  The value of @code{global-mode-string}. Line 1999  The value of @code{global-mode-string}.
1999    
2000    Certain text properties are meaningful in the    Certain text properties are meaningful in the
2001  mode line.  The @code{face} property affects the appearance of text; the  mode line.  The @code{face} property affects the appearance of text; the
2002  @code{help-echo} property associate help strings with the text, and  @code{help-echo} property associates help strings with the text, and
2003  @code{local-map} can make the text mouse-sensitive.  @code{local-map} can make the text mouse-sensitive.
2004    
2005    There are four ways to specify text properties for text in the mode    There are four ways to specify text properties for text in the mode
# Line 2062  It is normally @code{nil}, so that ordin Line 2067  It is normally @code{nil}, so that ordin
2067    
2068    You can use the function @code{format-mode-line} to compute    You can use the function @code{format-mode-line} to compute
2069  the text that would appear in a mode line or header line  the text that would appear in a mode line or header line
2070  based on certain mode-line specification.  based on a certain mode-line specification.
2071    
2072  @defun format-mode-line format &optional face window buffer  @defun format-mode-line format &optional face window buffer
2073  This function formats a line of text according to @var{format} as if  This function formats a line of text according to @var{format} as if
# Line 2078  faces, keymaps, etc., that the mode line Line 2083  faces, keymaps, etc., that the mode line
2083  for which no @code{face} property is specified gets a default  for which no @code{face} property is specified gets a default
2084  value which is usually @var{face}.  (If @var{face} is @code{t},  value which is usually @var{face}.  (If @var{face} is @code{t},
2085  that stands for either @code{mode-line} if @var{window} is selected,  that stands for either @code{mode-line} if @var{window} is selected,
2086  otherwise @code{mode-line-inactive}.)  otherwise @code{mode-line-inactive}.  If @var{face} is @code{nil} or
2087    omitted, that stands for no face property.)
2088    
2089  However, if @var{face} is an integer, the value has no text properties.  However, if @var{face} is an integer, the value has no text properties.
2090    

Legend:
Removed from v.1.106  
changed lines
  Added in v.1.107

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26