diff options
| author | Alan Mackenzie | 2006-12-17 22:04:05 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2006-12-17 22:04:05 +0000 |
| commit | aca2cfd2b6b71b4f0e3951ce6227385111f3e852 (patch) | |
| tree | fe3e45d403f0fd934620c7d514553361e202b9d8 | |
| parent | fe963f844bbb6feaf626e1aa096c12e7681f603d (diff) | |
| download | emacs-aca2cfd2b6b71b4f0e3951ce6227385111f3e852.tar.gz emacs-aca2cfd2b6b71b4f0e3951ce6227385111f3e852.zip | |
programs.texi (Left Margin Paren): Remove the bit which says
that CC Mode sets open-paren-in-column-0-is-defun-start to nil.
Discuss some of the issues of setting this option to nil.
| -rw-r--r-- | man/programs.texi | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/man/programs.texi b/man/programs.texi index fb85e470f86..200c787cf08 100644 --- a/man/programs.texi +++ b/man/programs.texi | |||
| @@ -156,23 +156,11 @@ from Lisp, but in Emacs we use it for all languages. | |||
| 156 | @cindex open-parenthesis in leftmost column | 156 | @cindex open-parenthesis in leftmost column |
| 157 | @cindex ( in leftmost column | 157 | @cindex ( in leftmost column |
| 158 | Emacs assumes by default that any opening delimiter found at the | 158 | Emacs assumes by default that any opening delimiter found at the |
| 159 | left margin is the start of a top-level definition, or defun. You can | 159 | left margin is the start of a top-level definition, or defun. |
| 160 | override this default by setting this user option: | 160 | Therefore, @strong{don't put an opening delimiter at the left margin |
| 161 | 161 | unless it should have that significance}. For instance, never put an | |
| 162 | @defvar open-paren-in-column-0-is-defun-start | ||
| 163 | If this user option is set to @code{t} (the default), opening | ||
| 164 | parentheses or braces at column zero always start defuns. When it's | ||
| 165 | @code{nil}, defuns are found by searching for parens or braces at the | ||
| 166 | outermost level. Some major modes, including C and related modes, set | ||
| 167 | @code{open-paren-in-column-0-is-defun-start} buffer-locally to | ||
| 168 | @code{nil} | ||
| 169 | @end defvar | ||
| 170 | |||
| 171 | In modes where @code{open-paren-in-column-0-is-defun-start} is | ||
| 172 | @code{t}, @strong{don't put an opening delimiter at the left margin | ||
| 173 | unless it is a defun start}. For instance, never put an | ||
| 174 | open-parenthesis at the left margin in a Lisp file unless it is the | 162 | open-parenthesis at the left margin in a Lisp file unless it is the |
| 175 | start of a top-level list. | 163 | start of a top-level list. |
| 176 | 164 | ||
| 177 | If you don't follow this convention, not only will you have trouble | 165 | If you don't follow this convention, not only will you have trouble |
| 178 | when you explicitly use the commands for motion by defuns; other | 166 | when you explicitly use the commands for motion by defuns; other |
| @@ -182,10 +170,10 @@ mode (@pxref{Font Lock}). | |||
| 182 | 170 | ||
| 183 | The most likely problem case is when you want an opening delimiter | 171 | The most likely problem case is when you want an opening delimiter |
| 184 | at the start of a line inside a string. To avoid trouble, put an | 172 | at the start of a line inside a string. To avoid trouble, put an |
| 185 | escape character (@samp{\}, in Emacs Lisp, @samp{/} in some other Lisp | 173 | escape character (@samp{\}, in C and Emacs Lisp, @samp{/} in some |
| 186 | dialects) before the opening delimiter. This will not affect the | 174 | other Lisp dialects) before the opening delimiter. This will not |
| 187 | contents of the string, but will prevent that opening delimiter from | 175 | affect the contents of the string, but will prevent that opening |
| 188 | starting a defun. Here's an example: | 176 | delimiter from starting a defun. Here's an example: |
| 189 | 177 | ||
| 190 | @example | 178 | @example |
| 191 | (insert "Foo: | 179 | (insert "Foo: |
| @@ -197,6 +185,25 @@ starting a defun. Here's an example: | |||
| 197 | highlights confusing opening delimiters (those that ought to be | 185 | highlights confusing opening delimiters (those that ought to be |
| 198 | quoted) in bold red. | 186 | quoted) in bold red. |
| 199 | 187 | ||
| 188 | If you need to override this convention, you can so by setting this | ||
| 189 | user option: | ||
| 190 | |||
| 191 | @defvar open-paren-in-column-0-is-defun-start | ||
| 192 | If this user option is set to @code{t} (the default), opening | ||
| 193 | parentheses or braces at column zero always start defuns. When it's | ||
| 194 | @code{nil}, defuns are found by searching for parens or braces at the | ||
| 195 | outermost level. | ||
| 196 | @end defvar | ||
| 197 | |||
| 198 | Usually, you shouldn't need to set | ||
| 199 | @code{open-paren-in-column-0-is-defun-start} to @code{nil}. However, | ||
| 200 | if your buffer contains parentheses or braces in column zero which | ||
| 201 | don't start defuns and this confuses Emacs, it sometimes helps to set | ||
| 202 | the option to @code{nil}. Be aware, though, that this will make | ||
| 203 | scrolling and display in large buffers quite sluggish, and that | ||
| 204 | parentheses and braces must be correctly matched throughout the buffer | ||
| 205 | for it to work properly. | ||
| 206 | |||
| 200 | In the earliest days, the original Emacs found defuns by moving | 207 | In the earliest days, the original Emacs found defuns by moving |
| 201 | upward a level of parentheses or braces until there were no more | 208 | upward a level of parentheses or braces until there were no more |
| 202 | levels to go up. This always required scanning all the way back to | 209 | levels to go up. This always required scanning all the way back to |
| @@ -1557,10 +1564,10 @@ preprocessor commands. | |||
| 1557 | @table @kbd | 1564 | @table @kbd |
| 1558 | @item C-c C-@key{DEL} | 1565 | @item C-c C-@key{DEL} |
| 1559 | @itemx C-c @key{DEL} | 1566 | @itemx C-c @key{DEL} |
| 1560 | @findex c-hungry-backspace | 1567 | @findex c-hungry-delete-backwards |
| 1561 | @kindex C-c C-@key{DEL} (C Mode) | 1568 | @kindex C-c C-@key{DEL} (C Mode) |
| 1562 | @kindex C-c @key{DEL} (C Mode) | 1569 | @kindex C-c @key{DEL} (C Mode) |
| 1563 | @code{c-hungry-backspace}---Delete the entire block of whitespace | 1570 | @code{c-hungry-delete-backwards}---Delete the entire block of whitespace |
| 1564 | preceding point. | 1571 | preceding point. |
| 1565 | 1572 | ||
| 1566 | @item C-c C-d | 1573 | @item C-c C-d |