summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2016-03-01 15:01:46 +0000
committerAlan Mackenzie <acm@muc.de>2016-03-01 15:10:52 +0000
commit60e05964023bed0ac888219a638e206523f5134a (patch)
treeb19b02ae6a3c988e90fd70f10140d84804c96bc7
parent733fb9fdf568b33efcd351fa0b61f443251ca785 (diff)
downloademacs-60e05964023bed0ac888219a638e206523f5134a.tar.gz
Document c-guess-basic-syntax in the CC Mode manual.
* doc/misc/cc-mode.texi (Syntactic Analysis): Document the function, adding pxrefs to Custom Line-Up and Other Indentation. (Custom Line-Up): Add a note on using c-guess-basic-syntax with a pxref to Syntactic Analysis.
-rw-r--r--doc/misc/cc-mode.texi21
1 files changed, 18 insertions, 3 deletions
diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi
index bc8d24fd992..459369ed9c4 100644
--- a/doc/misc/cc-mode.texi
+++ b/doc/misc/cc-mode.texi
@@ -3887,9 +3887,19 @@ of the variables associated with indentation, not even
@cindex syntactic element
@cindex syntactic context
The first thing @ccmode{} does when indenting a line of code, is to
-analyze the line, determining the @dfn{syntactic context} of the
-(first) construct on that line. It's a list of @dfn{syntactic
-elements}, where each syntactic element in turn is a list@footnote{In
+analyze the line by calling @code{c-guess-basic-syntax}, determining
+the syntactic context of the (first) construct on that line. Although
+this function is mainly used internally, it can sometimes be useful in
+Line-up functions (@pxref{Custom Line-Up}) or in functions on
+@code{c-special-indent-hook} (@pxref{Other Indentation}).
+
+@defun c-guess-basic-syntax
+@findex guess-basic-syntax (c-)
+Determine the syntactic context of the current line.
+@end defun
+
+The @dfn{syntactic context} is a list of @dfn{syntactic elements},
+where each syntactic element in turn is a list@footnote{In
@ccmode 5.28 and earlier, a syntactic element was a dotted pair; the
cons was the syntactic symbol and the cdr was the anchor position.
For compatibility's sake, the parameter passed to a line-up function
@@ -6553,6 +6563,11 @@ only meaningful when used on syntactic elements taken from
@code{c-syntactic-element} or @code{c-syntactic-context}.
@end defun
+Sometimes you may need to use the syntactic context of a line other
+than the one being indented. You can determine this by (temporarily)
+moving point onto this line and calling @code{c-guess-basic-syntax}
+(@pxref{Syntactic Analysis}).
+
Custom line-up functions can be as simple or as complex as you like, and
any syntactic symbol that appears in @code{c-offsets-alist} can have a
custom line-up function associated with it.