Mercurial > emacs
comparison doc/lispref/modes.texi @ 102766:0862f6b10c6b
(Derived Modes): Note that define-derive-mode sets the mode-class
property.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 28 Mar 2009 13:49:57 +0000 |
parents | e81a0c5f14b1 |
children | 58dbb2780124 |
comparison
equal
deleted
inserted
replaced
102765:7d96b18494ca | 102766:0862f6b10c6b |
---|---|
736 | 736 |
737 It's often useful to define a new major mode in terms of an existing | 737 It's often useful to define a new major mode in terms of an existing |
738 one. An easy way to do this is to use @code{define-derived-mode}. | 738 one. An easy way to do this is to use @code{define-derived-mode}. |
739 | 739 |
740 @defmac define-derived-mode variant parent name docstring keyword-args@dots{} body@dots{} | 740 @defmac define-derived-mode variant parent name docstring keyword-args@dots{} body@dots{} |
741 This construct defines @var{variant} as a major mode command, using | 741 This macro defines @var{variant} as a major mode command, using |
742 @var{name} as the string form of the mode name. @var{variant} and | 742 @var{name} as the string form of the mode name. @var{variant} and |
743 @var{parent} should be unquoted symbols. | 743 @var{parent} should be unquoted symbols. |
744 | 744 |
745 The new command @var{variant} is defined to call the function | 745 The new command @var{variant} is defined to call the function |
746 @var{parent}, then override certain aspects of that parent mode: | 746 @var{parent}, then override certain aspects of that parent mode: |
773 | 773 |
774 In addition, you can specify how to override other aspects of | 774 In addition, you can specify how to override other aspects of |
775 @var{parent} with @var{body}. The command @var{variant} | 775 @var{parent} with @var{body}. The command @var{variant} |
776 evaluates the forms in @var{body} after setting up all its usual | 776 evaluates the forms in @var{body} after setting up all its usual |
777 overrides, just before running the mode hooks. | 777 overrides, just before running the mode hooks. |
778 | |
779 If @var{parent} has a non-@code{nil} @code{mode-class} symbol | |
780 property, then @code{define-derived-mode} sets the @code{mode-class} | |
781 property of @var{variant} to the same value. This ensures, for | |
782 example, that if @var{parent} is a special mode, then @var{variant} is | |
783 also a special mode (@pxref{Major Mode Conventions}). | |
778 | 784 |
779 You can also specify @code{nil} for @var{parent}. This gives the new | 785 You can also specify @code{nil} for @var{parent}. This gives the new |
780 mode no parent. Then @code{define-derived-mode} behaves as described | 786 mode no parent. Then @code{define-derived-mode} behaves as described |
781 above, but, of course, omits all actions connected with @var{parent}. | 787 above, but, of course, omits all actions connected with @var{parent}. |
782 | 788 |