diff options
| author | Kenichi Handa | 2010-12-02 09:44:25 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2010-12-02 09:44:25 +0900 |
| commit | 423a637bdbb746e112c5584e259bf28c5402901d (patch) | |
| tree | 4ad9b32418e59697854bab91ce85e3e276403f69 /doc | |
| parent | 7e116860bbae843e00c29b08919e10fc37f7aaa2 (diff) | |
| parent | 769741e3d1ba0f22dd4619058185f294b3c189ea (diff) | |
| download | emacs-423a637bdbb746e112c5584e259bf28c5402901d.tar.gz emacs-423a637bdbb746e112c5584e259bf28c5402901d.zip | |
merge emacs-23
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/ChangeLog | 7 | ||||
| -rw-r--r-- | doc/lispref/backups.texi | 6 | ||||
| -rw-r--r-- | doc/lispref/modes.texi | 129 | ||||
| -rw-r--r-- | doc/lispref/text.texi | 2 |
4 files changed, 71 insertions, 73 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 959f4844c1c..95973479225 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2010-12-01 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * backups.texi (Making Backups): | ||
| 4 | * modes.texi (Example Major Modes): Use recommended coding style. | ||
| 5 | (Major Mode Basics, Derived Modes): Encourge more strongly use of | ||
| 6 | define-derived-mode. Mention completion-at-point-functions. | ||
| 7 | |||
| 1 | 2010-11-21 Chong Yidong <cyd@stupidchicken.com> | 8 | 2010-11-21 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 9 | ||
| 3 | * nonascii.texi (Converting Representations): Document | 10 | * nonascii.texi (Converting Representations): Document |
diff --git a/doc/lispref/backups.texi b/doc/lispref/backups.texi index 7d6ae233f2b..349d0beb9c7 100644 --- a/doc/lispref/backups.texi +++ b/doc/lispref/backups.texi | |||
| @@ -88,10 +88,8 @@ save disk space. (You would put this code in your init file.) | |||
| 88 | @smallexample | 88 | @smallexample |
| 89 | @group | 89 | @group |
| 90 | (add-hook 'rmail-mode-hook | 90 | (add-hook 'rmail-mode-hook |
| 91 | (function (lambda () | 91 | (lambda () |
| 92 | (make-local-variable | 92 | (set (make-local-variable 'make-backup-files) nil))) |
| 93 | 'make-backup-files) | ||
| 94 | (setq make-backup-files nil)))) | ||
| 95 | @end group | 93 | @end group |
| 96 | @end smallexample | 94 | @end smallexample |
| 97 | @end defopt | 95 | @end defopt |
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 12f16b67663..0ccb4ae04ed 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi | |||
| @@ -20,10 +20,10 @@ user. For related topics such as keymaps and syntax tables, see | |||
| 20 | @ref{Keymaps}, and @ref{Syntax Tables}. | 20 | @ref{Keymaps}, and @ref{Syntax Tables}. |
| 21 | 21 | ||
| 22 | @menu | 22 | @menu |
| 23 | * Hooks:: How to use hooks; how to write code that provides hooks. | 23 | * Hooks:: How to use hooks; how to write code that provides hooks. |
| 24 | * Major Modes:: Defining major modes. | 24 | * Major Modes:: Defining major modes. |
| 25 | * Minor Modes:: Defining minor modes. | 25 | * Minor Modes:: Defining minor modes. |
| 26 | * Mode Line Format:: Customizing the text that appears in the mode line. | 26 | * Mode Line Format:: Customizing the text that appears in the mode line. |
| 27 | * Imenu:: How a mode can provide a menu | 27 | * Imenu:: How a mode can provide a menu |
| 28 | of definitions in the buffer. | 28 | of definitions in the buffer. |
| 29 | * Font Lock Mode:: How modes can highlight text according to syntax. | 29 | * Font Lock Mode:: How modes can highlight text according to syntax. |
| @@ -78,8 +78,8 @@ convention. | |||
| 78 | its value is just a single function, not a list of functions. | 78 | its value is just a single function, not a list of functions. |
| 79 | 79 | ||
| 80 | @menu | 80 | @menu |
| 81 | * Running Hooks:: How to run a hook. | 81 | * Running Hooks:: How to run a hook. |
| 82 | * Setting Hooks:: How to put functions on a hook, or remove them. | 82 | * Setting Hooks:: How to put functions on a hook, or remove them. |
| 83 | @end menu | 83 | @end menu |
| 84 | 84 | ||
| 85 | @node Running Hooks | 85 | @node Running Hooks |
| @@ -199,16 +199,16 @@ buffer, such as a local keymap. The effect lasts until you switch | |||
| 199 | to another major mode in the same buffer. | 199 | to another major mode in the same buffer. |
| 200 | 200 | ||
| 201 | @menu | 201 | @menu |
| 202 | * Major Mode Basics:: | 202 | * Major Mode Basics:: |
| 203 | * Major Mode Conventions:: Coding conventions for keymaps, etc. | 203 | * Major Mode Conventions:: Coding conventions for keymaps, etc. |
| 204 | * Auto Major Mode:: How Emacs chooses the major mode automatically. | 204 | * Auto Major Mode:: How Emacs chooses the major mode automatically. |
| 205 | * Mode Help:: Finding out how to use a mode. | 205 | * Mode Help:: Finding out how to use a mode. |
| 206 | * Derived Modes:: Defining a new major mode based on another major | 206 | * Derived Modes:: Defining a new major mode based on another major |
| 207 | mode. | 207 | mode. |
| 208 | * Generic Modes:: Defining a simple major mode that supports | 208 | * Generic Modes:: Defining a simple major mode that supports |
| 209 | comment syntax and Font Lock mode. | 209 | comment syntax and Font Lock mode. |
| 210 | * Mode Hooks:: Hooks run at the end of major mode functions. | 210 | * Mode Hooks:: Hooks run at the end of major mode functions. |
| 211 | * Example Major Modes:: Text mode and Lisp modes. | 211 | * Example Major Modes:: Text mode and Lisp modes. |
| 212 | @end menu | 212 | @end menu |
| 213 | 213 | ||
| 214 | @node Major Mode Basics | 214 | @node Major Mode Basics |
| @@ -238,9 +238,8 @@ mode except that it provides two additional commands. Its definition | |||
| 238 | is distinct from that of Text mode, but uses that of Text mode. | 238 | is distinct from that of Text mode, but uses that of Text mode. |
| 239 | 239 | ||
| 240 | Even if the new mode is not an obvious derivative of any other mode, | 240 | Even if the new mode is not an obvious derivative of any other mode, |
| 241 | it is convenient to use @code{define-derived-mode} with a @code{nil} | 241 | we recommend to use @code{define-derived-mode}, since it automatically |
| 242 | parent argument, since it automatically enforces the most important | 242 | enforces the most important coding conventions for you. |
| 243 | coding conventions for you. | ||
| 244 | 243 | ||
| 245 | For a very simple programming language major mode that handles | 244 | For a very simple programming language major mode that handles |
| 246 | comments and fontification, you can use @code{define-generic-mode}. | 245 | comments and fontification, you can use @code{define-generic-mode}. |
| @@ -429,6 +428,10 @@ The mode can specify a local value for | |||
| 429 | this mode. | 428 | this mode. |
| 430 | 429 | ||
| 431 | @item | 430 | @item |
| 431 | The mode can specify how to complete various keywords by adding | ||
| 432 | to the special hook @code{completion-at-point-functions}. | ||
| 433 | |||
| 434 | @item | ||
| 432 | Use @code{defvar} or @code{defcustom} to set mode-related variables, so | 435 | Use @code{defvar} or @code{defcustom} to set mode-related variables, so |
| 433 | that they are not reinitialized if they already have a value. (Such | 436 | that they are not reinitialized if they already have a value. (Such |
| 434 | reinitialization could discard customizations made by the user.) | 437 | reinitialization could discard customizations made by the user.) |
| @@ -492,7 +495,7 @@ The @code{define-derived-mode} macro automatically marks the derived | |||
| 492 | mode as special if the parent mode is special. The special mode | 495 | mode as special if the parent mode is special. The special mode |
| 493 | @code{special-mode} provides a convenient parent for other special | 496 | @code{special-mode} provides a convenient parent for other special |
| 494 | modes to inherit from; it sets @code{buffer-read-only} to @code{t}, | 497 | modes to inherit from; it sets @code{buffer-read-only} to @code{t}, |
| 495 | and does nothing else. | 498 | and does little else. |
| 496 | 499 | ||
| 497 | @item | 500 | @item |
| 498 | If you want to make the new mode the default for files with certain | 501 | If you want to make the new mode the default for files with certain |
| @@ -737,8 +740,10 @@ documentation of the major mode. | |||
| 737 | @subsection Defining Derived Modes | 740 | @subsection Defining Derived Modes |
| 738 | @cindex derived mode | 741 | @cindex derived mode |
| 739 | 742 | ||
| 740 | It's often useful to define a new major mode in terms of an existing | 743 | The recommended way to define a new major mode is to derive it |
| 741 | one. An easy way to do this is to use @code{define-derived-mode}. | 744 | from an existing one using @code{define-derived-mode}. If there is no |
| 745 | closely related mode, you can inherit from @code{text-mode}, | ||
| 746 | @code{special-mode}, or in the worst case @code{fundamental-mode}. | ||
| 742 | 747 | ||
| 743 | @defmac define-derived-mode variant parent name docstring keyword-args@dots{} body@dots{} | 748 | @defmac define-derived-mode variant parent name docstring keyword-args@dots{} body@dots{} |
| 744 | This macro defines @var{variant} as a major mode command, using | 749 | This macro defines @var{variant} as a major mode command, using |
| @@ -979,8 +984,7 @@ You can thus get the full benefit of adaptive filling | |||
| 979 | Turning on Text mode runs the normal hook `text-mode-hook'." | 984 | Turning on Text mode runs the normal hook `text-mode-hook'." |
| 980 | @end group | 985 | @end group |
| 981 | @group | 986 | @group |
| 982 | (make-local-variable 'text-mode-variant) | 987 | (set (make-local-variable 'text-mode-variant) t) |
| 983 | (setq text-mode-variant t) | ||
| 984 | ;; @r{These two lines are a feature added recently.} | 988 | ;; @r{These two lines are a feature added recently.} |
| 985 | (set (make-local-variable 'require-final-newline) | 989 | (set (make-local-variable 'require-final-newline) |
| 986 | mode-require-final-newline) | 990 | mode-require-final-newline) |
| @@ -998,9 +1002,8 @@ the default value, and we'll delete it in a future version.) | |||
| 998 | @smallexample | 1002 | @smallexample |
| 999 | @group | 1003 | @group |
| 1000 | ;; @r{This isn't needed nowadays, since @code{define-derived-mode} does it.} | 1004 | ;; @r{This isn't needed nowadays, since @code{define-derived-mode} does it.} |
| 1001 | (defvar text-mode-abbrev-table nil | 1005 | (define-abbrev-table 'text-mode-abbrev-table () |
| 1002 | "Abbrev table used while in text mode.") | 1006 | "Abbrev table used while in text mode.") |
| 1003 | (define-abbrev-table 'text-mode-abbrev-table ()) | ||
| 1004 | @end group | 1007 | @end group |
| 1005 | 1008 | ||
| 1006 | @group | 1009 | @group |
| @@ -1022,12 +1025,10 @@ Turning on text-mode runs the hook `text-mode-hook'." | |||
| 1022 | ;; @r{These four lines are absent from the current version} | 1025 | ;; @r{These four lines are absent from the current version} |
| 1023 | ;; @r{not because this is done some other way, but rather} | 1026 | ;; @r{not because this is done some other way, but rather} |
| 1024 | ;; @r{because nowadays Text mode uses the normal definition of paragraphs.} | 1027 | ;; @r{because nowadays Text mode uses the normal definition of paragraphs.} |
| 1025 | (make-local-variable 'paragraph-start) | 1028 | (set (make-local-variable 'paragraph-start) |
| 1026 | (setq paragraph-start (concat "[ \t]*$\\|" page-delimiter)) | 1029 | (concat "[ \t]*$\\|" page-delimiter)) |
| 1027 | (make-local-variable 'paragraph-separate) | 1030 | (set (make-local-variable 'paragraph-separate) paragraph-start) |
| 1028 | (setq paragraph-separate paragraph-start) | 1031 | (set (make-local-variable 'indent-line-function) 'indent-relative-maybe) |
| 1029 | (make-local-variable 'indent-line-function) | ||
| 1030 | (setq indent-line-function 'indent-relative-maybe) | ||
| 1031 | @end group | 1032 | @end group |
| 1032 | @group | 1033 | @group |
| 1033 | (setq mode-name "Text") | 1034 | (setq mode-name "Text") |
| @@ -1115,15 +1116,12 @@ modes should understand the Lisp conventions for comments. The rest of | |||
| 1115 | 1116 | ||
| 1116 | @smallexample | 1117 | @smallexample |
| 1117 | @group | 1118 | @group |
| 1118 | (make-local-variable 'paragraph-start) | 1119 | (set (make-local-variable 'paragraph-start) (concat page-delimiter "\\|$" )) |
| 1119 | (setq paragraph-start (concat page-delimiter "\\|$" )) | 1120 | (set (make-local-variable 'paragraph-separate) paragraph-start) |
| 1120 | (make-local-variable 'paragraph-separate) | ||
| 1121 | (setq paragraph-separate paragraph-start) | ||
| 1122 | @dots{} | 1121 | @dots{} |
| 1123 | @end group | 1122 | @end group |
| 1124 | @group | 1123 | @group |
| 1125 | (make-local-variable 'comment-indent-function) | 1124 | (set (make-local-variable 'comment-indent-function) 'lisp-comment-indent)) |
| 1126 | (setq comment-indent-function 'lisp-comment-indent)) | ||
| 1127 | @dots{} | 1125 | @dots{} |
| 1128 | @end group | 1126 | @end group |
| 1129 | @end smallexample | 1127 | @end smallexample |
| @@ -1135,16 +1133,13 @@ common. The following code sets up the common commands: | |||
| 1135 | 1133 | ||
| 1136 | @smallexample | 1134 | @smallexample |
| 1137 | @group | 1135 | @group |
| 1138 | (defvar shared-lisp-mode-map () | 1136 | (defvar shared-lisp-mode-map |
| 1137 | (let ((map (make-sparse-keymap))) | ||
| 1138 | (define-key shared-lisp-mode-map "\e\C-q" 'indent-sexp) | ||
| 1139 | (define-key shared-lisp-mode-map "\177" | ||
| 1140 | 'backward-delete-char-untabify) | ||
| 1141 | map) | ||
| 1139 | "Keymap for commands shared by all sorts of Lisp modes.") | 1142 | "Keymap for commands shared by all sorts of Lisp modes.") |
| 1140 | |||
| 1141 | ;; @r{Putting this @code{if} after the @code{defvar} is an older style.} | ||
| 1142 | (if shared-lisp-mode-map | ||
| 1143 | () | ||
| 1144 | (setq shared-lisp-mode-map (make-sparse-keymap)) | ||
| 1145 | (define-key shared-lisp-mode-map "\e\C-q" 'indent-sexp) | ||
| 1146 | (define-key shared-lisp-mode-map "\177" | ||
| 1147 | 'backward-delete-char-untabify)) | ||
| 1148 | @end group | 1143 | @end group |
| 1149 | @end smallexample | 1144 | @end smallexample |
| 1150 | 1145 | ||
| @@ -1153,15 +1148,13 @@ And here is the code to set up the keymap for Lisp mode: | |||
| 1153 | 1148 | ||
| 1154 | @smallexample | 1149 | @smallexample |
| 1155 | @group | 1150 | @group |
| 1156 | (defvar lisp-mode-map () | 1151 | (defvar lisp-mode-map |
| 1152 | (let ((map (make-sparse-keymap))) | ||
| 1153 | (set-keymap-parent map shared-lisp-mode-map) | ||
| 1154 | (define-key map "\e\C-x" 'lisp-eval-defun) | ||
| 1155 | (define-key map "\C-c\C-z" 'run-lisp) | ||
| 1156 | map) | ||
| 1157 | "Keymap for ordinary Lisp mode...") | 1157 | "Keymap for ordinary Lisp mode...") |
| 1158 | |||
| 1159 | (if lisp-mode-map | ||
| 1160 | () | ||
| 1161 | (setq lisp-mode-map (make-sparse-keymap)) | ||
| 1162 | (set-keymap-parent lisp-mode-map shared-lisp-mode-map) | ||
| 1163 | (define-key lisp-mode-map "\e\C-x" 'lisp-eval-defun) | ||
| 1164 | (define-key lisp-mode-map "\C-c\C-z" 'run-lisp)) | ||
| 1165 | @end group | 1158 | @end group |
| 1166 | @end smallexample | 1159 | @end smallexample |
| 1167 | 1160 | ||
| @@ -1192,11 +1185,9 @@ if that value is non-nil." | |||
| 1192 | ; @r{finds out what to describe.} | 1185 | ; @r{finds out what to describe.} |
| 1193 | (setq mode-name "Lisp") ; @r{This goes into the mode line.} | 1186 | (setq mode-name "Lisp") ; @r{This goes into the mode line.} |
| 1194 | (lisp-mode-variables t) ; @r{This defines various variables.} | 1187 | (lisp-mode-variables t) ; @r{This defines various variables.} |
| 1195 | (make-local-variable 'comment-start-skip) | 1188 | (set (make-local-variable 'comment-start-skip) |
| 1196 | (setq comment-start-skip | 1189 | "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") |
| 1197 | "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") | 1190 | (set (make-local-variable 'font-lock-keywords-case-fold-search) t) |
| 1198 | (make-local-variable 'font-lock-keywords-case-fold-search) | ||
| 1199 | (setq font-lock-keywords-case-fold-search t) | ||
| 1200 | @end group | 1191 | @end group |
| 1201 | @group | 1192 | @group |
| 1202 | (setq imenu-case-fold-search t) | 1193 | (setq imenu-case-fold-search t) |
| @@ -1580,14 +1571,14 @@ information displayed in the mode line relates to the enabled major and | |||
| 1580 | minor modes. | 1571 | minor modes. |
| 1581 | 1572 | ||
| 1582 | @menu | 1573 | @menu |
| 1583 | * Base: Mode Line Basics. Basic ideas of mode line control. | 1574 | * Base: Mode Line Basics. Basic ideas of mode line control. |
| 1584 | * Data: Mode Line Data. The data structure that controls the mode line. | 1575 | * Data: Mode Line Data. The data structure that controls the mode line. |
| 1585 | * Top: Mode Line Top. The top level variable, mode-line-format. | 1576 | * Top: Mode Line Top. The top level variable, mode-line-format. |
| 1586 | * Mode Line Variables:: Variables used in that data structure. | 1577 | * Mode Line Variables:: Variables used in that data structure. |
| 1587 | * %-Constructs:: Putting information into a mode line. | 1578 | * %-Constructs:: Putting information into a mode line. |
| 1588 | * Properties in Mode:: Using text properties in the mode line. | 1579 | * Properties in Mode:: Using text properties in the mode line. |
| 1589 | * Header Lines:: Like a mode line, but at the top. | 1580 | * Header Lines:: Like a mode line, but at the top. |
| 1590 | * Emulating Mode Line:: Formatting text as the mode line would. | 1581 | * Emulating Mode Line:: Formatting text as the mode line would. |
| 1591 | @end menu | 1582 | @end menu |
| 1592 | 1583 | ||
| 1593 | @node Mode Line Basics | 1584 | @node Mode Line Basics |
| @@ -2361,7 +2352,7 @@ Search-based fontification happens second. | |||
| 2361 | * Other Font Lock Variables:: Additional customization facilities. | 2352 | * Other Font Lock Variables:: Additional customization facilities. |
| 2362 | * Levels of Font Lock:: Each mode can define alternative levels | 2353 | * Levels of Font Lock:: Each mode can define alternative levels |
| 2363 | so that the user can select more or less. | 2354 | so that the user can select more or less. |
| 2364 | * Precalculated Fontification:: How Lisp programs that produce the buffer | 2355 | * Precalculated Fontification:: How Lisp programs that produce the buffer |
| 2365 | contents can also specify how to fontify it. | 2356 | contents can also specify how to fontify it. |
| 2366 | * Faces for Font Lock:: Special faces specifically for Font Lock. | 2357 | * Faces for Font Lock:: Special faces specifically for Font Lock. |
| 2367 | * Syntactic Font Lock:: Fontification based on syntax tables. | 2358 | * Syntactic Font Lock:: Fontification based on syntax tables. |
| @@ -3276,5 +3267,7 @@ optionally bound to @code{desktop-save-buffer}. | |||
| 3276 | @end defvar | 3267 | @end defvar |
| 3277 | 3268 | ||
| 3278 | @ignore | 3269 | @ignore |
| 3279 | arch-tag: 4c7bff41-36e6-4da6-9e7f-9b9289e27c8e | 3270 | Local Variables: |
| 3271 | fill-column: 72 | ||
| 3272 | End: | ||
| 3280 | @end ignore | 3273 | @end ignore |
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 57bf4825887..4da94dacd71 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi | |||
| @@ -2205,7 +2205,7 @@ The functions in this section return unpredictable values. | |||
| 2205 | @defvar indent-line-function | 2205 | @defvar indent-line-function |
| 2206 | This variable's value is the function to be used by @key{TAB} (and | 2206 | This variable's value is the function to be used by @key{TAB} (and |
| 2207 | various commands) to indent the current line. The command | 2207 | various commands) to indent the current line. The command |
| 2208 | @code{indent-according-to-mode} does no more than call this function. | 2208 | @code{indent-according-to-mode} does little more than call this function. |
| 2209 | 2209 | ||
| 2210 | In Lisp mode, the value is the symbol @code{lisp-indent-line}; in C | 2210 | In Lisp mode, the value is the symbol @code{lisp-indent-line}; in C |
| 2211 | mode, @code{c-indent-line}; in Fortran mode, @code{fortran-indent-line}. | 2211 | mode, @code{c-indent-line}; in Fortran mode, @code{fortran-indent-line}. |