aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2018-02-15 20:58:15 +0000
committerAlan Mackenzie2018-02-15 20:58:15 +0000
commitaead21d83ed073f179df856a93228202ff9baee0 (patch)
treefc0a1735f4c7df95e3c6a4499ae09571cb3e3f83
parentb61a87292671c917a4c6c1c146a016f5f544ae36 (diff)
downloademacs-aead21d83ed073f179df856a93228202ff9baee0.tar.gz
emacs-aead21d83ed073f179df856a93228202ff9baee0.zip
Document open-paren-in-column-0-is-defun-start being of less importance
* doc/emacs/programs.texi (Left Margin Paren): Update to reflect the recent change in syntax.c, whereby a paren at column 0 is no longer taken as a beginning of defun in moving backwards over comments.
-rw-r--r--doc/emacs/programs.texi62
1 files changed, 14 insertions, 48 deletions
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index 42891245451..d7041a0beb4 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -151,56 +151,22 @@ Emacs we use it for all languages.
151 151
152@cindex open-parenthesis in leftmost column 152@cindex open-parenthesis in leftmost column
153@cindex ( in leftmost column 153@cindex ( in leftmost column
154 Many programming-language modes assume by default that any opening 154 Many programming-language modes have traditionally assumed that any
155delimiter found at the left margin is the start of a top-level 155opening parenthesis or brace found at the left margin is the start of
156definition, or defun. Therefore, @strong{don't put an opening 156a top-level definition, or defun. So, by default, commands which seek
157delimiter at the left margin unless it should have that significance}. 157the beginning of a defun accept such a delimiter as signifying that
158For instance, never put an open-parenthesis at the left margin in a 158position.
159Lisp file unless it is the start of a top-level list.
160
161 The convention speeds up many Emacs operations, which would
162otherwise have to scan back to the beginning of the buffer to analyze
163the syntax of the code.
164
165 If you don't follow this convention, not only will you have trouble
166when you explicitly use the commands for motion by defuns; other
167features that use them will also give you trouble. This includes the
168indentation commands (@pxref{Program Indent}) and Font Lock mode
169(@pxref{Font Lock}).
170
171 The most likely problem case is when you want an opening delimiter
172at the start of a line inside a string. To avoid trouble, put an
173escape character (@samp{\}, in C and Emacs Lisp, @samp{/} in some
174other Lisp dialects) before the opening delimiter. This will not
175affect the contents of the string, but will prevent that opening
176delimiter from starting a defun. Here's an example:
177
178@example
179 (insert "Foo:
180\(bar)
181")
182@end example
183
184 To help you catch violations of this convention, Font Lock mode
185highlights confusing opening delimiters (those that ought to be
186quoted) in bold red.
187 159
188@vindex open-paren-in-column-0-is-defun-start 160@vindex open-paren-in-column-0-is-defun-start
189 If you need to override this convention, you can do so by setting 161 If you want to override this convention, you can do so by setting
190the variable @code{open-paren-in-column-0-is-defun-start}. 162the user option @code{open-paren-in-column-0-is-defun-start} to
191If this user option is set to @code{t} (the default), opening 163@code{nil}. If this option is set to @code{t} (the default), commands
192parentheses or braces at column zero always start defuns. When it is 164seeking the start of a defun will stop at opening parentheses or
193@code{nil}, defuns are found by searching for parens or braces at the 165braces at column zero. When it is @code{nil}, defuns are found by
194outermost level. 166searching for parens or braces at the outermost level. Since
195 167low-level Emacs routines no longer depend on this convention, you
196 Usually, you should leave this option at its default value of 168usually won't need to change
197@code{t}. If your buffer contains parentheses or braces in column 169@code{open-paren-in-column-0-is-defun-start} from its default.
198zero which don't start defuns, and it is somehow impractical to remove
199these parentheses or braces, it might be helpful to set the option to
200@code{nil}. Be aware that this might make scrolling and display in
201large buffers quite sluggish. Furthermore, the parentheses and braces
202must be correctly matched throughout the buffer for it to work
203properly.
204 170
205@node Moving by Defuns 171@node Moving by Defuns
206@subsection Moving by Defuns 172@subsection Moving by Defuns