Mercurial > emacs
comparison man/programs.texi @ 74697:3c81cd2d3939
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.
author | Alan Mackenzie <acm@muc.de> |
---|---|
date | Sun, 17 Dec 2006 22:04:05 +0000 |
parents | 3719cef078a7 |
children | 8dc8ba72712c bc10a33dd40b |
comparison
equal
deleted
inserted
replaced
74696:9068e737a4b6 | 74697:3c81cd2d3939 |
---|---|
154 @subsection Left Margin Convention | 154 @subsection Left Margin Convention |
155 | 155 |
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 |
179 features that use them will also give you trouble. This includes | 167 features that use them will also give you trouble. This includes |
180 the indentation commands (@pxref{Program Indent}) and Font Lock | 168 the indentation commands (@pxref{Program Indent}) and Font Lock |
181 mode (@pxref{Font Lock}). | 169 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: |
192 \(bar) | 180 \(bar) |
193 ") | 181 ") |
194 @end example | 182 @end example |
195 | 183 |
196 To help you catch violations of this convention, Font Lock mode | 184 To help you catch violations of this convention, Font Lock mode |
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. |
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. | |
199 | 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 |
203 the beginning of the buffer, even for a small function. To speed up | 210 the beginning of the buffer, even for a small function. To speed up |
1555 preprocessor commands. | 1562 preprocessor commands. |
1556 | 1563 |
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 |
1567 @itemx C-c C-@key{DELETE} | 1574 @itemx C-c C-@key{DELETE} |
1568 @itemx C-c @key{DELETE} | 1575 @itemx C-c @key{DELETE} |