aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-03-06 22:26:47 -0800
committerPaul Eggert2011-03-06 22:26:47 -0800
commit07b48fa9daec2894ad549f44fb468b251896d829 (patch)
tree2cde6971d6f14a05adb8b6585cb4fa334d4b73aa
parentd432397227a87fd18c33a27806cd2c0fbcd203af (diff)
parentef272f1fc10a4f8464c886ccc02ea67b2c3b2769 (diff)
downloademacs-07b48fa9daec2894ad549f44fb468b251896d829.tar.gz
emacs-07b48fa9daec2894ad549f44fb468b251896d829.zip
Merge from mainline.
-rw-r--r--doc/emacs/ChangeLog4
-rw-r--r--doc/emacs/search.texi31
-rw-r--r--doc/lispref/ChangeLog15
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/makefile.w32-in1
-rw-r--r--doc/lispref/package.texi379
-rw-r--r--etc/NEWS9
-rw-r--r--lisp/ChangeLog39
-rw-r--r--lisp/emacs-lisp/package-x.el253
-rw-r--r--lisp/isearch.el3
-rw-r--r--lisp/progmodes/cc-engine.el2724
-rw-r--r--lisp/progmodes/gud.el4
-rw-r--r--src/ChangeLog17
-rw-r--r--src/xdisp.c10
14 files changed, 1859 insertions, 1631 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index dc43450110f..dfdef6a0b05 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,7 @@
12011-03-06 Chong Yidong <cyd@stupidchicken.com>
2
3 * search.texi (Isearch Yank): C-y now bound to isearch-yank-kill.
4
12011-03-03 Drake Wilson <drake@begriffli.ch> (tiny change) 52011-03-03 Drake Wilson <drake@begriffli.ch> (tiny change)
2 6
3 * misc.texi (emacsclient Options): Add q/quiet. 7 * misc.texi (emacsclient Options): Add q/quiet.
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index e3c0445e189..9fdccc3218d 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -271,19 +271,24 @@ keybindings. These keybindings are part of the keymap
271@node Isearch Yank 271@node Isearch Yank
272@subsection Isearch Yanking 272@subsection Isearch Yanking
273 273
274 Within incremental search, you can use @kbd{C-w} and @kbd{C-y} to grab 274 Within incremental search, @kbd{C-y} (@code{isearch-yank-kill})
275text from the buffer into the search string. This makes it convenient 275copies text from the kill ring into the search string. It uses the
276to search for another occurrence of text at point. 276same text that @kbd{C-y}, outside of incremental search, would
277normally yank into the buffer. @kbd{Mouse-2} in the echo area does
278the same. @xref{Yanking}.
277 279
278 @kbd{C-w} copies the character or word after point and adds it to 280 @kbd{C-w} (@code{isearch-yank-word-or-char}) grabs the next
279the search string, advancing point over it. (The decision, whether to 281character or word at point, and adds it to the search string. This is
280copy a character or a word, is heuristic.) 282convenient for searching for another occurrence of the text at point.
283(The decision, whether to copy a character or a word, is heuristic.)
281 284
282 @kbd{C-y} is similar to @kbd{C-w} but copies all the rest of the 285 Similarly, @kbd{M-s C-e} (@code{isearch-yank-line}) grabs the rest
283current line into the search string. If point is already at the end 286of the current line, and adds it to the search string. If point is
284of a line, it grabs the entire next line. If the search is currently 287already at the end of a line, it grabs the entire next line.
285case-insensitive, both @kbd{C-y} and @kbd{C-w} convert the text they 288
286copy to lower case, so that the search remains case-insensitive. 289 If the search is currently case-insensitive, both @kbd{C-w} and
290@kbd{M-s C-e} convert the text they copy to lower case, so that the
291search remains case-insensitive.
287 292
288 @kbd{C-M-w} and @kbd{C-M-y} modify the search string by only one 293 @kbd{C-M-w} and @kbd{C-M-y} modify the search string by only one
289character at a time: @kbd{C-M-w} deletes the last character from the 294character at a time: @kbd{C-M-w} deletes the last character from the
@@ -293,10 +298,6 @@ after point into the search string is to enter the minibuffer by
293@kbd{M-e} and to type @kbd{C-f} at the end of the search string in the 298@kbd{M-e} and to type @kbd{C-f} at the end of the search string in the
294minibuffer. 299minibuffer.
295 300
296 The character @kbd{M-y} copies text from the kill ring into the
297search string. It uses the same text that @kbd{C-y} would yank.
298@kbd{Mouse-2} in the echo area does the same. @xref{Yanking}.
299
300@node Isearch Scroll 301@node Isearch Scroll
301@subsection Scrolling During Incremental Search 302@subsection Scrolling During Incremental Search
302 303
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 7bb1919b837..32d13b57ffd 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,5 +1,20 @@
12011-03-06 Chong Yidong <cyd@stupidchicken.com> 12011-03-06 Chong Yidong <cyd@stupidchicken.com>
2 2
3 * package.texi: Update index keywords.
4 (Package Archives): New node contents. Document package-x.el.
5
62011-03-06 Juanma Barranquero <lekktu@gmail.com>
7
8 * makefile.w32-in (srcs): Add package.texi.
9
102011-03-06 Chong Yidong <cyd@stupidchicken.com>
11
12 * package.texi (Packaging, Packaging Basics, Simple Packages)
13 (Multi-file Packages): Expand and clarify.
14 (Package Archives): Temporary placeholder node.
15
16 * elisp.texi (Top): Update node listing.
17
3 * Makefile.in (srcs): Add package.texi. 18 * Makefile.in (srcs): Add package.texi.
4 19
52011-03-05 Chong Yidong <cyd@stupidchicken.com> 202011-03-05 Chong Yidong <cyd@stupidchicken.com>
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index cc3ceb8003c..fc066526614 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -1399,6 +1399,7 @@ Preparing Lisp code for distribution
1399* Packaging Basics:: The basic concepts of Emacs Lisp packages. 1399* Packaging Basics:: The basic concepts of Emacs Lisp packages.
1400* Simple Packages:: How to package a single .el file. 1400* Simple Packages:: How to package a single .el file.
1401* Multi-file Packages:: How to package multiple files. 1401* Multi-file Packages:: How to package multiple files.
1402* Package Archives:: Maintaining package archives.
1402 1403
1403Starting Up Emacs 1404Starting Up Emacs
1404 1405
diff --git a/doc/lispref/makefile.w32-in b/doc/lispref/makefile.w32-in
index e0bcd21f2c0..d074dd22e24 100644
--- a/doc/lispref/makefile.w32-in
+++ b/doc/lispref/makefile.w32-in
@@ -87,6 +87,7 @@ srcs = \
87 $(srcdir)/numbers.texi \ 87 $(srcdir)/numbers.texi \
88 $(srcdir)/objects.texi \ 88 $(srcdir)/objects.texi \
89 $(srcdir)/os.texi \ 89 $(srcdir)/os.texi \
90 $(srcdir)/package.texi \
90 $(srcdir)/positions.texi \ 91 $(srcdir)/positions.texi \
91 $(srcdir)/processes.texi \ 92 $(srcdir)/processes.texi \
92 $(srcdir)/searching.texi \ 93 $(srcdir)/searching.texi \
diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi
index 373e1e2b5c7..62fbc2a9a07 100644
--- a/doc/lispref/package.texi
+++ b/doc/lispref/package.texi
@@ -5,188 +5,232 @@
5@setfilename ../../info/package 5@setfilename ../../info/package
6@node Packaging, Antinews, System Interface, Top 6@node Packaging, Antinews, System Interface, Top
7@chapter Preparing Lisp code for distribution 7@chapter Preparing Lisp code for distribution
8@cindex packaging 8@cindex package
9@cindex Lisp package
9 10
10 Emacs provides a standard way for Emacs Lisp code to be distributed 11 Emacs provides a standard way to distribute Emacs Lisp code to
11to users. This approach lets users easily download, install, 12users. A @dfn{package} is a collection of one or more files,
12uninstall, and upgrade Lisp code that they might want to use. 13formatted and bundled in such a way that users can easily download,
14install, uninstall, and upgrade it.
13 15
14 A @dfn{package} is simply one or more files, formatted and bundled 16 The following sections describe how to create a package, and how to
15in a particular way. Typically a package includes primarily Emacs 17put it in a @dfn{package archive} for others to download.
16Lisp code, but it is possible to create other kinds of packages as
17well.
18 18
19@menu 19@menu
20* Packaging Basics:: The basic concepts of Emacs Lisp packages. 20* Packaging Basics:: The basic concepts of Emacs Lisp packages.
21* Simple Packages:: How to package a single .el file. 21* Simple Packages:: How to package a single .el file.
22* Multi-file Packages:: How to package multiple files. 22* Multi-file Packages:: How to package multiple files.
23* Package Archives:: Maintaining package archives.
23@end menu 24@end menu
24 25
25@node Packaging Basics 26@node Packaging Basics
26@section Packaging Basics 27@section Packaging Basics
27@cindex packaging basics
28
29 A package has a few attributes:
30@cindex package attributes 28@cindex package attributes
29@cindex package name
30@cindex package version
31@cindex dependencies
32@cindex package dependencies
33
34 A package is either a @dfn{simple package} or a @dfn{multi-file
35package}. A simple package is stored in a package archive as a single
36Emacs Lisp file, while a multi-file package is stored as a tar file
37(containing multiple Lisp files, and possibly non-Lisp files such as a
38manual).
39
40 In ordinary usage, the difference between simple packages and
41multi-file packages is relatively unimportant; the Package Menu
42interface makes no distinction between them. However, the procedure
43for creating them differs, as explained in the following sections.
44
45 Each package (whether simple or multi-file) has certain
46@dfn{attributes}:
31 47
32@table @asis 48@table @asis
33@item Name 49@item Name
34A string, the name of the package. This attribute is mandatory. If 50A short word (e.g. @samp{auctex}). This is usually also the symbol
35it does not exist, the package cannot be installed by the package 51prefix used in the program (@pxref{Coding Conventions}).
36manager.
37 52
38@item Version 53@item Version
39A version number, which is anything that can be parsed by 54A version number, in a form that the function @code{version-to-list}
40@code{version-to-list}. This attribute is mandatory. If it does not 55understands (e.g. @samp{11.86}). Each release of a package should be
41exist, the package cannot be installed by the package manager. 56accompanied by an increase in the version number.
42 57
43@item Brief description 58@item Brief description
44This is shown to the user in the package menu buffer. It is just a 59This is shown when the package is listed in the Package Menu. It
45single line. On a terminal with 80 characters per line, there are 60should occupy a single line, ideally in 36 characters or less.
46only 36 characters available in the package menu mode for showing the
47brief description, so it is best to keep it very brief. If no brief
48name is given, an empty string is used.
49 61
50@item Long description 62@item Long description
51This can be a @file{README} file or the like. This is available to 63This is shown in the buffer created by @kbd{C-h P}
52the user before the package is installed, via the package menu. It 64(@code{describe-package}), following the package's brief description
53should more fully describe the package and its capabilities, so a user 65and installation status. It normally spans multiple lines, and should
54can read it to decide whether he wants to install the package. This 66fully describe the package and its capabilities.
55attribute is optional.
56 67
57@item Dependencies 68@item Dependencies
58This is a list of other packages and their minimal acceptable 69A list of other packages (possibly including minimal acceptable
59versions. This is used both at download time (to make sure all the 70version numbers) on which this package depends. The list may be
60needed code is available) and at activation time (to ensure a package 71empty, meaning this package has no dependencies. Otherwise,
61is only activated if all its dependencies have been successfully 72installing this package also automatically installs its dependencies;
62activated). This attribute is optional. 73if any dependency cannot be found, the package cannot be installed.
63
64@item Manual
65A package can optionally include an Info manual.
66@end table 74@end table
67 75
68 Conceptually, a package goes through several state transitions (in 76@cindex content directory, package
69reality some of these transitions are grouped together): 77 Installing a package, either via the Package Menu, or via the
78command @code{package-install-file}, creates a subdirectory of
79@code{package-user-dir} named @file{@var{name}-@var{version}}, where
80@var{name} is the package's name and @var{version} its version
81(e.g. @file{~/.emacs.d/elpa/auctex-11.86/}). We call this the
82package's @dfn{content directory}. It is where Emacs puts the
83package's contents (the single Lisp file for a simple package, or the
84files extracted from a multi-file package).
85
86@cindex package autoloads
87 Emacs then searches every Lisp file in the content directory for
88autoload magic comments (@pxref{Autoload}). These autoload
89definitions are saved to a file named @file{@var{name}-autoloads.el}
90in the content directory. They are typically used to autoload the
91principal user commands defined in the package, but they can also
92perform other tasks, such as adding an element to
93@code{auto-mode-alist} (@pxref{Auto Major Mode}). During this time,
94Emacs will also byte-compile the Lisp files.
95
96 After installation, and (by default) each time Emacs is started, the
97installed package is @dfn{activated}. During activation, Emacs adds
98the package's content directory to @code{load-path}, and evaluates the
99autoload definitions in @file{@var{name}-autoloads.el}.
100
101 Note that a package typically does @emph{not} autoload every
102function and variable defined within it---only the handful of commands
103typically called to begin using the package.
70 104
71@table @asis 105@node Simple Packages
72@item Download 106@section Simple Packages
73Fetch the package from somewhere. 107@cindex single file package
108@cindex simple package
74 109
75@item Install 110 A simple package consists of a single Emacs Lisp source file. The
76Unpack the package, or write a @file{.el} file into the appropriate 111file must conform to the Emacs Lisp library header conventions
77install directory. This step also includes extracting autoloads and 112(@pxref{Library Headers}). The package's attributes are taken from
78byte-compiling the Emacs Lisp code. 113the various headers, as illustrated by the following example:
79 114
80@item Activate 115@example
81Update @code{load-path} and @code{Info-directory-list} and evaluate 116@group
82the autoloads, so that the package is ready for the user to use. 117;;; superfrobnicator.el --- Frobnicate and bifurcate flanges
83@end table
84 118
85 It is best for users if packages do not do too much work at 119;; Copyright (C) 2011 Free Software Foundation, Inc.
86activation time. The best approach is to have activation consist of 120@end group
87some autoloads and little more.
88 121
89@node Simple Packages 122;; Author: J. R. Hacker <jrh@@example.com>
90@section Simple Packages 123;; Version: 1.3
91@cindex single file packages 124;; Package-Requires: ((flange "1.0"))
125;; Keywords: frobnicate
92 126
93 The simplest package consists of a single Emacs Lisp source file. 127@dots{}
94In this case, all the attributes of the package (@pxref{Packaging
95Basics}) are taken from this file.
96 128
97 The package system expects this @file{.el} file to conform to the 129;;; Commentary:
98Emacs Lisp library header conventions. @xref{Library Headers}.
99 130
100 The name of the package is the same as the base name of the 131;; This package provides a minor mode to frobnicate and/or
101@file{.el} file, as written in the first comment line. For example, 132;; bifurcate any flanges you desire. To activate it, just type
102given the header line: 133@dots{}
103 134
104@smallexample 135;;;###autoload
105;;; superfrobnicator.el --- frobnicate and bifurcate flanges 136(define-minor-mode superfrobnicator-mode
106@end smallexample 137@dots{}
138@end example
107 139
108the package name will be @samp{superfrobnicator}. 140 The name of the package is the same as the base name of the file, as
141written on the first line. Here, it is @samp{superfrobnicator}.
109 142
110 The short description of the package is also taken from the first 143 The brief description is also taken from the first line. Here, it
111line of the file. 144is @samp{Frobnicate and bifurcate flanges}.
112 145
113 If the file has a ``Commentary'' header, then it is used as the long 146 The version number comes from the @samp{Package-Version} header, if
114description. 147it exists, or from the @samp{Version} header otherwise. One or the
148other @emph{must} be present. Here, the version number is 1.3.
115 149
116 The version of the package comes either from the ``Package-Version'' 150 If the file has a @samp{;;; Commentary:} section, this section is
117header, if it exists, or from the ``Version'' header. A package is 151used as the long description. (When displaying the description, Emacs
118required to have a version number. Each release of a package must be 152omits the @samp{;;; Commentary:} line, as well as the leading comment
119accompanied by an increase in the version number. 153characters in the commentary itself.)
120 154
121 If the file has a ``Package-Requires'' header, then that is used as 155 If the file has a @samp{Package-Requires} header, that is used as
122the package dependencies. Otherwise, the package is assumed not to 156the package dependencies. In the above example, the package depends
123have any dependencies. 157on the @samp{flange} package, version 1.0 or higher. @xref{Library
158Headers}, for a description of the @samp{Package-Requires} header. If
159the header is omitted, the package has no dependencies.
124 160
125 A single-file package cannot have an Info manual. 161 The file ought to also contain one or more autoload magic comments,
162as explained in @ref{Packaging Basics}. In the above example, a magic
163comment autoloads @code{superfrobnicator-mode}.
126 164
127 The file will be scanned for autoload cookies at install time. 165 @xref{Package Archives}, for a explanation of how to add a
128@xref{Autoload}. 166single-file package to a package archive.
129 167
130@node Multi-file Packages 168@node Multi-file Packages
131@section Multi-file Packages 169@section Multi-file Packages
132@cindex multi-file packages 170@cindex multi-file package
133 171
134 A multi-file package is just a @file{.tar} file. While less 172 A multi-file package is less convenient to create than a single-file
135convenient to create than a single-file package, a multi-file package 173package, but it offers more features: it can include multiple Emacs
136also offers more features: it can include an Info manual, multiple 174Lisp files, an Info manual, and other file types (such as images).
137Emacs Lisp files, and also other data files needed by a package. 175
138 176 Prior to installation, a multi-file package is stored in a package
139 The contents of the @file{.tar} file must all appear beneath a 177archive as a tar file. The tar file must be named
140single directory, named after the package and version. Files can 178@file{@var{name}-@var{version}.tar}, where @var{name} is the package
141appear in subdirectories of this top-most directory, but Emacs Lisp 179name and @var{version} is the version number. Its contents, once
142code will only be found (and thus byte-compiled) at the top-most 180extracted, must all appear in a directory named
143level. Also, the @file{.tar} file is typically also given this same 181@file{@var{name}-@var{version}}, the @dfn{content directory}
144name. For example, if you are distributing version 1.3 of the 182(@pxref{Packaging Basics}). Files may also extract into
145superfrobnicator, the package file would be named 183subdirectories of the content directory.
146``superfrobnicator-1.3.tar'' and the contents would all appear in the 184
147directory @file{superfrobnicator-1.3} in that @file{.tar}. 185 One of the files in the content directory must be named
148 186@file{@var{name}-pkg.el}. It must contain a single Lisp form,
149 The package must include a @file{-pkg.el} file, named after the 187consisting of a call to the function @code{define-package}, described
150package. In our example above, this file would be called 188below. This defines the package's version, brief description, and
151@file{superfrobnicator-pkg.el}. This file must have a single form in 189requirements.
152it, a call to @code{define-package}. The package dependencies and 190
153brief description are taken from this form. 191 For example, if we distribute version 1.3 of the superfrobnicator as
192a multi-file package, the tar file would be
193@file{superfrobnicator-1.3.tar}. Its contents would extract into the
194directory @file{superfrobnicator-1.3}, and one of these would be the
195file @file{superfrobnicator-pkg.el}.
154 196
155@defun define-package name version &optional docstring requirements 197@defun define-package name version &optional docstring requirements
156Define a package. @var{name} is the name of the package, a string. 198This function defines a package. @var{name} is the package name, a
157@var{version} is the package's version, a string. It must be in a 199string. @var{version} is the version, as a string of a form that can
158form that can be understood by @code{version-to-list}. 200be understood by the function @code{version-to-list}. @var{docstring}
159@var{docstring} is the short description of the package. 201is the brief description.
202
160@var{requirements} is a list of required packages and their versions. 203@var{requirements} is a list of required packages and their versions.
204Each element in this list should have the form @code{(@var{dep-name}
205@var{dep-version})}, where @var{dep-name} is a symbol whose name is
206the dependency's package name, and @var{dep-version} is the
207dependency's version (a string).
161@end defun 208@end defun
162 209
163 If a @file{README} file exists in the content directory, then it is 210 If the content directory contains a file named @file{README}, this
164used as the long description. 211file is used as the long description.
165 212
166 If the package has an Info manual, you should distribute the needed 213 If the content directory contains a file named @file{dir}, this is
167info files, plus a @file{dir} file made with @command{install-info}. 214assumed to be an Info directory file made with @command{install-info}.
168@xref{Invoking install-info, Invoking install-info, Invoking 215@xref{Invoking install-info, Invoking install-info, Invoking
169install-info, texinfo, Texinfo}. 216install-info, texinfo, Texinfo}. The relevant Info files should also
217be present in the content directory. In this case, Emacs will
218automatically add the content directory to @code{Info-directory-list}
219when the package is activated.
170 220
171 Do not include any @file{.elc} files in the package. Those will be 221 Do not include any @file{.elc} files in the package. Those are
172created at install time. Note that there is no way to control the 222created when the package is installed. Note that there is no way to
173order in which files are byte-compiled; your package must be robust 223control the order in which files are byte-compiled.
174here.
175 224
176 The installation process will scan all the @file{.el} files in the 225 Do not include any file named @file{@var{name}-autoloads.el}. This
177package for autoload cookies. @xref{Autoload}. They are extracted 226file is reserved for the package's autoload definitions
178into a @file{-autoloads.el} file (e.g., 227(@pxref{Packaging Basics}). It is created automatically when the
179@file{superfrobnicator-autoloads.el}), so do not include a file of 228package is installed, by searching all the Lisp files in the package
180that name in your package. 229for autoload magic comments.
181 230
182 Any other files in the @file{.tar} file are simply unpacked when the 231 If the multi-file package contains auxiliary data files (such as
183package is installed. This can be useful if your package needs 232images), the package's Lisp code can refer to these files via the
184auxiliary data files --- e.g., icons or sounds. 233variable @code{load-file-name} (@pxref{Loading}). Here is an example:
185
186 Emacs Lisp code installed via the package manager must take special
187care to be location-independent. One easy way to do this is to make
188references to auxiliary data files relative to @var{load-file-name}.
189For example:
190 234
191@smallexample 235@smallexample
192(defconst superfrobnicator-base (file-name-directory load-file-name)) 236(defconst superfrobnicator-base (file-name-directory load-file-name))
@@ -194,3 +238,82 @@ For example:
194(defun superfrobnicator-fetch-image (file) 238(defun superfrobnicator-fetch-image (file)
195 (expand-file-name file superfrobnicator-base)) 239 (expand-file-name file superfrobnicator-base))
196@end smallexample 240@end smallexample
241
242@node Package Archives
243@section Creating and Maintaining Package Archives
244@cindex package archive
245
246 Via the Package Menu, users may download packages from @dfn{package
247archives}. Such archives are specified by the variable
248@code{package-archives}, whose default value contains a single entry:
249the archive hosted by the GNU project at @url{elpa.gnu.org}. This
250section describes how to set up and maintain a package archive.
251
252@cindex base location, package archive
253@defopt package-archives
254The value of this variable is an alist of package archives recognized
255by the Emacs package manager.
256
257Each alist element corresponds to one archive, and should have the
258form @code{(@var{id} . @var{location})}, where @var{id} is the name of
259the archive (a string) and @var{location} is its @dfn{base location}
260(a string).
261
262If the base location starts with @samp{http:}, it is treated as a HTTP
263URL, and packages are downloaded from this archive via HTTP (as is the
264case for the default GNU archive).
265
266Otherwise, the base location should be a directory name. In this
267case, Emacs retrieves packages from this archive via ordinary file
268access. Such ``local'' archives are mainly useful for testing.
269@end defopt
270
271 A package archive is simply a directory in which the package files,
272and associated files, are stored. If you want the archive to be
273reachable via HTTP, this directory must be accessible to a web server.
274How to accomplish this is beyond the scope of this manual.
275
276 A convenient way to set up and update a package archive is via the
277@code{package-x} library. This is included with Emacs, but not loaded
278by default; type @kbd{M-x load-library @kbd{RET} package-x @kbd{RET}}
279to load it, or add @code{(require 'package-x)} to your init file.
280@xref{Lisp Libraries,, Lisp Libraries, emacs, The GNU Emacs Manual}.
281Once loaded, you can make use of the following:
282
283@defopt package-archive-upload-base
284The value of this variable is the base location of a package archive,
285as a directory name. The commands in the @code{package-x} library
286will use this base location.
287
288The directory name should be absolute. You may specify a remote name,
289such as @file{/ssh:foo@@example.com:/var/www/packages/}, if the
290package archive is on a different machine. @xref{Remote Files,,
291Remote Files, emacs, The GNU Emacs Manual}.
292@end defopt
293
294@deffn Command package-upload-file filename
295This command prompts for @var{filename}, a file name, and uploads that
296file to @code{package-archive-upload-base}. The file must be either a
297simple package (a @file{.el} file) or a multi-file package (a
298@file{.tar} file); otherwise, an error is raised. The package
299attributes are automatically extracted, and the archive's contents
300list is updated with this information.
301
302If @code{package-archive-upload-base} does not specify a valid
303directory, the function prompts interactively for one. If the
304directory does not exist, it is created. The directory need not have
305any initial contents (i.e., you can use this command to populate an
306initially empty archive).
307@end deffn
308
309@deffn Command package-upload-buffer
310This command is similar to @code{package-upload-file}, but instead of
311prompting for a package file, it uploads the contents of the current
312buffer. The current buffer must be visiting a simple package (a
313@file{.el} file) or a multi-file package (a @file{.tar} file);
314otherwise, an error is raised.
315@end deffn
316
317@noindent
318After you create an archive, remember that it is not accessible in the
319Package Menu interface unless it is in @code{package-archives}.
diff --git a/etc/NEWS b/etc/NEWS
index df9884e94b1..ac7fdcbab0c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -247,6 +247,15 @@ replaced with Lisp commands `doc-file-to-man' and `doc-file-to-info'.
247 247
248* Editing Changes in Emacs 24.1 248* Editing Changes in Emacs 24.1
249 249
250** Search changes
251
252+++
253*** C-y in Isearch is now bound to isearch-yank-kill, instead of
254isearch-yank-line.
255
256+++
257*** M-s C-e in Isearch is now bound to isearch-yank-line.
258
250+++ 259+++
251** There is a new command `count-words-region', which does what you expect. 260** There is a new command `count-words-region', which does what you expect.
252 261
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e34fde79543..6b7768fe93c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,11 +1,40 @@
12011-03-06 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * progmodes/gud.el (gdb-script-syntax-propertize-function):
4 Don't change the syntax of a \n that closes a comment (bug#8169).
5
62011-03-06 Chong Yidong <cyd@stupidchicken.com>
7
8 * emacs-lisp/package-x.el (package-archive-upload-base): Make it a
9 defcustom.
10 (package--update-file): Doc fix. Accept relative file names.
11 (package--archive-contents-from-file): Remove the argument, since
12 it's necessarily always "archive-contents".
13 (package-maint-add-news-item): Pass relative file name args to
14 package--update-file.
15 (package-upload-buffer-internal): Prompt for a destination if
16 package-archive-upload-base is invalid. Create the directory if
17 it does not exist.
18 (package-upload-buffer, package-upload-file): Doc fix.
19
202011-03-06 Chong Yidong <cyd@stupidchicken.com>
21
22 * isearch.el (isearch-mode-map): Bind C-y to isearch-yank-kill,
23 and move isearch-yank-line to M-s C-e (Bug#8183).
24
252011-03-06 Alan Mackenzie <acm@muc.de>
26
27 * progmodes/cc-engine.el (c-guess-basic-syntax): Reindent.
28 (c-guess-basic-syntax): Move CASE 19 to a different place,
29 correctly to process template-args-cont lines.
30
12011-03-06 Jay Belanger <jay.p.belanger@gmail.com> 312011-03-06 Jay Belanger <jay.p.belanger@gmail.com>
2 32
3 * calc/calc-ext.el (calc-init-extensions): 33 * calc/calc-ext.el (calc-init-extensions):
4 Rename calc-logunits-dblevel and calc-logunits-nplevel to 34 Rename calc-logunits-dblevel and calc-logunits-nplevel to calc-dblevel
5 calc-dblevel and calc-nplevel, respectively. 35 and calc-nplevel, respectively. Add keybindings for calc-spn,
6 Add keybindings for calc-spn, calc-midi and calc-freq. Add 36 calc-midi and calc-freq. Add autoloads for calcFunc-spn,
7 autoloads for calcFunc-spn, calcFunc-midi, calcFunc-freq, 37 calcFunc-midi, calcFunc-freq, calc-spn, calc-midi and calc-freq.
8 calc-spn, calc-midi and calc-freq.
9 38
10 * calc/calc-units.el (calc-dblevel): Rename from 39 * calc/calc-units.el (calc-dblevel): Rename from
11 calc-logunits-dblevel. 40 calc-logunits-dblevel.
diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el
index 61f23abf0a7..4de95f65702 100644
--- a/lisp/emacs-lisp/package-x.el
+++ b/lisp/emacs-lisp/package-x.el
@@ -27,21 +27,41 @@
27 27
28;;; Commentary: 28;;; Commentary:
29 29
30;; This file currently contains parts of the package system most 30;; This file currently contains parts of the package system that many
31;; people won't need, such as package uploading. 31;; won't need, such as package uploading.
32
33;; To upload to an archive, first set `package-archive-upload-base' to
34;; some desired directory. For testing purposes, you can specify any
35;; directory you want, but if you want the archive to be accessible to
36;; others via http, this is typically a directory in the /var/www tree
37;; (possibly one on a remote machine, accessed via Tramp).
38
39;; Then call M-x package-upload-file, which prompts for a file to
40;; upload. Alternatively, M-x package-upload-buffer uploads the
41;; current buffer, if it's visiting a package file.
42
43;; Once a package is uploaded, users can access it via the Package
44;; Menu, by adding the archive to `package-archives'.
32 45
33;;; Code: 46;;; Code:
34 47
35(require 'package) 48(require 'package)
36(defvar gnus-article-buffer) 49(defvar gnus-article-buffer)
37 50
38;; Note that this only works if you have the password, which you 51(defcustom package-archive-upload-base "/path/to/archive"
39;; probably don't :-). 52 "The base location of the archive to which packages are uploaded.
40(defvar package-archive-upload-base nil 53This should be an absolute directory name. If the archive is on
41 "Base location for uploading to package archive.") 54another machine, you may specify a remote name in the usual way,
55e.g. \"/ssh:foo@example.com:/var/www/packages/\".
56See Info node `(emacs)Remote Files'.
57
58Unlike `package-archives', you can't specify a HTTP URL."
59 :type 'directory
60 :group 'package
61 :version "24.1")
42 62
43(defvar package-update-news-on-upload nil 63(defvar package-update-news-on-upload nil
44 "Whether package upload should also update NEWS and RSS feeds.") 64 "Whether uploading a package should also update NEWS and RSS feeds.")
45 65
46(defun package--encode (string) 66(defun package--encode (string)
47 "Encode a string by replacing some characters with XML entities." 67 "Encode a string by replacing some characters with XML entities."
@@ -75,13 +95,18 @@
75 title " - " (package--encode text) 95 title " - " (package--encode text)
76 " </li>\n")) 96 " </li>\n"))
77 97
78(defun package--update-file (file location text) 98(defun package--update-file (file tag text)
99 "Update the package archive file named FILE.
100FILE should be relative to `package-archive-upload-base'.
101TAG is a string that can be found within the file; TEXT is
102inserted after its first occurrence in the file."
103 (setq file (expand-file-name file package-archive-upload-base))
79 (save-excursion 104 (save-excursion
80 (let ((old-buffer (find-buffer-visiting file))) 105 (let ((old-buffer (find-buffer-visiting file)))
81 (with-current-buffer (let ((find-file-visit-truename t)) 106 (with-current-buffer (let ((find-file-visit-truename t))
82 (or old-buffer (find-file-noselect file))) 107 (or old-buffer (find-file-noselect file)))
83 (goto-char (point-min)) 108 (goto-char (point-min))
84 (search-forward location) 109 (search-forward tag)
85 (forward-line) 110 (forward-line)
86 (insert text) 111 (insert text)
87 (let ((file-precious-flag t)) 112 (let ((file-precious-flag t))
@@ -105,30 +130,31 @@ Return the file contents, as a string, or nil if unsuccessful."
105 (buffer-substring-no-properties (point-min) (point-max))) 130 (buffer-substring-no-properties (point-min) (point-max)))
106 (kill-buffer buffer)))))) 131 (kill-buffer buffer))))))
107 132
108(defun package--archive-contents-from-file (file) 133(defun package--archive-contents-from-file ()
109 "Parse the given archive-contents file." 134 "Parse the archive-contents at `package-archive-upload-base'"
110 (if (not (file-exists-p file)) 135 (let ((file (expand-file-name "archive-contents"
111 ;; no existing archive-contents, possibly a new ELPA repo. 136 package-archive-upload-base)))
112 (list package-archive-version) 137 (if (not (file-exists-p file))
113 (let ((dont-kill (find-buffer-visiting file))) 138 ;; No existing archive-contents means a new archive.
114 (with-current-buffer (let ((find-file-visit-truename t)) 139 (list package-archive-version)
115 (find-file-noselect file)) 140 (let ((dont-kill (find-buffer-visiting file)))
116 (prog1 141 (with-current-buffer (let ((find-file-visit-truename t))
117 (package-read-from-string 142 (find-file-noselect file))
118 (buffer-substring-no-properties (point-min) (point-max))) 143 (prog1
119 (unless dont-kill 144 (package-read-from-string
120 (kill-buffer (current-buffer)))))))) 145 (buffer-substring-no-properties (point-min) (point-max)))
146 (unless dont-kill
147 (kill-buffer (current-buffer)))))))))
121 148
122(defun package-maint-add-news-item (title description archive-url) 149(defun package-maint-add-news-item (title description archive-url)
123 "Add a news item to the ELPA web pages. 150 "Add a news item to the webpages associated with the package archive.
124TITLE is the title of the news item. 151TITLE is the title of the news item.
125DESCRIPTION is the text of the news item. 152DESCRIPTION is the text of the news item."
126You need administrative access to ELPA to use this."
127 (interactive "sTitle: \nsText: ") 153 (interactive "sTitle: \nsText: ")
128 (package--update-file (concat package-archive-upload-base "elpa.rss") 154 (package--update-file "elpa.rss"
129 "<description>" 155 "<description>"
130 (package--make-rss-entry title description archive-url)) 156 (package--make-rss-entry title description archive-url))
131 (package--update-file (concat package-archive-upload-base "news.html") 157 (package--update-file "news.html"
132 "New entries go here" 158 "New entries go here"
133 (package--make-html-entry title description))) 159 (package--make-html-entry title description)))
134 160
@@ -144,8 +170,8 @@ PKG-INFO is the package info, see `package-buffer-info'.
144EXTENSION is the file extension, a string. It can be either 170EXTENSION is the file extension, a string. It can be either
145\"el\" or \"tar\". 171\"el\" or \"tar\".
146 172
147The variable `package-archive-upload-base' specifies the upload 173The upload destination is given by `package-archive-upload-base'.
148destination. If this is nil, signal an error. 174If its value is invalid, prompt for a directory.
149 175
150Optional arg ARCHIVE-URL is the URL of the destination archive. 176Optional arg ARCHIVE-URL is the URL of the destination archive.
151If it is non-nil, compute the new \"archive-contents\" file 177If it is non-nil, compute the new \"archive-contents\" file
@@ -156,85 +182,97 @@ addition, if `package-update-news-on-upload' is non-nil, call
156If ARCHIVE-URL is nil, compute the new \"archive-contents\" file 182If ARCHIVE-URL is nil, compute the new \"archive-contents\" file
157from the \"archive-contents\" at `package-archive-upload-base', 183from the \"archive-contents\" at `package-archive-upload-base',
158if it exists." 184if it exists."
159 (unless package-archive-upload-base 185 (let ((package-archive-upload-base package-archive-upload-base))
160 (error "No destination specified in `package-archive-upload-base'")) 186 ;; Check if `package-archive-upload-base' is valid.
161 (save-excursion 187 (when (or (not (stringp package-archive-upload-base))
162 (save-restriction 188 (eq package-archive-upload-base
163 (let* ((file-type (cond 189 (car-safe
164 ((equal extension "el") 'single) 190 (get 'package-archive-upload-base 'standard-value))))
165 ((equal extension "tar") 'tar) 191 (setq package-archive-upload-base
166 (t (error "Unknown extension `%s'" extension)))) 192 (read-directory-name
167 (file-name (aref pkg-info 0)) 193 "Base directory for package archive: ")))
168 (pkg-name (intern file-name)) 194 (unless (file-directory-p package-archive-upload-base)
169 (requires (aref pkg-info 1)) 195 (if (y-or-n-p (format "%s does not exist; create it? "
170 (desc (if (string= (aref pkg-info 2) "") 196 package-archive-upload-base))
171 (read-string "Description of package: ") 197 (make-directory package-archive-upload-base t)
172 (aref pkg-info 2))) 198 (error "Aborted")))
173 (pkg-version (aref pkg-info 3)) 199 (save-excursion
174 (commentary (aref pkg-info 4)) 200 (save-restriction
175 (split-version (version-to-list pkg-version)) 201 (let* ((file-type (cond
176 (pkg-buffer (current-buffer))) 202 ((equal extension "el") 'single)
177 203 ((equal extension "tar") 'tar)
178 ;; Get archive-contents from ARCHIVE-URL if it's non-nil, or 204 (t (error "Unknown extension `%s'" extension))))
179 ;; from `package-archive-upload-base' otherwise. 205 (file-name (aref pkg-info 0))
180 (let ((contents (or (package--archive-contents-from-url archive-url) 206 (pkg-name (intern file-name))
181 (package--archive-contents-from-file 207 (requires (aref pkg-info 1))
182 (concat package-archive-upload-base 208 (desc (if (string= (aref pkg-info 2) "")
183 "archive-contents")))) 209 (read-string "Description of package: ")
184 (new-desc (vector split-version requires desc file-type))) 210 (aref pkg-info 2)))
185 (if (> (car contents) package-archive-version) 211 (pkg-version (aref pkg-info 3))
186 (error "Unrecognized archive version %d" (car contents))) 212 (commentary (aref pkg-info 4))
187 (let ((elt (assq pkg-name (cdr contents)))) 213 (split-version (version-to-list pkg-version))
188 (if elt 214 (pkg-buffer (current-buffer)))
189 (if (version-list-<= split-version 215
190 (package-desc-vers (cdr elt))) 216 ;; Get archive-contents from ARCHIVE-URL if it's non-nil, or
191 (error "New package has smaller version: %s" pkg-version) 217 ;; from `package-archive-upload-base' otherwise.
192 (setcdr elt new-desc)) 218 (let ((contents (or (package--archive-contents-from-url archive-url)
193 (setq contents (cons (car contents) 219 (package--archive-contents-from-file)))
194 (cons (cons pkg-name new-desc) 220 (new-desc (vector split-version requires desc file-type)))
195 (cdr contents)))))) 221 (if (> (car contents) package-archive-version)
196 222 (error "Unrecognized archive version %d" (car contents)))
197 ;; Now CONTENTS is the updated archive contents. Upload 223 (let ((elt (assq pkg-name (cdr contents))))
198 ;; this and the package itself. For now we assume ELPA is 224 (if elt
199 ;; writable via file primitives. 225 (if (version-list-<= split-version
200 (let ((print-level nil) 226 (package-desc-vers (cdr elt)))
201 (print-length nil)) 227 (error "New package has smaller version: %s" pkg-version)
202 (write-region (concat (pp-to-string contents) "\n") 228 (setcdr elt new-desc))
203 nil 229 (setq contents (cons (car contents)
204 (concat package-archive-upload-base 230 (cons (cons pkg-name new-desc)
205 "archive-contents"))) 231 (cdr contents))))))
206 232
207 ;; If there is a commentary section, write it. 233 ;; Now CONTENTS is the updated archive contents. Upload
208 (when commentary 234 ;; this and the package itself. For now we assume ELPA is
209 (write-region commentary nil 235 ;; writable via file primitives.
210 (concat package-archive-upload-base 236 (let ((print-level nil)
211 (symbol-name pkg-name) "-readme.txt"))) 237 (print-length nil))
212 238 (write-region (concat (pp-to-string contents) "\n")
213 (set-buffer pkg-buffer) 239 nil
214 (write-region (point-min) (point-max) 240 (expand-file-name "archive-contents"
215 (concat package-archive-upload-base 241 package-archive-upload-base)))
216 file-name "-" pkg-version 242
217 "." extension) 243 ;; If there is a commentary section, write it.
218 nil nil nil 'excl) 244 (when commentary
219 245 (write-region commentary nil
220 ;; Write a news entry. 246 (expand-file-name
221 (and package-update-news-on-upload 247 (concat (symbol-name pkg-name) "-readme.txt")
222 archive-url 248 package-archive-upload-base)))
223 (package--update-news (concat file-name "." extension) 249
224 pkg-version desc archive-url)) 250 (set-buffer pkg-buffer)
225 251 (write-region (point-min) (point-max)
226 ;; special-case "package": write a second copy so that the 252 (expand-file-name
227 ;; installer can easily find the latest version. 253 (concat file-name "-" pkg-version "." extension)
228 (if (string= file-name "package") 254 package-archive-upload-base)
229 (write-region (point-min) (point-max) 255 nil nil nil 'excl)
230 (concat package-archive-upload-base 256
231 file-name "." extension) 257 ;; Write a news entry.
232 nil nil nil 'ask))))))) 258 (and package-update-news-on-upload
259 archive-url
260 (package--update-news (concat file-name "." extension)
261 pkg-version desc archive-url))
262
263 ;; special-case "package": write a second copy so that the
264 ;; installer can easily find the latest version.
265 (if (string= file-name "package")
266 (write-region (point-min) (point-max)
267 (expand-file-name
268 (concat file-name "." extension)
269 package-archive-upload-base)
270 nil nil nil 'ask))))))))
233 271
234(defun package-upload-buffer () 272(defun package-upload-buffer ()
235 "Upload the current buffer as a single-file Emacs Lisp package. 273 "Upload the current buffer as a single-file Emacs Lisp package.
236The variable `package-archive-upload-base' specifies the upload 274If `package-archive-upload-base' does not specify a valid upload
237destination." 275destination, prompt for one."
238 (interactive) 276 (interactive)
239 (save-excursion 277 (save-excursion
240 (save-restriction 278 (save-restriction
@@ -247,9 +285,8 @@ destination."
247Interactively, prompt for FILE. The package is considered a 285Interactively, prompt for FILE. The package is considered a
248single-file package if FILE ends in \".el\", and a multi-file 286single-file package if FILE ends in \".el\", and a multi-file
249package if FILE ends in \".tar\". 287package if FILE ends in \".tar\".
250 288If `package-archive-upload-base' does not specify a valid upload
251The variable `package-archive-upload-base' specifies the upload 289destination, prompt for one."
252destination."
253 (interactive "fPackage file name: ") 290 (interactive "fPackage file name: ")
254 (with-temp-buffer 291 (with-temp-buffer
255 (insert-file-contents-literally file) 292 (insert-file-contents-literally file)
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 5aadac4a3b1..e13d9673514 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -464,7 +464,8 @@ This is like `describe-bindings', but displays only Isearch keys."
464 (define-key map "\C-w" 'isearch-yank-word-or-char) 464 (define-key map "\C-w" 'isearch-yank-word-or-char)
465 (define-key map "\M-\C-w" 'isearch-del-char) 465 (define-key map "\M-\C-w" 'isearch-del-char)
466 (define-key map "\M-\C-y" 'isearch-yank-char) 466 (define-key map "\M-\C-y" 'isearch-yank-char)
467 (define-key map "\C-y" 'isearch-yank-line) 467 (define-key map "\C-y" 'isearch-yank-kill)
468 (define-key map "\M-s\C-e" 'isearch-yank-line)
468 469
469 (define-key map (char-to-string help-char) isearch-help-map) 470 (define-key map (char-to-string help-char) isearch-help-map)
470 (define-key map [help] isearch-help-map) 471 (define-key map [help] isearch-help-map)
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 654323e03e4..5ef12300195 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -8725,841 +8725,841 @@ comment at the start of cc-engine.el for more info."
8725(defun c-guess-basic-syntax () 8725(defun c-guess-basic-syntax ()
8726 "Return the syntactic context of the current line." 8726 "Return the syntactic context of the current line."
8727 (save-excursion 8727 (save-excursion
8728 (beginning-of-line) 8728 (beginning-of-line)
8729 (c-save-buffer-state 8729 (c-save-buffer-state
8730 ((indent-point (point)) 8730 ((indent-point (point))
8731 (case-fold-search nil) 8731 (case-fold-search nil)
8732 ;; A whole ugly bunch of various temporary variables. Have 8732 ;; A whole ugly bunch of various temporary variables. Have
8733 ;; to declare them here since it's not possible to declare 8733 ;; to declare them here since it's not possible to declare
8734 ;; a variable with only the scope of a cond test and the 8734 ;; a variable with only the scope of a cond test and the
8735 ;; following result clauses, and most of this function is a 8735 ;; following result clauses, and most of this function is a
8736 ;; single gigantic cond. :P 8736 ;; single gigantic cond. :P
8737 literal char-before-ip before-ws-ip char-after-ip macro-start 8737 literal char-before-ip before-ws-ip char-after-ip macro-start
8738 in-macro-expr c-syntactic-context placeholder c-in-literal-cache 8738 in-macro-expr c-syntactic-context placeholder c-in-literal-cache
8739 step-type tmpsymbol keyword injava-inher special-brace-list tmp-pos 8739 step-type tmpsymbol keyword injava-inher special-brace-list tmp-pos
8740 containing-< 8740 containing-<
8741 ;; The following record some positions for the containing 8741 ;; The following record some positions for the containing
8742 ;; declaration block if we're directly within one: 8742 ;; declaration block if we're directly within one:
8743 ;; `containing-decl-open' is the position of the open 8743 ;; `containing-decl-open' is the position of the open
8744 ;; brace. `containing-decl-start' is the start of the 8744 ;; brace. `containing-decl-start' is the start of the
8745 ;; declaration. `containing-decl-kwd' is the keyword 8745 ;; declaration. `containing-decl-kwd' is the keyword
8746 ;; symbol of the keyword that tells what kind of block it 8746 ;; symbol of the keyword that tells what kind of block it
8747 ;; is. 8747 ;; is.
8748 containing-decl-open 8748 containing-decl-open
8749 containing-decl-start 8749 containing-decl-start
8750 containing-decl-kwd 8750 containing-decl-kwd
8751 ;; The open paren of the closest surrounding sexp or nil if 8751 ;; The open paren of the closest surrounding sexp or nil if
8752 ;; there is none. 8752 ;; there is none.
8753 containing-sexp 8753 containing-sexp
8754 ;; The position after the closest preceding brace sexp 8754 ;; The position after the closest preceding brace sexp
8755 ;; (nested sexps are ignored), or the position after 8755 ;; (nested sexps are ignored), or the position after
8756 ;; `containing-sexp' if there is none, or (point-min) if 8756 ;; `containing-sexp' if there is none, or (point-min) if
8757 ;; `containing-sexp' is nil. 8757 ;; `containing-sexp' is nil.
8758 lim 8758 lim
8759 ;; The paren state outside `containing-sexp', or at 8759 ;; The paren state outside `containing-sexp', or at
8760 ;; `indent-point' if `containing-sexp' is nil. 8760 ;; `indent-point' if `containing-sexp' is nil.
8761 (paren-state (c-parse-state)) 8761 (paren-state (c-parse-state))
8762 ;; There's always at most one syntactic element which got 8762 ;; There's always at most one syntactic element which got
8763 ;; an anchor pos. It's stored in syntactic-relpos. 8763 ;; an anchor pos. It's stored in syntactic-relpos.
8764 syntactic-relpos 8764 syntactic-relpos
8765 (c-stmt-delim-chars c-stmt-delim-chars)) 8765 (c-stmt-delim-chars c-stmt-delim-chars))
8766 8766
8767 ;; Check if we're directly inside an enclosing declaration 8767 ;; Check if we're directly inside an enclosing declaration
8768 ;; level block. 8768 ;; level block.
8769 (when (and (setq containing-sexp 8769 (when (and (setq containing-sexp
8770 (c-most-enclosing-brace paren-state)) 8770 (c-most-enclosing-brace paren-state))
8771 (progn 8771 (progn
8772 (goto-char containing-sexp) 8772 (goto-char containing-sexp)
8773 (eq (char-after) ?{)) 8773 (eq (char-after) ?{))
8774 (setq placeholder 8774 (setq placeholder
8775 (c-looking-at-decl-block 8775 (c-looking-at-decl-block
8776 (c-most-enclosing-brace paren-state 8776 (c-most-enclosing-brace paren-state
8777 containing-sexp) 8777 containing-sexp)
8778 t))) 8778 t)))
8779 (setq containing-decl-open containing-sexp 8779 (setq containing-decl-open containing-sexp
8780 containing-decl-start (point) 8780 containing-decl-start (point)
8781 containing-sexp nil) 8781 containing-sexp nil)
8782 (goto-char placeholder) 8782 (goto-char placeholder)
8783 (setq containing-decl-kwd (and (looking-at c-keywords-regexp) 8783 (setq containing-decl-kwd (and (looking-at c-keywords-regexp)
8784 (c-keyword-sym (match-string 1))))) 8784 (c-keyword-sym (match-string 1)))))
8785 8785
8786 ;; Init some position variables. 8786 ;; Init some position variables.
8787 (if c-state-cache 8787 (if c-state-cache
8788 (progn 8788 (progn
8789 (setq containing-sexp (car paren-state) 8789 (setq containing-sexp (car paren-state)
8790 paren-state (cdr paren-state)) 8790 paren-state (cdr paren-state))
8791 (if (consp containing-sexp) 8791 (if (consp containing-sexp)
8792 (progn 8792 (progn
8793 (setq lim (cdr containing-sexp)) 8793 (setq lim (cdr containing-sexp))
8794 (if (cdr c-state-cache) 8794 (if (cdr c-state-cache)
8795 ;; Ignore balanced paren. The next entry 8795 ;; Ignore balanced paren. The next entry
8796 ;; can't be another one. 8796 ;; can't be another one.
8797 (setq containing-sexp (car (cdr c-state-cache)) 8797 (setq containing-sexp (car (cdr c-state-cache))
8798 paren-state (cdr paren-state)) 8798 paren-state (cdr paren-state))
8799 ;; If there is no surrounding open paren then 8799 ;; If there is no surrounding open paren then
8800 ;; put the last balanced pair back on paren-state. 8800 ;; put the last balanced pair back on paren-state.
8801 (setq paren-state (cons containing-sexp paren-state) 8801 (setq paren-state (cons containing-sexp paren-state)
8802 containing-sexp nil))) 8802 containing-sexp nil)))
8803 (setq lim (1+ containing-sexp)))) 8803 (setq lim (1+ containing-sexp))))
8804 (setq lim (point-min))) 8804 (setq lim (point-min)))
8805 8805
8806 ;; If we're in a parenthesis list then ',' delimits the 8806 ;; If we're in a parenthesis list then ',' delimits the
8807 ;; "statements" rather than being an operator (with the 8807 ;; "statements" rather than being an operator (with the
8808 ;; exception of the "for" clause). This difference is 8808 ;; exception of the "for" clause). This difference is
8809 ;; typically only noticeable when statements are used in macro 8809 ;; typically only noticeable when statements are used in macro
8810 ;; arglists. 8810 ;; arglists.
8811 (when (and containing-sexp 8811 (when (and containing-sexp
8812 (eq (char-after containing-sexp) ?\()) 8812 (eq (char-after containing-sexp) ?\())
8813 (setq c-stmt-delim-chars c-stmt-delim-chars-with-comma)) 8813 (setq c-stmt-delim-chars c-stmt-delim-chars-with-comma))
8814 ;; cache char before and after indent point, and move point to 8814 ;; cache char before and after indent point, and move point to
8815 ;; the most likely position to perform the majority of tests 8815 ;; the most likely position to perform the majority of tests
8816 (goto-char indent-point) 8816 (goto-char indent-point)
8817 (c-backward-syntactic-ws lim) 8817 (c-backward-syntactic-ws lim)
8818 (setq before-ws-ip (point) 8818 (setq before-ws-ip (point)
8819 char-before-ip (char-before)) 8819 char-before-ip (char-before))
8820 (goto-char indent-point) 8820 (goto-char indent-point)
8821 (skip-chars-forward " \t") 8821 (skip-chars-forward " \t")
8822 (setq char-after-ip (char-after)) 8822 (setq char-after-ip (char-after))
8823 8823
8824 ;; are we in a literal? 8824 ;; are we in a literal?
8825 (setq literal (c-in-literal lim)) 8825 (setq literal (c-in-literal lim))
8826 8826
8827 ;; now figure out syntactic qualities of the current line 8827 ;; now figure out syntactic qualities of the current line
8828 (cond 8828 (cond
8829 8829
8830 ;; CASE 1: in a string. 8830 ;; CASE 1: in a string.
8831 ((eq literal 'string) 8831 ((eq literal 'string)
8832 (c-add-syntax 'string (c-point 'bopl))) 8832 (c-add-syntax 'string (c-point 'bopl)))
8833 8833
8834 ;; CASE 2: in a C or C++ style comment. 8834 ;; CASE 2: in a C or C++ style comment.
8835 ((and (memq literal '(c c++)) 8835 ((and (memq literal '(c c++))
8836 ;; This is a kludge for XEmacs where we use 8836 ;; This is a kludge for XEmacs where we use
8837 ;; `buffer-syntactic-context', which doesn't correctly 8837 ;; `buffer-syntactic-context', which doesn't correctly
8838 ;; recognize "\*/" to end a block comment. 8838 ;; recognize "\*/" to end a block comment.
8839 ;; `parse-partial-sexp' which is used by 8839 ;; `parse-partial-sexp' which is used by
8840 ;; `c-literal-limits' will however do that in most 8840 ;; `c-literal-limits' will however do that in most
8841 ;; versions, which results in that we get nil from 8841 ;; versions, which results in that we get nil from
8842 ;; `c-literal-limits' even when `c-in-literal' claims 8842 ;; `c-literal-limits' even when `c-in-literal' claims
8843 ;; we're inside a comment. 8843 ;; we're inside a comment.
8844 (setq placeholder (c-literal-limits lim))) 8844 (setq placeholder (c-literal-limits lim)))
8845 (c-add-syntax literal (car placeholder))) 8845 (c-add-syntax literal (car placeholder)))
8846 8846
8847 ;; CASE 3: in a cpp preprocessor macro continuation. 8847 ;; CASE 3: in a cpp preprocessor macro continuation.
8848 ((and (save-excursion 8848 ((and (save-excursion
8849 (when (c-beginning-of-macro) 8849 (when (c-beginning-of-macro)
8850 (setq macro-start (point)))) 8850 (setq macro-start (point))))
8851 (/= macro-start (c-point 'boi)) 8851 (/= macro-start (c-point 'boi))
8852 (progn 8852 (progn
8853 (setq tmpsymbol 'cpp-macro-cont) 8853 (setq tmpsymbol 'cpp-macro-cont)
8854 (or (not c-syntactic-indentation-in-macros) 8854 (or (not c-syntactic-indentation-in-macros)
8855 (save-excursion 8855 (save-excursion
8856 (goto-char macro-start) 8856 (goto-char macro-start)
8857 ;; If at the beginning of the body of a #define 8857 ;; If at the beginning of the body of a #define
8858 ;; directive then analyze as cpp-define-intro 8858 ;; directive then analyze as cpp-define-intro
8859 ;; only. Go on with the syntactic analysis 8859 ;; only. Go on with the syntactic analysis
8860 ;; otherwise. in-macro-expr is set if we're in a 8860 ;; otherwise. in-macro-expr is set if we're in a
8861 ;; cpp expression, i.e. before the #define body 8861 ;; cpp expression, i.e. before the #define body
8862 ;; or anywhere in a non-#define directive. 8862 ;; or anywhere in a non-#define directive.
8863 (if (c-forward-to-cpp-define-body) 8863 (if (c-forward-to-cpp-define-body)
8864 (let ((indent-boi (c-point 'boi indent-point))) 8864 (let ((indent-boi (c-point 'boi indent-point)))
8865 (setq in-macro-expr (> (point) indent-boi) 8865 (setq in-macro-expr (> (point) indent-boi)
8866 tmpsymbol 'cpp-define-intro) 8866 tmpsymbol 'cpp-define-intro)
8867 (= (point) indent-boi)) 8867 (= (point) indent-boi))
8868 (setq in-macro-expr t) 8868 (setq in-macro-expr t)
8869 nil))))) 8869 nil)))))
8870 (c-add-syntax tmpsymbol macro-start) 8870 (c-add-syntax tmpsymbol macro-start)
8871 (setq macro-start nil)) 8871 (setq macro-start nil))
8872 8872
8873 ;; CASE 11: an else clause? 8873 ;; CASE 11: an else clause?
8874 ((looking-at "else\\>[^_]") 8874 ((looking-at "else\\>[^_]")
8875 (c-beginning-of-statement-1 containing-sexp) 8875 (c-beginning-of-statement-1 containing-sexp)
8876 (c-add-stmt-syntax 'else-clause nil t 8876 (c-add-stmt-syntax 'else-clause nil t
8877 containing-sexp paren-state)) 8877 containing-sexp paren-state))
8878 8878
8879 ;; CASE 12: while closure of a do/while construct? 8879 ;; CASE 12: while closure of a do/while construct?
8880 ((and (looking-at "while\\>[^_]") 8880 ((and (looking-at "while\\>[^_]")
8881 (save-excursion 8881 (save-excursion
8882 (prog1 (eq (c-beginning-of-statement-1 containing-sexp) 8882 (prog1 (eq (c-beginning-of-statement-1 containing-sexp)
8883 'beginning) 8883 'beginning)
8884 (setq placeholder (point))))) 8884 (setq placeholder (point)))))
8885 (goto-char placeholder) 8885 (goto-char placeholder)
8886 (c-add-stmt-syntax 'do-while-closure nil t 8886 (c-add-stmt-syntax 'do-while-closure nil t
8887 containing-sexp paren-state)) 8887 containing-sexp paren-state))
8888 8888
8889 ;; CASE 13: A catch or finally clause? This case is simpler 8889 ;; CASE 13: A catch or finally clause? This case is simpler
8890 ;; than if-else and do-while, because a block is required 8890 ;; than if-else and do-while, because a block is required
8891 ;; after every try, catch and finally. 8891 ;; after every try, catch and finally.
8892 ((save-excursion 8892 ((save-excursion
8893 (and (cond ((c-major-mode-is 'c++-mode) 8893 (and (cond ((c-major-mode-is 'c++-mode)
8894 (looking-at "catch\\>[^_]")) 8894 (looking-at "catch\\>[^_]"))
8895 ((c-major-mode-is 'java-mode) 8895 ((c-major-mode-is 'java-mode)
8896 (looking-at "\\(catch\\|finally\\)\\>[^_]"))) 8896 (looking-at "\\(catch\\|finally\\)\\>[^_]")))
8897 (and (c-safe (c-backward-syntactic-ws) 8897 (and (c-safe (c-backward-syntactic-ws)
8898 (c-backward-sexp) 8898 (c-backward-sexp)
8899 t) 8899 t)
8900 (eq (char-after) ?{) 8900 (eq (char-after) ?{)
8901 (c-safe (c-backward-syntactic-ws) 8901 (c-safe (c-backward-syntactic-ws)
8902 (c-backward-sexp) 8902 (c-backward-sexp)
8903 t) 8903 t)
8904 (if (eq (char-after) ?\() 8904 (if (eq (char-after) ?\()
8905 (c-safe (c-backward-sexp) t) 8905 (c-safe (c-backward-sexp) t)
8906 t)) 8906 t))
8907 (looking-at "\\(try\\|catch\\)\\>[^_]") 8907 (looking-at "\\(try\\|catch\\)\\>[^_]")
8908 (setq placeholder (point)))) 8908 (setq placeholder (point))))
8909 (goto-char placeholder) 8909 (goto-char placeholder)
8910 (c-add-stmt-syntax 'catch-clause nil t 8910 (c-add-stmt-syntax 'catch-clause nil t
8911 containing-sexp paren-state)) 8911 containing-sexp paren-state))
8912 8912
8913 ;; CASE 18: A substatement we can recognize by keyword. 8913 ;; CASE 18: A substatement we can recognize by keyword.
8914 ((save-excursion 8914 ((save-excursion
8915 (and c-opt-block-stmt-key 8915 (and c-opt-block-stmt-key
8916 (not (eq char-before-ip ?\;)) 8916 (not (eq char-before-ip ?\;))
8917 (not (c-at-vsemi-p before-ws-ip)) 8917 (not (c-at-vsemi-p before-ws-ip))
8918 (not (memq char-after-ip '(?\) ?\] ?,))) 8918 (not (memq char-after-ip '(?\) ?\] ?,)))
8919 (or (not (eq char-before-ip ?})) 8919 (or (not (eq char-before-ip ?}))
8920 (c-looking-at-inexpr-block-backward c-state-cache)) 8920 (c-looking-at-inexpr-block-backward c-state-cache))
8921 (> (point) 8921 (> (point)
8922 (progn 8922 (progn
8923 ;; Ought to cache the result from the 8923 ;; Ought to cache the result from the
8924 ;; c-beginning-of-statement-1 calls here. 8924 ;; c-beginning-of-statement-1 calls here.
8925 (setq placeholder (point))
8926 (while (eq (setq step-type
8927 (c-beginning-of-statement-1 lim))
8928 'label))
8929 (if (eq step-type 'previous)
8930 (goto-char placeholder)
8925 (setq placeholder (point)) 8931 (setq placeholder (point))
8926 (while (eq (setq step-type 8932 (if (and (eq step-type 'same)
8927 (c-beginning-of-statement-1 lim)) 8933 (not (looking-at c-opt-block-stmt-key)))
8928 'label)) 8934 ;; Step up to the containing statement if we
8929 (if (eq step-type 'previous) 8935 ;; stayed in the same one.
8930 (goto-char placeholder) 8936 (let (step)
8931 (setq placeholder (point)) 8937 (while (eq
8932 (if (and (eq step-type 'same) 8938 (setq step
8933 (not (looking-at c-opt-block-stmt-key))) 8939 (c-beginning-of-statement-1 lim))
8934 ;; Step up to the containing statement if we 8940 'label))
8935 ;; stayed in the same one. 8941 (if (eq step 'up)
8936 (let (step) 8942 (setq placeholder (point))
8937 (while (eq 8943 ;; There was no containing statement afterall.
8938 (setq step 8944 (goto-char placeholder)))))
8939 (c-beginning-of-statement-1 lim)) 8945 placeholder))
8940 'label)) 8946 (if (looking-at c-block-stmt-2-key)
8941 (if (eq step 'up) 8947 ;; Require a parenthesis after these keywords.
8942 (setq placeholder (point)) 8948 ;; Necessary to catch e.g. synchronized in Java,
8943 ;; There was no containing statement afterall. 8949 ;; which can be used both as statement and
8944 (goto-char placeholder))))) 8950 ;; modifier.
8945 placeholder)) 8951 (and (zerop (c-forward-token-2 1 nil))
8946 (if (looking-at c-block-stmt-2-key) 8952 (eq (char-after) ?\())
8947 ;; Require a parenthesis after these keywords. 8953 (looking-at c-opt-block-stmt-key))))
8948 ;; Necessary to catch e.g. synchronized in Java, 8954
8949 ;; which can be used both as statement and 8955 (if (eq step-type 'up)
8950 ;; modifier. 8956 ;; CASE 18A: Simple substatement.
8951 (and (zerop (c-forward-token-2 1 nil)) 8957 (progn
8952 (eq (char-after) ?\()) 8958 (goto-char placeholder)
8953 (looking-at c-opt-block-stmt-key)))) 8959 (cond
8954 8960 ((eq char-after-ip ?{)
8955 (if (eq step-type 'up) 8961 (c-add-stmt-syntax 'substatement-open nil nil
8956 ;; CASE 18A: Simple substatement. 8962 containing-sexp paren-state))
8957 (progn 8963 ((save-excursion
8958 (goto-char placeholder) 8964 (goto-char indent-point)
8959 (cond 8965 (back-to-indentation)
8960 ((eq char-after-ip ?{) 8966 (c-forward-label))
8961 (c-add-stmt-syntax 'substatement-open nil nil 8967 (c-add-stmt-syntax 'substatement-label nil nil
8962 containing-sexp paren-state)) 8968 containing-sexp paren-state))
8963 ((save-excursion 8969 (t
8964 (goto-char indent-point) 8970 (c-add-stmt-syntax 'substatement nil nil
8965 (back-to-indentation) 8971 containing-sexp paren-state))))
8966 (c-forward-label)) 8972
8967 (c-add-stmt-syntax 'substatement-label nil nil 8973 ;; CASE 18B: Some other substatement. This is shared
8968 containing-sexp paren-state)) 8974 ;; with case 10.
8969 (t 8975 (c-guess-continued-construct indent-point
8970 (c-add-stmt-syntax 'substatement nil nil 8976 char-after-ip
8971 containing-sexp paren-state)))) 8977 placeholder
8972 8978 lim
8973 ;; CASE 18B: Some other substatement. This is shared 8979 paren-state)))
8974 ;; with case 10.
8975 (c-guess-continued-construct indent-point
8976 char-after-ip
8977 placeholder
8978 lim
8979 paren-state)))
8980
8981 ;; CASE 14: A case or default label
8982 ((looking-at c-label-kwds-regexp)
8983 (if containing-sexp
8984 (progn
8985 (goto-char containing-sexp)
8986 (setq lim (c-most-enclosing-brace c-state-cache
8987 containing-sexp))
8988 (c-backward-to-block-anchor lim)
8989 (c-add-stmt-syntax 'case-label nil t lim paren-state))
8990 ;; Got a bogus label at the top level. In lack of better
8991 ;; alternatives, anchor it on (point-min).
8992 (c-add-syntax 'case-label (point-min))))
8993
8994 ;; CASE 15: any other label
8995 ((save-excursion
8996 (back-to-indentation)
8997 (and (not (looking-at c-syntactic-ws-start))
8998 (c-forward-label)))
8999 (cond (containing-decl-open
9000 (setq placeholder (c-add-class-syntax 'inclass
9001 containing-decl-open
9002 containing-decl-start
9003 containing-decl-kwd
9004 paren-state))
9005 ;; Append access-label with the same anchor point as
9006 ;; inclass gets.
9007 (c-append-syntax 'access-label placeholder))
9008
9009 (containing-sexp
9010 (goto-char containing-sexp)
9011 (setq lim (c-most-enclosing-brace c-state-cache
9012 containing-sexp))
9013 (save-excursion
9014 (setq tmpsymbol
9015 (if (and (eq (c-beginning-of-statement-1 lim) 'up)
9016 (looking-at "switch\\>[^_]"))
9017 ;; If the surrounding statement is a switch then
9018 ;; let's analyze all labels as switch labels, so
9019 ;; that they get lined up consistently.
9020 'case-label
9021 'label)))
9022 (c-backward-to-block-anchor lim)
9023 (c-add-stmt-syntax tmpsymbol nil t lim paren-state))
9024 8980
9025 (t 8981 ;; CASE 14: A case or default label
9026 ;; A label on the top level. Treat it as a class 8982 ((looking-at c-label-kwds-regexp)
9027 ;; context. (point-min) is the closest we get to the 8983 (if containing-sexp
9028 ;; class open brace. 8984 (progn
9029 (c-add-syntax 'access-label (point-min))))) 8985 (goto-char containing-sexp)
8986 (setq lim (c-most-enclosing-brace c-state-cache
8987 containing-sexp))
8988 (c-backward-to-block-anchor lim)
8989 (c-add-stmt-syntax 'case-label nil t lim paren-state))
8990 ;; Got a bogus label at the top level. In lack of better
8991 ;; alternatives, anchor it on (point-min).
8992 (c-add-syntax 'case-label (point-min))))
9030 8993
9031 ;; CASE 4: In-expression statement. C.f. cases 7B, 16A and 8994 ;; CASE 15: any other label
9032 ;; 17E. 8995 ((save-excursion
9033 ((setq placeholder (c-looking-at-inexpr-block
9034 (c-safe-position containing-sexp paren-state)
9035 containing-sexp
9036 ;; Have to turn on the heuristics after
9037 ;; the point even though it doesn't work
9038 ;; very well. C.f. test case class-16.pike.
9039 t))
9040 (setq tmpsymbol (assq (car placeholder)
9041 '((inexpr-class . class-open)
9042 (inexpr-statement . block-open))))
9043 (if tmpsymbol
9044 ;; It's a statement block or an anonymous class.
9045 (setq tmpsymbol (cdr tmpsymbol))
9046 ;; It's a Pike lambda. Check whether we are between the
9047 ;; lambda keyword and the argument list or at the defun
9048 ;; opener.
9049 (setq tmpsymbol (if (eq char-after-ip ?{)
9050 'inline-open
9051 'lambda-intro-cont)))
9052 (goto-char (cdr placeholder))
9053 (back-to-indentation) 8996 (back-to-indentation)
9054 (c-add-stmt-syntax tmpsymbol nil t 8997 (and (not (looking-at c-syntactic-ws-start))
9055 (c-most-enclosing-brace c-state-cache (point)) 8998 (c-forward-label)))
9056 paren-state) 8999 (cond (containing-decl-open
9057 (unless (eq (point) (cdr placeholder)) 9000 (setq placeholder (c-add-class-syntax 'inclass
9058 (c-add-syntax (car placeholder)))) 9001 containing-decl-open
9059 9002 containing-decl-start
9060 ;; CASE 5: Line is inside a declaration level block or at top level. 9003 containing-decl-kwd
9061 ((or containing-decl-open (null containing-sexp)) 9004 paren-state))
9062 (cond 9005 ;; Append access-label with the same anchor point as
9063 9006 ;; inclass gets.
9064 ;; CASE 5A: we are looking at a defun, brace list, class, 9007 (c-append-syntax 'access-label placeholder))
9065 ;; or inline-inclass method opening brace 9008
9066 ((setq special-brace-list 9009 (containing-sexp
9067 (or (and c-special-brace-lists 9010 (goto-char containing-sexp)
9068 (c-looking-at-special-brace-list)) 9011 (setq lim (c-most-enclosing-brace c-state-cache
9069 (eq char-after-ip ?{))) 9012 containing-sexp))
9070 (cond 9013 (save-excursion
9014 (setq tmpsymbol
9015 (if (and (eq (c-beginning-of-statement-1 lim) 'up)
9016 (looking-at "switch\\>[^_]"))
9017 ;; If the surrounding statement is a switch then
9018 ;; let's analyze all labels as switch labels, so
9019 ;; that they get lined up consistently.
9020 'case-label
9021 'label)))
9022 (c-backward-to-block-anchor lim)
9023 (c-add-stmt-syntax tmpsymbol nil t lim paren-state))
9071 9024
9072 ;; CASE 5A.1: Non-class declaration block open. 9025 (t
9073 ((save-excursion 9026 ;; A label on the top level. Treat it as a class
9074 (let (tmp) 9027 ;; context. (point-min) is the closest we get to the
9075 (and (eq char-after-ip ?{) 9028 ;; class open brace.
9076 (setq tmp (c-looking-at-decl-block containing-sexp t)) 9029 (c-add-syntax 'access-label (point-min)))))
9077 (progn 9030
9078 (setq placeholder (point)) 9031 ;; CASE 4: In-expression statement. C.f. cases 7B, 16A and
9079 (goto-char tmp) 9032 ;; 17E.
9080 (looking-at c-symbol-key)) 9033 ((setq placeholder (c-looking-at-inexpr-block
9081 (c-keyword-member 9034 (c-safe-position containing-sexp paren-state)
9082 (c-keyword-sym (setq keyword (match-string 0))) 9035 containing-sexp
9083 'c-other-block-decl-kwds)))) 9036 ;; Have to turn on the heuristics after
9084 (goto-char placeholder) 9037 ;; the point even though it doesn't work
9085 (c-add-stmt-syntax 9038 ;; very well. C.f. test case class-16.pike.
9086 (if (string-equal keyword "extern") 9039 t))
9087 ;; Special case for extern-lang-open. 9040 (setq tmpsymbol (assq (car placeholder)
9088 'extern-lang-open 9041 '((inexpr-class . class-open)
9089 (intern (concat keyword "-open"))) 9042 (inexpr-statement . block-open))))
9090 nil t containing-sexp paren-state)) 9043 (if tmpsymbol
9091 9044 ;; It's a statement block or an anonymous class.
9092 ;; CASE 5A.2: we are looking at a class opening brace 9045 (setq tmpsymbol (cdr tmpsymbol))
9093 ((save-excursion 9046 ;; It's a Pike lambda. Check whether we are between the
9094 (goto-char indent-point) 9047 ;; lambda keyword and the argument list or at the defun
9095 (skip-chars-forward " \t") 9048 ;; opener.
9096 (and (eq (char-after) ?{) 9049 (setq tmpsymbol (if (eq char-after-ip ?{)
9097 (c-looking-at-decl-block containing-sexp t) 9050 'inline-open
9098 (setq placeholder (point)))) 9051 'lambda-intro-cont)))
9099 (c-add-syntax 'class-open placeholder)) 9052 (goto-char (cdr placeholder))
9100 9053 (back-to-indentation)
9101 ;; CASE 5A.3: brace list open 9054 (c-add-stmt-syntax tmpsymbol nil t
9102 ((save-excursion 9055 (c-most-enclosing-brace c-state-cache (point))
9103 (c-beginning-of-decl-1 lim) 9056 paren-state)
9104 (while (looking-at c-specifier-key) 9057 (unless (eq (point) (cdr placeholder))
9105 (goto-char (match-end 1)) 9058 (c-add-syntax (car placeholder))))
9106 (c-forward-syntactic-ws indent-point))
9107 (setq placeholder (c-point 'boi))
9108 (or (consp special-brace-list)
9109 (and (or (save-excursion
9110 (goto-char indent-point)
9111 (setq tmpsymbol nil)
9112 (while (and (> (point) placeholder)
9113 (zerop (c-backward-token-2 1 t))
9114 (/= (char-after) ?=))
9115 (and c-opt-inexpr-brace-list-key
9116 (not tmpsymbol)
9117 (looking-at c-opt-inexpr-brace-list-key)
9118 (setq tmpsymbol 'topmost-intro-cont)))
9119 (eq (char-after) ?=))
9120 (looking-at c-brace-list-key))
9121 (save-excursion
9122 (while (and (< (point) indent-point)
9123 (zerop (c-forward-token-2 1 t))
9124 (not (memq (char-after) '(?\; ?\()))))
9125 (not (memq (char-after) '(?\; ?\()))
9126 ))))
9127 (if (and (not c-auto-newline-analysis)
9128 (c-major-mode-is 'java-mode)
9129 (eq tmpsymbol 'topmost-intro-cont))
9130 ;; We're in Java and have found that the open brace
9131 ;; belongs to a "new Foo[]" initialization list,
9132 ;; which means the brace list is part of an
9133 ;; expression and not a top level definition. We
9134 ;; therefore treat it as any topmost continuation
9135 ;; even though the semantically correct symbol still
9136 ;; is brace-list-open, on the same grounds as in
9137 ;; case B.2.
9138 (progn
9139 (c-beginning-of-statement-1 lim)
9140 (c-add-syntax 'topmost-intro-cont (c-point 'boi)))
9141 (c-add-syntax 'brace-list-open placeholder)))
9142
9143 ;; CASE 5A.4: inline defun open
9144 ((and containing-decl-open
9145 (not (c-keyword-member containing-decl-kwd
9146 'c-other-block-decl-kwds)))
9147 (c-add-syntax 'inline-open)
9148 (c-add-class-syntax 'inclass
9149 containing-decl-open
9150 containing-decl-start
9151 containing-decl-kwd
9152 paren-state))
9153
9154 ;; CASE 5A.5: ordinary defun open
9155 (t
9156 (save-excursion
9157 (c-beginning-of-decl-1 lim)
9158 (while (looking-at c-specifier-key)
9159 (goto-char (match-end 1))
9160 (c-forward-syntactic-ws indent-point))
9161 (c-add-syntax 'defun-open (c-point 'boi))
9162 ;; Bogus to use bol here, but it's the legacy. (Resolved,
9163 ;; 2007-11-09)
9164 ))))
9165
9166 ;; CASE 5B: After a function header but before the body (or
9167 ;; the ending semicolon if there's no body).
9168 ((save-excursion
9169 (when (setq placeholder (c-just-after-func-arglist-p lim))
9170 (setq tmp-pos (point))))
9171 (cond
9172 9059
9173 ;; CASE 5B.1: Member init list. 9060 ;; CASE 5: Line is inside a declaration level block or at top level.
9174 ((eq (char-after tmp-pos) ?:) 9061 ((or containing-decl-open (null containing-sexp))
9175 (if (or (> tmp-pos indent-point) 9062 (cond
9176 (= (c-point 'bosws) (1+ tmp-pos)))
9177 (progn
9178 ;; There is no preceding member init clause.
9179 ;; Indent relative to the beginning of indentation
9180 ;; for the topmost-intro line that contains the
9181 ;; prototype's open paren.
9182 (goto-char placeholder)
9183 (c-add-syntax 'member-init-intro (c-point 'boi)))
9184 ;; Indent relative to the first member init clause.
9185 (goto-char (1+ tmp-pos))
9186 (c-forward-syntactic-ws)
9187 (c-add-syntax 'member-init-cont (point))))
9188 9063
9189 ;; CASE 5B.2: K&R arg decl intro 9064 ;; CASE 5A: we are looking at a defun, brace list, class,
9190 ((and c-recognize-knr-p 9065 ;; or inline-inclass method opening brace
9191 (c-in-knr-argdecl lim)) 9066 ((setq special-brace-list
9192 (c-beginning-of-statement-1 lim) 9067 (or (and c-special-brace-lists
9193 (c-add-syntax 'knr-argdecl-intro (c-point 'boi)) 9068 (c-looking-at-special-brace-list))
9194 (if containing-decl-open 9069 (eq char-after-ip ?{)))
9195 (c-add-class-syntax 'inclass 9070 (cond
9196 containing-decl-open
9197 containing-decl-start
9198 containing-decl-kwd
9199 paren-state)))
9200
9201 ;; CASE 5B.4: Nether region after a C++ or Java func
9202 ;; decl, which could include a `throws' declaration.
9203 (t
9204 (c-beginning-of-statement-1 lim)
9205 (c-add-syntax 'func-decl-cont (c-point 'boi))
9206 )))
9207 9071
9208 ;; CASE 5C: inheritance line. could be first inheritance 9072 ;; CASE 5A.1: Non-class declaration block open.
9209 ;; line, or continuation of a multiple inheritance 9073 ((save-excursion
9210 ((or (and (c-major-mode-is 'c++-mode) 9074 (let (tmp)
9075 (and (eq char-after-ip ?{)
9076 (setq tmp (c-looking-at-decl-block containing-sexp t))
9211 (progn 9077 (progn
9212 (when (eq char-after-ip ?,) 9078 (setq placeholder (point))
9213 (skip-chars-forward " \t") 9079 (goto-char tmp)
9214 (forward-char)) 9080 (looking-at c-symbol-key))
9215 (looking-at c-opt-postfix-decl-spec-key))) 9081 (c-keyword-member
9216 (and (or (eq char-before-ip ?:) 9082 (c-keyword-sym (setq keyword (match-string 0)))
9217 ;; watch out for scope operator 9083 'c-other-block-decl-kwds))))
9218 (save-excursion 9084 (goto-char placeholder)
9219 (and (eq char-after-ip ?:) 9085 (c-add-stmt-syntax
9220 (c-safe (forward-char 1) t) 9086 (if (string-equal keyword "extern")
9221 (not (eq (char-after) ?:)) 9087 ;; Special case for extern-lang-open.
9222 ))) 9088 'extern-lang-open
9223 (save-excursion 9089 (intern (concat keyword "-open")))
9224 (c-backward-syntactic-ws lim) 9090 nil t containing-sexp paren-state))
9225 (if (eq char-before-ip ?:)
9226 (progn
9227 (forward-char -1)
9228 (c-backward-syntactic-ws lim)))
9229 (back-to-indentation)
9230 (looking-at c-class-key)))
9231 ;; for Java
9232 (and (c-major-mode-is 'java-mode)
9233 (let ((fence (save-excursion
9234 (c-beginning-of-statement-1 lim)
9235 (point)))
9236 cont done)
9237 (save-excursion
9238 (while (not done)
9239 (cond ((looking-at c-opt-postfix-decl-spec-key)
9240 (setq injava-inher (cons cont (point))
9241 done t))
9242 ((or (not (c-safe (c-forward-sexp -1) t))
9243 (<= (point) fence))
9244 (setq done t))
9245 )
9246 (setq cont t)))
9247 injava-inher)
9248 (not (c-crosses-statement-barrier-p (cdr injava-inher)
9249 (point)))
9250 ))
9251 (cond
9252
9253 ;; CASE 5C.1: non-hanging colon on an inher intro
9254 ((eq char-after-ip ?:)
9255 (c-beginning-of-statement-1 lim)
9256 (c-add-syntax 'inher-intro (c-point 'boi))
9257 ;; don't add inclass symbol since relative point already
9258 ;; contains any class offset
9259 )
9260 9091
9261 ;; CASE 5C.2: hanging colon on an inher intro 9092 ;; CASE 5A.2: we are looking at a class opening brace
9262 ((eq char-before-ip ?:)
9263 (c-beginning-of-statement-1 lim)
9264 (c-add-syntax 'inher-intro (c-point 'boi))
9265 (if containing-decl-open
9266 (c-add-class-syntax 'inclass
9267 containing-decl-open
9268 containing-decl-start
9269 containing-decl-kwd
9270 paren-state)))
9271
9272 ;; CASE 5C.3: in a Java implements/extends
9273 (injava-inher
9274 (let ((where (cdr injava-inher))
9275 (cont (car injava-inher)))
9276 (goto-char where)
9277 (cond ((looking-at "throws\\>[^_]")
9278 (c-add-syntax 'func-decl-cont
9279 (progn (c-beginning-of-statement-1 lim)
9280 (c-point 'boi))))
9281 (cont (c-add-syntax 'inher-cont where))
9282 (t (c-add-syntax 'inher-intro
9283 (progn (goto-char (cdr injava-inher))
9284 (c-beginning-of-statement-1 lim)
9285 (point))))
9286 )))
9287
9288 ;; CASE 5C.4: a continued inheritance line
9289 (t
9290 (c-beginning-of-inheritance-list lim)
9291 (c-add-syntax 'inher-cont (point))
9292 ;; don't add inclass symbol since relative point already
9293 ;; contains any class offset
9294 )))
9295
9296 ;; CASE 5D: this could be a top-level initialization, a
9297 ;; member init list continuation, or a template argument
9298 ;; list continuation.
9299 ((save-excursion 9093 ((save-excursion
9300 ;; Note: We use the fact that lim is always after any 9094 (goto-char indent-point)
9301 ;; preceding brace sexp. 9095 (skip-chars-forward " \t")
9302 (if c-recognize-<>-arglists 9096 (and (eq (char-after) ?{)
9303 (while (and 9097 (c-looking-at-decl-block containing-sexp t)
9304 (progn 9098 (setq placeholder (point))))
9305 (c-syntactic-skip-backward "^;,=<>" lim t) 9099 (c-add-syntax 'class-open placeholder))
9306 (> (point) lim)) 9100
9307 (or 9101 ;; CASE 5A.3: brace list open
9308 (when c-overloadable-operators-regexp 9102 ((save-excursion
9309 (when (setq placeholder (c-after-special-operator-id lim)) 9103 (c-beginning-of-decl-1 lim)
9310 (goto-char placeholder) 9104 (while (looking-at c-specifier-key)
9311 t)) 9105 (goto-char (match-end 1))
9312 (cond 9106 (c-forward-syntactic-ws indent-point))
9313 ((eq (char-before) ?>) 9107 (setq placeholder (c-point 'boi))
9314 (or (c-backward-<>-arglist nil lim) 9108 (or (consp special-brace-list)
9315 (backward-char)) 9109 (and (or (save-excursion
9316 t) 9110 (goto-char indent-point)
9317 ((eq (char-before) ?<) 9111 (setq tmpsymbol nil)
9318 (backward-char) 9112 (while (and (> (point) placeholder)
9319 (if (save-excursion 9113 (zerop (c-backward-token-2 1 t))
9320 (c-forward-<>-arglist nil)) 9114 (/= (char-after) ?=))
9321 (progn (forward-char) 9115 (and c-opt-inexpr-brace-list-key
9322 nil) 9116 (not tmpsymbol)
9323 t)) 9117 (looking-at c-opt-inexpr-brace-list-key)
9324 (t nil))))) 9118 (setq tmpsymbol 'topmost-intro-cont)))
9325 ;; NB: No c-after-special-operator-id stuff in this 9119 (eq (char-after) ?=))
9326 ;; clause - we assume only C++ needs it. 9120 (looking-at c-brace-list-key))
9327 (c-syntactic-skip-backward "^;,=" lim t)) 9121 (save-excursion
9328 (memq (char-before) '(?, ?= ?<))) 9122 (while (and (< (point) indent-point)
9329 (cond 9123 (zerop (c-forward-token-2 1 t))
9330 9124 (not (memq (char-after) '(?\; ?\()))))
9331 ;; CASE 5D.3: perhaps a template list continuation? 9125 (not (memq (char-after) '(?\; ?\()))
9332 ((and (c-major-mode-is 'c++-mode) 9126 ))))
9333 (save-excursion 9127 (if (and (not c-auto-newline-analysis)
9334 (save-restriction 9128 (c-major-mode-is 'java-mode)
9335 (c-with-syntax-table c++-template-syntax-table 9129 (eq tmpsymbol 'topmost-intro-cont))
9336 (goto-char indent-point) 9130 ;; We're in Java and have found that the open brace
9337 (setq placeholder (c-up-list-backward)) 9131 ;; belongs to a "new Foo[]" initialization list,
9338 (and placeholder 9132 ;; which means the brace list is part of an
9339 (eq (char-after placeholder) ?<)))))) 9133 ;; expression and not a top level definition. We
9340 (c-with-syntax-table c++-template-syntax-table 9134 ;; therefore treat it as any topmost continuation
9341 (goto-char placeholder) 9135 ;; even though the semantically correct symbol still
9342 (c-beginning-of-statement-1 lim t) 9136 ;; is brace-list-open, on the same grounds as in
9343 (if (save-excursion 9137 ;; case B.2.
9344 (c-backward-syntactic-ws lim) 9138 (progn
9345 (eq (char-before) ?<)) 9139 (c-beginning-of-statement-1 lim)
9346 ;; In a nested template arglist. 9140 (c-add-syntax 'topmost-intro-cont (c-point 'boi)))
9347 (progn 9141 (c-add-syntax 'brace-list-open placeholder)))
9348 (goto-char placeholder) 9142
9349 (c-syntactic-skip-backward "^,;" lim t) 9143 ;; CASE 5A.4: inline defun open
9350 (c-forward-syntactic-ws)) 9144 ((and containing-decl-open
9351 (back-to-indentation))) 9145 (not (c-keyword-member containing-decl-kwd
9352 ;; FIXME: Should use c-add-stmt-syntax, but it's not yet 9146 'c-other-block-decl-kwds)))
9353 ;; template aware. 9147 (c-add-syntax 'inline-open)
9354 (c-add-syntax 'template-args-cont (point) placeholder)) 9148 (c-add-class-syntax 'inclass
9355
9356 ;; CASE 5D.4: perhaps a multiple inheritance line?
9357 ((and (c-major-mode-is 'c++-mode)
9358 (save-excursion
9359 (c-beginning-of-statement-1 lim)
9360 (setq placeholder (point))
9361 (if (looking-at "static\\>[^_]")
9362 (c-forward-token-2 1 nil indent-point))
9363 (and (looking-at c-class-key)
9364 (zerop (c-forward-token-2 2 nil indent-point))
9365 (if (eq (char-after) ?<)
9366 (c-with-syntax-table c++-template-syntax-table
9367 (zerop (c-forward-token-2 1 t indent-point)))
9368 t)
9369 (eq (char-after) ?:))))
9370 (goto-char placeholder)
9371 (c-add-syntax 'inher-cont (c-point 'boi)))
9372
9373 ;; CASE 5D.5: Continuation of the "expression part" of a
9374 ;; top level construct. Or, perhaps, an unrecognised construct.
9375 (t
9376 (while (and (setq placeholder (point))
9377 (eq (car (c-beginning-of-decl-1 containing-sexp))
9378 'same)
9379 (save-excursion
9380 (c-backward-syntactic-ws)
9381 (eq (char-before) ?}))
9382 (< (point) placeholder)))
9383 (c-add-stmt-syntax
9384 (cond
9385 ((eq (point) placeholder) 'statement) ; unrecognised construct
9386 ;; A preceding comma at the top level means that a
9387 ;; new variable declaration starts here. Use
9388 ;; topmost-intro-cont for it, for consistency with
9389 ;; the first variable declaration. C.f. case 5N.
9390 ((eq char-before-ip ?,) 'topmost-intro-cont)
9391 (t 'statement-cont))
9392 nil nil containing-sexp paren-state))
9393 ))
9394
9395 ;; CASE 5F: Close of a non-class declaration level block.
9396 ((and (eq char-after-ip ?})
9397 (c-keyword-member containing-decl-kwd
9398 'c-other-block-decl-kwds))
9399 ;; This is inconsistent: Should use `containing-decl-open'
9400 ;; here if it's at boi, like in case 5J.
9401 (goto-char containing-decl-start)
9402 (c-add-stmt-syntax
9403 (if (string-equal (symbol-name containing-decl-kwd) "extern")
9404 ;; Special case for compatibility with the
9405 ;; extern-lang syntactic symbols.
9406 'extern-lang-close
9407 (intern (concat (symbol-name containing-decl-kwd)
9408 "-close")))
9409 nil t
9410 (c-most-enclosing-brace paren-state (point))
9411 paren-state))
9412
9413 ;; CASE 5G: we are looking at the brace which closes the
9414 ;; enclosing nested class decl
9415 ((and containing-sexp
9416 (eq char-after-ip ?})
9417 (eq containing-decl-open containing-sexp))
9418 (c-add-class-syntax 'class-close
9419 containing-decl-open 9149 containing-decl-open
9420 containing-decl-start 9150 containing-decl-start
9421 containing-decl-kwd 9151 containing-decl-kwd
9422 paren-state)) 9152 paren-state))
9423 9153
9424 ;; CASE 5H: we could be looking at subsequent knr-argdecls 9154 ;; CASE 5A.5: ordinary defun open
9155 (t
9156 (save-excursion
9157 (c-beginning-of-decl-1 lim)
9158 (while (looking-at c-specifier-key)
9159 (goto-char (match-end 1))
9160 (c-forward-syntactic-ws indent-point))
9161 (c-add-syntax 'defun-open (c-point 'boi))
9162 ;; Bogus to use bol here, but it's the legacy. (Resolved,
9163 ;; 2007-11-09)
9164 ))))
9165
9166 ;; CASE 5B: After a function header but before the body (or
9167 ;; the ending semicolon if there's no body).
9168 ((save-excursion
9169 (when (setq placeholder (c-just-after-func-arglist-p lim))
9170 (setq tmp-pos (point))))
9171 (cond
9172
9173 ;; CASE 5B.1: Member init list.
9174 ((eq (char-after tmp-pos) ?:)
9175 (if (or (> tmp-pos indent-point)
9176 (= (c-point 'bosws) (1+ tmp-pos)))
9177 (progn
9178 ;; There is no preceding member init clause.
9179 ;; Indent relative to the beginning of indentation
9180 ;; for the topmost-intro line that contains the
9181 ;; prototype's open paren.
9182 (goto-char placeholder)
9183 (c-add-syntax 'member-init-intro (c-point 'boi)))
9184 ;; Indent relative to the first member init clause.
9185 (goto-char (1+ tmp-pos))
9186 (c-forward-syntactic-ws)
9187 (c-add-syntax 'member-init-cont (point))))
9188
9189 ;; CASE 5B.2: K&R arg decl intro
9425 ((and c-recognize-knr-p 9190 ((and c-recognize-knr-p
9426 (not containing-sexp) ; can't be knr inside braces. 9191 (c-in-knr-argdecl lim))
9427 (not (eq char-before-ip ?})) 9192 (c-beginning-of-statement-1 lim)
9428 (save-excursion 9193 (c-add-syntax 'knr-argdecl-intro (c-point 'boi))
9429 (setq placeholder (cdr (c-beginning-of-decl-1 lim))) 9194 (if containing-decl-open
9430 (and placeholder 9195 (c-add-class-syntax 'inclass
9431 ;; Do an extra check to avoid tripping up on 9196 containing-decl-open
9432 ;; statements that occur in invalid contexts 9197 containing-decl-start
9433 ;; (e.g. in macro bodies where we don't really 9198 containing-decl-kwd
9434 ;; know the context of what we're looking at). 9199 paren-state)))
9435 (not (and c-opt-block-stmt-key 9200
9436 (looking-at c-opt-block-stmt-key))))) 9201 ;; CASE 5B.4: Nether region after a C++ or Java func
9437 (< placeholder indent-point)) 9202 ;; decl, which could include a `throws' declaration.
9438 (goto-char placeholder) 9203 (t
9439 (c-add-syntax 'knr-argdecl (point))) 9204 (c-beginning-of-statement-1 lim)
9440 9205 (c-add-syntax 'func-decl-cont (c-point 'boi))
9441 ;; CASE 5I: ObjC method definition. 9206 )))
9442 ((and c-opt-method-key 9207
9443 (looking-at c-opt-method-key)) 9208 ;; CASE 5C: inheritance line. could be first inheritance
9444 (c-beginning-of-statement-1 nil t) 9209 ;; line, or continuation of a multiple inheritance
9445 (if (= (point) indent-point) 9210 ((or (and (c-major-mode-is 'c++-mode)
9446 ;; Handle the case when it's the first (non-comment) 9211 (progn
9447 ;; thing in the buffer. Can't look for a 'same return 9212 (when (eq char-after-ip ?,)
9448 ;; value from cbos1 since ObjC directives currently 9213 (skip-chars-forward " \t")
9449 ;; aren't recognized fully, so that we get 'same 9214 (forward-char))
9450 ;; instead of 'previous if it moved over a preceding 9215 (looking-at c-opt-postfix-decl-spec-key)))
9451 ;; directive. 9216 (and (or (eq char-before-ip ?:)
9452 (goto-char (point-min))) 9217 ;; watch out for scope operator
9453 (c-add-syntax 'objc-method-intro (c-point 'boi))) 9218 (save-excursion
9454 9219 (and (eq char-after-ip ?:)
9455 ;; CASE 5P: AWK pattern or function or continuation 9220 (c-safe (forward-char 1) t)
9456 ;; thereof. 9221 (not (eq (char-after) ?:))
9457 ((c-major-mode-is 'awk-mode) 9222 )))
9458 (setq placeholder (point))
9459 (c-add-stmt-syntax
9460 (if (and (eq (c-beginning-of-statement-1) 'same)
9461 (/= (point) placeholder))
9462 'topmost-intro-cont
9463 'topmost-intro)
9464 nil nil
9465 containing-sexp paren-state))
9466
9467 ;; CASE 5N: At a variable declaration that follows a class
9468 ;; definition or some other block declaration that doesn't
9469 ;; end at the closing '}'. C.f. case 5D.5.
9470 ((progn
9471 (c-backward-syntactic-ws lim)
9472 (and (eq (char-before) ?})
9473 (save-excursion 9223 (save-excursion
9474 (let ((start (point))) 9224 (c-backward-syntactic-ws lim)
9475 (if (and c-state-cache 9225 (if (eq char-before-ip ?:)
9476 (consp (car c-state-cache)) 9226 (progn
9477 (eq (cdar c-state-cache) (point))) 9227 (forward-char -1)
9478 ;; Speed up the backward search a bit. 9228 (c-backward-syntactic-ws lim)))
9479 (goto-char (caar c-state-cache))) 9229 (back-to-indentation)
9480 (c-beginning-of-decl-1 containing-sexp) 9230 (looking-at c-class-key)))
9481 (setq placeholder (point)) 9231 ;; for Java
9482 (if (= start (point)) 9232 (and (c-major-mode-is 'java-mode)
9483 ;; The '}' is unbalanced. 9233 (let ((fence (save-excursion
9484 nil 9234 (c-beginning-of-statement-1 lim)
9485 (c-end-of-decl-1) 9235 (point)))
9486 (>= (point) indent-point)))))) 9236 cont done)
9487 (goto-char placeholder) 9237 (save-excursion
9488 (c-add-stmt-syntax 'topmost-intro-cont nil nil 9238 (while (not done)
9489 containing-sexp paren-state)) 9239 (cond ((looking-at c-opt-postfix-decl-spec-key)
9240 (setq injava-inher (cons cont (point))
9241 done t))
9242 ((or (not (c-safe (c-forward-sexp -1) t))
9243 (<= (point) fence))
9244 (setq done t))
9245 )
9246 (setq cont t)))
9247 injava-inher)
9248 (not (c-crosses-statement-barrier-p (cdr injava-inher)
9249 (point)))
9250 ))
9251 (cond
9490 9252
9491 ;; NOTE: The point is at the end of the previous token here. 9253 ;; CASE 5C.1: non-hanging colon on an inher intro
9254 ((eq char-after-ip ?:)
9255 (c-beginning-of-statement-1 lim)
9256 (c-add-syntax 'inher-intro (c-point 'boi))
9257 ;; don't add inclass symbol since relative point already
9258 ;; contains any class offset
9259 )
9492 9260
9493 ;; CASE 5J: we are at the topmost level, make 9261 ;; CASE 5C.2: hanging colon on an inher intro
9494 ;; sure we skip back past any access specifiers 9262 ((eq char-before-ip ?:)
9495 ((and 9263 (c-beginning-of-statement-1 lim)
9496 ;; A macro continuation line is never at top level. 9264 (c-add-syntax 'inher-intro (c-point 'boi))
9497 (not (and macro-start
9498 (> indent-point macro-start)))
9499 (save-excursion
9500 (setq placeholder (point))
9501 (or (memq char-before-ip '(?\; ?{ ?} nil))
9502 (c-at-vsemi-p before-ws-ip)
9503 (when (and (eq char-before-ip ?:)
9504 (eq (c-beginning-of-statement-1 lim)
9505 'label))
9506 (c-backward-syntactic-ws lim)
9507 (setq placeholder (point)))
9508 (and (c-major-mode-is 'objc-mode)
9509 (catch 'not-in-directive
9510 (c-beginning-of-statement-1 lim)
9511 (setq placeholder (point))
9512 (while (and (c-forward-objc-directive)
9513 (< (point) indent-point))
9514 (c-forward-syntactic-ws)
9515 (if (>= (point) indent-point)
9516 (throw 'not-in-directive t))
9517 (setq placeholder (point)))
9518 nil)))))
9519 ;; For historic reasons we anchor at bol of the last
9520 ;; line of the previous declaration. That's clearly
9521 ;; highly bogus and useless, and it makes our lives hard
9522 ;; to remain compatible. :P
9523 (goto-char placeholder)
9524 (c-add-syntax 'topmost-intro (c-point 'bol))
9525 (if containing-decl-open 9265 (if containing-decl-open
9526 (if (c-keyword-member containing-decl-kwd 9266 (c-add-class-syntax 'inclass
9527 'c-other-block-decl-kwds) 9267 containing-decl-open
9528 (progn 9268 containing-decl-start
9529 (goto-char (c-brace-anchor-point containing-decl-open)) 9269 containing-decl-kwd
9530 (c-add-stmt-syntax 9270 paren-state)))
9531 (if (string-equal (symbol-name containing-decl-kwd) 9271
9532 "extern") 9272 ;; CASE 5C.3: in a Java implements/extends
9533 ;; Special case for compatibility with the 9273 (injava-inher
9534 ;; extern-lang syntactic symbols. 9274 (let ((where (cdr injava-inher))
9535 'inextern-lang 9275 (cont (car injava-inher)))
9536 (intern (concat "in" 9276 (goto-char where)
9537 (symbol-name containing-decl-kwd)))) 9277 (cond ((looking-at "throws\\>[^_]")
9538 nil t 9278 (c-add-syntax 'func-decl-cont
9539 (c-most-enclosing-brace paren-state (point)) 9279 (progn (c-beginning-of-statement-1 lim)
9540 paren-state)) 9280 (c-point 'boi))))
9541 (c-add-class-syntax 'inclass 9281 (cont (c-add-syntax 'inher-cont where))
9542 containing-decl-open 9282 (t (c-add-syntax 'inher-intro
9543 containing-decl-start 9283 (progn (goto-char (cdr injava-inher))
9544 containing-decl-kwd 9284 (c-beginning-of-statement-1 lim)
9545 paren-state))) 9285 (point))))
9546 (when (and c-syntactic-indentation-in-macros 9286 )))
9547 macro-start 9287
9548 (/= macro-start (c-point 'boi indent-point))) 9288 ;; CASE 5C.4: a continued inheritance line
9549 (c-add-syntax 'cpp-define-intro) 9289 (t
9550 (setq macro-start nil))) 9290 (c-beginning-of-inheritance-list lim)
9551 9291 (c-add-syntax 'inher-cont (point))
9552 ;; CASE 5K: we are at an ObjC method definition 9292 ;; don't add inclass symbol since relative point already
9553 ;; continuation line. 9293 ;; contains any class offset
9554 ((and c-opt-method-key 9294 )))
9295
9296 ;; CASE 5D: this could be a top-level initialization, a
9297 ;; member init list continuation, or a template argument
9298 ;; list continuation.
9299 ((save-excursion
9300 ;; Note: We use the fact that lim is always after any
9301 ;; preceding brace sexp.
9302 (if c-recognize-<>-arglists
9303 (while (and
9304 (progn
9305 (c-syntactic-skip-backward "^;,=<>" lim t)
9306 (> (point) lim))
9307 (or
9308 (when c-overloadable-operators-regexp
9309 (when (setq placeholder (c-after-special-operator-id lim))
9310 (goto-char placeholder)
9311 t))
9312 (cond
9313 ((eq (char-before) ?>)
9314 (or (c-backward-<>-arglist nil lim)
9315 (backward-char))
9316 t)
9317 ((eq (char-before) ?<)
9318 (backward-char)
9319 (if (save-excursion
9320 (c-forward-<>-arglist nil))
9321 (progn (forward-char)
9322 nil)
9323 t))
9324 (t nil)))))
9325 ;; NB: No c-after-special-operator-id stuff in this
9326 ;; clause - we assume only C++ needs it.
9327 (c-syntactic-skip-backward "^;,=" lim t))
9328 (memq (char-before) '(?, ?= ?<)))
9329 (cond
9330
9331 ;; CASE 5D.3: perhaps a template list continuation?
9332 ((and (c-major-mode-is 'c++-mode)
9333 (save-excursion
9334 (save-restriction
9335 (c-with-syntax-table c++-template-syntax-table
9336 (goto-char indent-point)
9337 (setq placeholder (c-up-list-backward))
9338 (and placeholder
9339 (eq (char-after placeholder) ?<))))))
9340 (c-with-syntax-table c++-template-syntax-table
9341 (goto-char placeholder)
9342 (c-beginning-of-statement-1 lim t)
9343 (if (save-excursion
9344 (c-backward-syntactic-ws lim)
9345 (eq (char-before) ?<))
9346 ;; In a nested template arglist.
9347 (progn
9348 (goto-char placeholder)
9349 (c-syntactic-skip-backward "^,;" lim t)
9350 (c-forward-syntactic-ws))
9351 (back-to-indentation)))
9352 ;; FIXME: Should use c-add-stmt-syntax, but it's not yet
9353 ;; template aware.
9354 (c-add-syntax 'template-args-cont (point) placeholder))
9355
9356 ;; CASE 5D.4: perhaps a multiple inheritance line?
9357 ((and (c-major-mode-is 'c++-mode)
9555 (save-excursion 9358 (save-excursion
9556 (c-beginning-of-statement-1 lim) 9359 (c-beginning-of-statement-1 lim)
9557 (beginning-of-line) 9360 (setq placeholder (point))
9558 (when (looking-at c-opt-method-key) 9361 (if (looking-at "static\\>[^_]")
9559 (setq placeholder (point))))) 9362 (c-forward-token-2 1 nil indent-point))
9560 (c-add-syntax 'objc-method-args-cont placeholder)) 9363 (and (looking-at c-class-key)
9364 (zerop (c-forward-token-2 2 nil indent-point))
9365 (if (eq (char-after) ?<)
9366 (c-with-syntax-table c++-template-syntax-table
9367 (zerop (c-forward-token-2 1 t indent-point)))
9368 t)
9369 (eq (char-after) ?:))))
9370 (goto-char placeholder)
9371 (c-add-syntax 'inher-cont (c-point 'boi)))
9372
9373 ;; CASE 5D.5: Continuation of the "expression part" of a
9374 ;; top level construct. Or, perhaps, an unrecognised construct.
9375 (t
9376 (while (and (setq placeholder (point))
9377 (eq (car (c-beginning-of-decl-1 containing-sexp))
9378 'same)
9379 (save-excursion
9380 (c-backward-syntactic-ws)
9381 (eq (char-before) ?}))
9382 (< (point) placeholder)))
9383 (c-add-stmt-syntax
9384 (cond
9385 ((eq (point) placeholder) 'statement) ; unrecognised construct
9386 ;; A preceding comma at the top level means that a
9387 ;; new variable declaration starts here. Use
9388 ;; topmost-intro-cont for it, for consistency with
9389 ;; the first variable declaration. C.f. case 5N.
9390 ((eq char-before-ip ?,) 'topmost-intro-cont)
9391 (t 'statement-cont))
9392 nil nil containing-sexp paren-state))
9393 ))
9394
9395 ;; CASE 5F: Close of a non-class declaration level block.
9396 ((and (eq char-after-ip ?})
9397 (c-keyword-member containing-decl-kwd
9398 'c-other-block-decl-kwds))
9399 ;; This is inconsistent: Should use `containing-decl-open'
9400 ;; here if it's at boi, like in case 5J.
9401 (goto-char containing-decl-start)
9402 (c-add-stmt-syntax
9403 (if (string-equal (symbol-name containing-decl-kwd) "extern")
9404 ;; Special case for compatibility with the
9405 ;; extern-lang syntactic symbols.
9406 'extern-lang-close
9407 (intern (concat (symbol-name containing-decl-kwd)
9408 "-close")))
9409 nil t
9410 (c-most-enclosing-brace paren-state (point))
9411 paren-state))
9412
9413 ;; CASE 5G: we are looking at the brace which closes the
9414 ;; enclosing nested class decl
9415 ((and containing-sexp
9416 (eq char-after-ip ?})
9417 (eq containing-decl-open containing-sexp))
9418 (c-add-class-syntax 'class-close
9419 containing-decl-open
9420 containing-decl-start
9421 containing-decl-kwd
9422 paren-state))
9423
9424 ;; CASE 5H: we could be looking at subsequent knr-argdecls
9425 ((and c-recognize-knr-p
9426 (not containing-sexp) ; can't be knr inside braces.
9427 (not (eq char-before-ip ?}))
9428 (save-excursion
9429 (setq placeholder (cdr (c-beginning-of-decl-1 lim)))
9430 (and placeholder
9431 ;; Do an extra check to avoid tripping up on
9432 ;; statements that occur in invalid contexts
9433 ;; (e.g. in macro bodies where we don't really
9434 ;; know the context of what we're looking at).
9435 (not (and c-opt-block-stmt-key
9436 (looking-at c-opt-block-stmt-key)))))
9437 (< placeholder indent-point))
9438 (goto-char placeholder)
9439 (c-add-syntax 'knr-argdecl (point)))
9440
9441 ;; CASE 5I: ObjC method definition.
9442 ((and c-opt-method-key
9443 (looking-at c-opt-method-key))
9444 (c-beginning-of-statement-1 nil t)
9445 (if (= (point) indent-point)
9446 ;; Handle the case when it's the first (non-comment)
9447 ;; thing in the buffer. Can't look for a 'same return
9448 ;; value from cbos1 since ObjC directives currently
9449 ;; aren't recognized fully, so that we get 'same
9450 ;; instead of 'previous if it moved over a preceding
9451 ;; directive.
9452 (goto-char (point-min)))
9453 (c-add-syntax 'objc-method-intro (c-point 'boi)))
9454
9455 ;; CASE 5P: AWK pattern or function or continuation
9456 ;; thereof.
9457 ((c-major-mode-is 'awk-mode)
9458 (setq placeholder (point))
9459 (c-add-stmt-syntax
9460 (if (and (eq (c-beginning-of-statement-1) 'same)
9461 (/= (point) placeholder))
9462 'topmost-intro-cont
9463 'topmost-intro)
9464 nil nil
9465 containing-sexp paren-state))
9466
9467 ;; CASE 5N: At a variable declaration that follows a class
9468 ;; definition or some other block declaration that doesn't
9469 ;; end at the closing '}'. C.f. case 5D.5.
9470 ((progn
9471 (c-backward-syntactic-ws lim)
9472 (and (eq (char-before) ?})
9473 (save-excursion
9474 (let ((start (point)))
9475 (if (and c-state-cache
9476 (consp (car c-state-cache))
9477 (eq (cdar c-state-cache) (point)))
9478 ;; Speed up the backward search a bit.
9479 (goto-char (caar c-state-cache)))
9480 (c-beginning-of-decl-1 containing-sexp)
9481 (setq placeholder (point))
9482 (if (= start (point))
9483 ;; The '}' is unbalanced.
9484 nil
9485 (c-end-of-decl-1)
9486 (>= (point) indent-point))))))
9487 (goto-char placeholder)
9488 (c-add-stmt-syntax 'topmost-intro-cont nil nil
9489 containing-sexp paren-state))
9490
9491 ;; NOTE: The point is at the end of the previous token here.
9492
9493 ;; CASE 5J: we are at the topmost level, make
9494 ;; sure we skip back past any access specifiers
9495 ((and
9496 ;; A macro continuation line is never at top level.
9497 (not (and macro-start
9498 (> indent-point macro-start)))
9499 (save-excursion
9500 (setq placeholder (point))
9501 (or (memq char-before-ip '(?\; ?{ ?} nil))
9502 (c-at-vsemi-p before-ws-ip)
9503 (when (and (eq char-before-ip ?:)
9504 (eq (c-beginning-of-statement-1 lim)
9505 'label))
9506 (c-backward-syntactic-ws lim)
9507 (setq placeholder (point)))
9508 (and (c-major-mode-is 'objc-mode)
9509 (catch 'not-in-directive
9510 (c-beginning-of-statement-1 lim)
9511 (setq placeholder (point))
9512 (while (and (c-forward-objc-directive)
9513 (< (point) indent-point))
9514 (c-forward-syntactic-ws)
9515 (if (>= (point) indent-point)
9516 (throw 'not-in-directive t))
9517 (setq placeholder (point)))
9518 nil)))))
9519 ;; For historic reasons we anchor at bol of the last
9520 ;; line of the previous declaration. That's clearly
9521 ;; highly bogus and useless, and it makes our lives hard
9522 ;; to remain compatible. :P
9523 (goto-char placeholder)
9524 (c-add-syntax 'topmost-intro (c-point 'bol))
9525 (if containing-decl-open
9526 (if (c-keyword-member containing-decl-kwd
9527 'c-other-block-decl-kwds)
9528 (progn
9529 (goto-char (c-brace-anchor-point containing-decl-open))
9530 (c-add-stmt-syntax
9531 (if (string-equal (symbol-name containing-decl-kwd)
9532 "extern")
9533 ;; Special case for compatibility with the
9534 ;; extern-lang syntactic symbols.
9535 'inextern-lang
9536 (intern (concat "in"
9537 (symbol-name containing-decl-kwd))))
9538 nil t
9539 (c-most-enclosing-brace paren-state (point))
9540 paren-state))
9541 (c-add-class-syntax 'inclass
9542 containing-decl-open
9543 containing-decl-start
9544 containing-decl-kwd
9545 paren-state)))
9546 (when (and c-syntactic-indentation-in-macros
9547 macro-start
9548 (/= macro-start (c-point 'boi indent-point)))
9549 (c-add-syntax 'cpp-define-intro)
9550 (setq macro-start nil)))
9551
9552 ;; CASE 5K: we are at an ObjC method definition
9553 ;; continuation line.
9554 ((and c-opt-method-key
9555 (save-excursion
9556 (c-beginning-of-statement-1 lim)
9557 (beginning-of-line)
9558 (when (looking-at c-opt-method-key)
9559 (setq placeholder (point)))))
9560 (c-add-syntax 'objc-method-args-cont placeholder))
9561 9561
9562 ;; CASE 5L: we are at the first argument of a template 9562 ;; CASE 5L: we are at the first argument of a template
9563 ;; arglist that begins on the previous line. 9563 ;; arglist that begins on the previous line.
9564 ((and c-recognize-<>-arglists 9564 ((and c-recognize-<>-arglists
9565 (eq (char-before) ?<) 9565 (eq (char-before) ?<)
@@ -9573,32 +9573,32 @@ comment at the start of cc-engine.el for more info."
9573 (c-beginning-of-statement-1 containing-sexp) 9573 (c-beginning-of-statement-1 containing-sexp)
9574 (c-add-stmt-syntax 'statement nil t containing-sexp paren-state)) 9574 (c-add-stmt-syntax 'statement nil t containing-sexp paren-state))
9575 9575
9576 ;;CASE 5N: We are at a tompmost continuation line and the only 9576 ;;CASE 5N: We are at a tompmost continuation line and the only
9577 ;;preceding items are annotations. 9577 ;;preceding items are annotations.
9578 ((and (c-major-mode-is 'java-mode) 9578 ((and (c-major-mode-is 'java-mode)
9579 (setq placeholder (point)) 9579 (setq placeholder (point))
9580 (c-beginning-of-statement-1) 9580 (c-beginning-of-statement-1)
9581 (progn 9581 (progn
9582 (while (and (c-forward-annotation)) 9582 (while (and (c-forward-annotation))
9583 (c-forward-syntactic-ws)) 9583 (c-forward-syntactic-ws))
9584 t) 9584 t)
9585 (prog1 9585 (prog1
9586 (>= (point) placeholder) 9586 (>= (point) placeholder)
9587 (goto-char placeholder))) 9587 (goto-char placeholder)))
9588 (c-add-syntax 'annotation-top-cont (c-point 'boi))) 9588 (c-add-syntax 'annotation-top-cont (c-point 'boi)))
9589 9589
9590 ;; CASE 5M: we are at a topmost continuation line 9590 ;; CASE 5M: we are at a topmost continuation line
9591 (t 9591 (t
9592 (c-beginning-of-statement-1 (c-safe-position (point) paren-state)) 9592 (c-beginning-of-statement-1 (c-safe-position (point) paren-state))
9593 (when (c-major-mode-is 'objc-mode) 9593 (when (c-major-mode-is 'objc-mode)
9594 (setq placeholder (point)) 9594 (setq placeholder (point))
9595 (while (and (c-forward-objc-directive) 9595 (while (and (c-forward-objc-directive)
9596 (< (point) indent-point)) 9596 (< (point) indent-point))
9597 (c-forward-syntactic-ws) 9597 (c-forward-syntactic-ws)
9598 (setq placeholder (point))) 9598 (setq placeholder (point)))
9599 (goto-char placeholder)) 9599 (goto-char placeholder))
9600 (c-add-syntax 'topmost-intro-cont (c-point 'boi))) 9600 (c-add-syntax 'topmost-intro-cont (c-point 'boi)))
9601 )) 9601 ))
9602 9602
9603 9603
9604 ;; (CASE 6 has been removed.) 9604 ;; (CASE 6 has been removed.)
@@ -9614,576 +9614,576 @@ comment at the start of cc-engine.el for more info."
9614 (cond 9614 (cond
9615 9615
9616 ;; CASE 7A: we are looking at the arglist closing paren. 9616 ;; CASE 7A: we are looking at the arglist closing paren.
9617 ;; C.f. case 7F. 9617 ;; C.f. case 7F.
9618 ((memq char-after-ip '(?\) ?\])) 9618 ((memq char-after-ip '(?\) ?\]))
9619 (goto-char containing-sexp) 9619 (goto-char containing-sexp)
9620 (setq placeholder (c-point 'boi)) 9620 (setq placeholder (c-point 'boi))
9621 (if (and (c-safe (backward-up-list 1) t) 9621 (if (and (c-safe (backward-up-list 1) t)
9622 (>= (point) placeholder)) 9622 (>= (point) placeholder))
9623 (progn 9623 (progn
9624 (forward-char) 9624 (forward-char)
9625 (skip-chars-forward " \t")) 9625 (skip-chars-forward " \t"))
9626 (goto-char placeholder)) 9626 (goto-char placeholder))
9627 (c-add-stmt-syntax 'arglist-close (list containing-sexp) t 9627 (c-add-stmt-syntax 'arglist-close (list containing-sexp) t
9628 (c-most-enclosing-brace paren-state (point)) 9628 (c-most-enclosing-brace paren-state (point))
9629 paren-state)) 9629 paren-state))
9630 9630
9631 ;; CASE 19: line is an expression, not a statement, and is directly
9632 ;; contained by a template delimiter. Most likely, we are in a
9633 ;; template arglist within a statement. This case is based on CASE
9634 ;; 7. At some point in the future, we may wish to create more
9635 ;; syntactic symbols such as `template-intro',
9636 ;; `template-cont-nonempty', etc., and distinguish between them as we
9637 ;; do for `arglist-intro' etc. (2009-12-07).
9638 ((and c-recognize-<>-arglists
9639 (setq containing-< (c-up-list-backward indent-point containing-sexp))
9640 (eq (char-after containing-<) ?\<))
9641 (setq placeholder (c-point 'boi containing-<))
9642 (goto-char containing-sexp) ; Most nested Lbrace/Lparen (but not
9643 ; '<') before indent-point.
9644 (if (>= (point) placeholder)
9645 (progn
9646 (forward-char)
9647 (skip-chars-forward " \t"))
9648 (goto-char placeholder))
9649 (c-add-stmt-syntax 'template-args-cont (list containing-<) t
9650 (c-most-enclosing-brace c-state-cache (point))
9651 paren-state))
9652
9653 ;; CASE 7B: Looking at the opening brace of an 9631 ;; CASE 7B: Looking at the opening brace of an
9654 ;; in-expression block or brace list. C.f. cases 4, 16A 9632 ;; in-expression block or brace list. C.f. cases 4, 16A
9655 ;; and 17E. 9633 ;; and 17E.
9656 ((and (eq char-after-ip ?{) 9634 ((and (eq char-after-ip ?{)
9657 (progn 9635 (progn
9658 (setq placeholder (c-inside-bracelist-p (point) 9636 (setq placeholder (c-inside-bracelist-p (point)
9659 paren-state)) 9637 paren-state))
9660 (if placeholder 9638 (if placeholder
9661 (setq tmpsymbol '(brace-list-open . inexpr-class)) 9639 (setq tmpsymbol '(brace-list-open . inexpr-class))
9662 (setq tmpsymbol '(block-open . inexpr-statement) 9640 (setq tmpsymbol '(block-open . inexpr-statement)
9663 placeholder 9641 placeholder
9664 (cdr-safe (c-looking-at-inexpr-block 9642 (cdr-safe (c-looking-at-inexpr-block
9665 (c-safe-position containing-sexp 9643 (c-safe-position containing-sexp
9666 paren-state) 9644 paren-state)
9667 containing-sexp))) 9645 containing-sexp)))
9668 ;; placeholder is nil if it's a block directly in 9646 ;; placeholder is nil if it's a block directly in
9669 ;; a function arglist. That makes us skip out of 9647 ;; a function arglist. That makes us skip out of
9670 ;; this case. 9648 ;; this case.
9671 ))) 9649 )))
9672 (goto-char placeholder) 9650 (goto-char placeholder)
9673 (back-to-indentation) 9651 (back-to-indentation)
9674 (c-add-stmt-syntax (car tmpsymbol) nil t 9652 (c-add-stmt-syntax (car tmpsymbol) nil t
9675 (c-most-enclosing-brace paren-state (point)) 9653 (c-most-enclosing-brace paren-state (point))
9676 paren-state) 9654 paren-state)
9677 (if (/= (point) placeholder) 9655 (if (/= (point) placeholder)
9678 (c-add-syntax (cdr tmpsymbol)))) 9656 (c-add-syntax (cdr tmpsymbol))))
9657
9658 ;; CASE 7C: we are looking at the first argument in an empty
9659 ;; argument list. Use arglist-close if we're actually
9660 ;; looking at a close paren or bracket.
9661 ((memq char-before-ip '(?\( ?\[))
9662 (goto-char containing-sexp)
9663 (setq placeholder (c-point 'boi))
9664 (if (and (c-safe (backward-up-list 1) t)
9665 (>= (point) placeholder))
9666 (progn
9667 (forward-char)
9668 (skip-chars-forward " \t"))
9669 (goto-char placeholder))
9670 (c-add-stmt-syntax 'arglist-intro (list containing-sexp) t
9671 (c-most-enclosing-brace paren-state (point))
9672 paren-state))
9679 9673
9680 ;; CASE 7C: we are looking at the first argument in an empty 9674 ;; CASE 7D: we are inside a conditional test clause. treat
9681 ;; argument list. Use arglist-close if we're actually 9675 ;; these things as statements
9682 ;; looking at a close paren or bracket. 9676 ((progn
9683 ((memq char-before-ip '(?\( ?\[))
9684 (goto-char containing-sexp) 9677 (goto-char containing-sexp)
9685 (setq placeholder (c-point 'boi)) 9678 (and (c-safe (c-forward-sexp -1) t)
9686 (if (and (c-safe (backward-up-list 1) t) 9679 (looking-at "\\<for\\>[^_]")))
9687 (>= (point) placeholder)) 9680 (goto-char (1+ containing-sexp))
9688 (progn 9681 (c-forward-syntactic-ws indent-point)
9689 (forward-char) 9682 (if (eq char-before-ip ?\;)
9690 (skip-chars-forward " \t")) 9683 (c-add-syntax 'statement (point))
9691 (goto-char placeholder)) 9684 (c-add-syntax 'statement-cont (point))
9692 (c-add-stmt-syntax 'arglist-intro (list containing-sexp) t 9685 ))
9693 (c-most-enclosing-brace paren-state (point)) 9686
9694 paren-state)) 9687 ;; CASE 7E: maybe a continued ObjC method call. This is the
9688 ;; case when we are inside a [] bracketed exp, and what
9689 ;; precede the opening bracket is not an identifier.
9690 ((and c-opt-method-key
9691 (eq (char-after containing-sexp) ?\[)
9692 (progn
9693 (goto-char (1- containing-sexp))
9694 (c-backward-syntactic-ws (c-point 'bod))
9695 (if (not (looking-at c-symbol-key))
9696 (c-add-syntax 'objc-method-call-cont containing-sexp))
9697 )))
9695 9698
9696 ;; CASE 7D: we are inside a conditional test clause. treat 9699 ;; CASE 7F: we are looking at an arglist continuation line,
9697 ;; these things as statements 9700 ;; but the preceding argument is on the same line as the
9698 ((progn 9701 ;; opening paren. This case includes multi-line
9699 (goto-char containing-sexp) 9702 ;; mathematical paren groupings, but we could be on a
9700 (and (c-safe (c-forward-sexp -1) t) 9703 ;; for-list continuation line. C.f. case 7A.
9701 (looking-at "\\<for\\>[^_]"))) 9704 ((progn
9702 (goto-char (1+ containing-sexp)) 9705 (goto-char (1+ containing-sexp))
9703 (c-forward-syntactic-ws indent-point) 9706 (< (save-excursion
9704 (if (eq char-before-ip ?\;) 9707 (c-forward-syntactic-ws)
9705 (c-add-syntax 'statement (point)) 9708 (point))
9706 (c-add-syntax 'statement-cont (point)) 9709 (c-point 'bonl)))
9707 )) 9710 (goto-char containing-sexp) ; paren opening the arglist
9708 9711 (setq placeholder (c-point 'boi))
9709 ;; CASE 7E: maybe a continued ObjC method call. This is the 9712 (if (and (c-safe (backward-up-list 1) t)
9710 ;; case when we are inside a [] bracketed exp, and what 9713 (>= (point) placeholder))
9711 ;; precede the opening bracket is not an identifier. 9714 (progn
9712 ((and c-opt-method-key 9715 (forward-char)
9713 (eq (char-after containing-sexp) ?\[) 9716 (skip-chars-forward " \t"))
9714 (progn 9717 (goto-char placeholder))
9715 (goto-char (1- containing-sexp)) 9718 (c-add-stmt-syntax 'arglist-cont-nonempty (list containing-sexp) t
9716 (c-backward-syntactic-ws (c-point 'bod)) 9719 (c-most-enclosing-brace c-state-cache (point))
9717 (if (not (looking-at c-symbol-key)) 9720 paren-state))
9718 (c-add-syntax 'objc-method-call-cont containing-sexp))
9719 )))
9720 9721
9721 ;; CASE 7F: we are looking at an arglist continuation line, 9722 ;; CASE 7G: we are looking at just a normal arglist
9722 ;; but the preceding argument is on the same line as the 9723 ;; continuation line
9723 ;; opening paren. This case includes multi-line 9724 (t (c-forward-syntactic-ws indent-point)
9724 ;; mathematical paren groupings, but we could be on a 9725 (c-add-syntax 'arglist-cont (c-point 'boi)))
9725 ;; for-list continuation line. C.f. case 7A. 9726 ))
9726 ((progn
9727 (goto-char (1+ containing-sexp))
9728 (< (save-excursion
9729 (c-forward-syntactic-ws)
9730 (point))
9731 (c-point 'bonl)))
9732 (goto-char containing-sexp) ; paren opening the arglist
9733 (setq placeholder (c-point 'boi))
9734 (if (and (c-safe (backward-up-list 1) t)
9735 (>= (point) placeholder))
9736 (progn
9737 (forward-char)
9738 (skip-chars-forward " \t"))
9739 (goto-char placeholder))
9740 (c-add-stmt-syntax 'arglist-cont-nonempty (list containing-sexp) t
9741 (c-most-enclosing-brace c-state-cache (point))
9742 paren-state))
9743 9727
9744 ;; CASE 7G: we are looking at just a normal arglist 9728 ;; CASE 8: func-local multi-inheritance line
9745 ;; continuation line 9729 ((and (c-major-mode-is 'c++-mode)
9746 (t (c-forward-syntactic-ws indent-point) 9730 (save-excursion
9747 (c-add-syntax 'arglist-cont (c-point 'boi))) 9731 (goto-char indent-point)
9748 )) 9732 (skip-chars-forward " \t")
9733 (looking-at c-opt-postfix-decl-spec-key)))
9734 (goto-char indent-point)
9735 (skip-chars-forward " \t")
9736 (cond
9749 9737
9750 ;; CASE 8: func-local multi-inheritance line 9738 ;; CASE 8A: non-hanging colon on an inher intro
9751 ((and (c-major-mode-is 'c++-mode) 9739 ((eq char-after-ip ?:)
9752 (save-excursion 9740 (c-backward-syntactic-ws lim)
9753 (goto-char indent-point) 9741 (c-add-syntax 'inher-intro (c-point 'boi)))
9754 (skip-chars-forward " \t")
9755 (looking-at c-opt-postfix-decl-spec-key)))
9756 (goto-char indent-point)
9757 (skip-chars-forward " \t")
9758 (cond
9759 9742
9760 ;; CASE 8A: non-hanging colon on an inher intro 9743 ;; CASE 8B: hanging colon on an inher intro
9761 ((eq char-after-ip ?:) 9744 ((eq char-before-ip ?:)
9762 (c-backward-syntactic-ws lim) 9745 (c-add-syntax 'inher-intro (c-point 'boi)))
9763 (c-add-syntax 'inher-intro (c-point 'boi)))
9764 9746
9765 ;; CASE 8B: hanging colon on an inher intro 9747 ;; CASE 8C: a continued inheritance line
9766 ((eq char-before-ip ?:) 9748 (t
9767 (c-add-syntax 'inher-intro (c-point 'boi))) 9749 (c-beginning-of-inheritance-list lim)
9750 (c-add-syntax 'inher-cont (point))
9751 )))
9752
9753 ;; CASE 9: we are inside a brace-list
9754 ((and (not (c-major-mode-is 'awk-mode)) ; Maybe this isn't needed (ACM, 2002/3/29)
9755 (setq special-brace-list
9756 (or (and c-special-brace-lists ;;;; ALWAYS NIL FOR AWK!!
9757 (save-excursion
9758 (goto-char containing-sexp)
9759 (c-looking-at-special-brace-list)))
9760 (c-inside-bracelist-p containing-sexp paren-state))))
9761 (cond
9768 9762
9769 ;; CASE 8C: a continued inheritance line 9763 ;; CASE 9A: In the middle of a special brace list opener.
9770 (t 9764 ((and (consp special-brace-list)
9771 (c-beginning-of-inheritance-list lim) 9765 (save-excursion
9772 (c-add-syntax 'inher-cont (point)) 9766 (goto-char containing-sexp)
9773 ))) 9767 (eq (char-after) ?\())
9768 (eq char-after-ip (car (cdr special-brace-list))))
9769 (goto-char (car (car special-brace-list)))
9770 (skip-chars-backward " \t")
9771 (if (and (bolp)
9772 (assoc 'statement-cont
9773 (setq placeholder (c-guess-basic-syntax))))
9774 (setq c-syntactic-context placeholder)
9775 (c-beginning-of-statement-1
9776 (c-safe-position (1- containing-sexp) paren-state))
9777 (c-forward-token-2 0)
9778 (while (looking-at c-specifier-key)
9779 (goto-char (match-end 1))
9780 (c-forward-syntactic-ws))
9781 (c-add-syntax 'brace-list-open (c-point 'boi))))
9782
9783 ;; CASE 9B: brace-list-close brace
9784 ((if (consp special-brace-list)
9785 ;; Check special brace list closer.
9786 (progn
9787 (goto-char (car (car special-brace-list)))
9788 (save-excursion
9789 (goto-char indent-point)
9790 (back-to-indentation)
9791 (or
9792 ;; We were between the special close char and the `)'.
9793 (and (eq (char-after) ?\))
9794 (eq (1+ (point)) (cdr (car special-brace-list))))
9795 ;; We were before the special close char.
9796 (and (eq (char-after) (cdr (cdr special-brace-list)))
9797 (zerop (c-forward-token-2))
9798 (eq (1+ (point)) (cdr (car special-brace-list)))))))
9799 ;; Normal brace list check.
9800 (and (eq char-after-ip ?})
9801 (c-safe (goto-char (c-up-list-backward (point))) t)
9802 (= (point) containing-sexp)))
9803 (if (eq (point) (c-point 'boi))
9804 (c-add-syntax 'brace-list-close (point))
9805 (setq lim (c-most-enclosing-brace c-state-cache (point)))
9806 (c-beginning-of-statement-1 lim)
9807 (c-add-stmt-syntax 'brace-list-close nil t lim paren-state)))
9774 9808
9775 ;; CASE 9: we are inside a brace-list 9809 (t
9776 ((and (not (c-major-mode-is 'awk-mode)) ; Maybe this isn't needed (ACM, 2002/3/29) 9810 ;; Prepare for the rest of the cases below by going to the
9777 (setq special-brace-list 9811 ;; token following the opening brace
9778 (or (and c-special-brace-lists ;;;; ALWAYS NIL FOR AWK!! 9812 (if (consp special-brace-list)
9779 (save-excursion 9813 (progn
9780 (goto-char containing-sexp) 9814 (goto-char (car (car special-brace-list)))
9781 (c-looking-at-special-brace-list))) 9815 (c-forward-token-2 1 nil indent-point))
9782 (c-inside-bracelist-p containing-sexp paren-state)))) 9816 (goto-char containing-sexp))
9817 (forward-char)
9818 (let ((start (point)))
9819 (c-forward-syntactic-ws indent-point)
9820 (goto-char (max start (c-point 'bol))))
9821 (c-skip-ws-forward indent-point)
9783 (cond 9822 (cond
9784 9823
9785 ;; CASE 9A: In the middle of a special brace list opener. 9824 ;; CASE 9C: we're looking at the first line in a brace-list
9786 ((and (consp special-brace-list) 9825 ((= (point) indent-point)
9787 (save-excursion 9826 (if (consp special-brace-list)
9788 (goto-char containing-sexp) 9827 (goto-char (car (car special-brace-list)))
9789 (eq (char-after) ?\()) 9828 (goto-char containing-sexp))
9790 (eq char-after-ip (car (cdr special-brace-list))))
9791 (goto-char (car (car special-brace-list)))
9792 (skip-chars-backward " \t")
9793 (if (and (bolp)
9794 (assoc 'statement-cont
9795 (setq placeholder (c-guess-basic-syntax))))
9796 (setq c-syntactic-context placeholder)
9797 (c-beginning-of-statement-1
9798 (c-safe-position (1- containing-sexp) paren-state))
9799 (c-forward-token-2 0)
9800 (while (looking-at c-specifier-key)
9801 (goto-char (match-end 1))
9802 (c-forward-syntactic-ws))
9803 (c-add-syntax 'brace-list-open (c-point 'boi))))
9804
9805 ;; CASE 9B: brace-list-close brace
9806 ((if (consp special-brace-list)
9807 ;; Check special brace list closer.
9808 (progn
9809 (goto-char (car (car special-brace-list)))
9810 (save-excursion
9811 (goto-char indent-point)
9812 (back-to-indentation)
9813 (or
9814 ;; We were between the special close char and the `)'.
9815 (and (eq (char-after) ?\))
9816 (eq (1+ (point)) (cdr (car special-brace-list))))
9817 ;; We were before the special close char.
9818 (and (eq (char-after) (cdr (cdr special-brace-list)))
9819 (zerop (c-forward-token-2))
9820 (eq (1+ (point)) (cdr (car special-brace-list)))))))
9821 ;; Normal brace list check.
9822 (and (eq char-after-ip ?})
9823 (c-safe (goto-char (c-up-list-backward (point))) t)
9824 (= (point) containing-sexp)))
9825 (if (eq (point) (c-point 'boi)) 9829 (if (eq (point) (c-point 'boi))
9826 (c-add-syntax 'brace-list-close (point)) 9830 (c-add-syntax 'brace-list-intro (point))
9827 (setq lim (c-most-enclosing-brace c-state-cache (point))) 9831 (setq lim (c-most-enclosing-brace c-state-cache (point)))
9828 (c-beginning-of-statement-1 lim) 9832 (c-beginning-of-statement-1 lim)
9829 (c-add-stmt-syntax 'brace-list-close nil t lim paren-state))) 9833 (c-add-stmt-syntax 'brace-list-intro nil t lim paren-state)))
9830 9834
9831 (t 9835 ;; CASE 9D: this is just a later brace-list-entry or
9832 ;; Prepare for the rest of the cases below by going to the 9836 ;; brace-entry-open
9833 ;; token following the opening brace 9837 (t (if (or (eq char-after-ip ?{)
9834 (if (consp special-brace-list) 9838 (and c-special-brace-lists
9835 (progn 9839 (save-excursion
9836 (goto-char (car (car special-brace-list))) 9840 (goto-char indent-point)
9837 (c-forward-token-2 1 nil indent-point)) 9841 (c-forward-syntactic-ws (c-point 'eol))
9838 (goto-char containing-sexp)) 9842 (c-looking-at-special-brace-list (point)))))
9839 (forward-char) 9843 (c-add-syntax 'brace-entry-open (point))
9840 (let ((start (point))) 9844 (c-add-syntax 'brace-list-entry (point))
9841 (c-forward-syntactic-ws indent-point) 9845 ))
9842 (goto-char (max start (c-point 'bol)))) 9846 ))))
9843 (c-skip-ws-forward indent-point) 9847
9844 (cond 9848 ;; CASE 10: A continued statement or top level construct.
9849 ((and (not (memq char-before-ip '(?\; ?:)))
9850 (not (c-at-vsemi-p before-ws-ip))
9851 (or (not (eq char-before-ip ?}))
9852 (c-looking-at-inexpr-block-backward c-state-cache))
9853 (> (point)
9854 (save-excursion
9855 (c-beginning-of-statement-1 containing-sexp)
9856 (setq placeholder (point))))
9857 (/= placeholder containing-sexp))
9858 ;; This is shared with case 18.
9859 (c-guess-continued-construct indent-point
9860 char-after-ip
9861 placeholder
9862 containing-sexp
9863 paren-state))
9864
9865 ;; CASE 16: block close brace, possibly closing the defun or
9866 ;; the class
9867 ((eq char-after-ip ?})
9868 ;; From here on we have the next containing sexp in lim.
9869 (setq lim (c-most-enclosing-brace paren-state))
9870 (goto-char containing-sexp)
9871 (cond
9845 9872
9846 ;; CASE 9C: we're looking at the first line in a brace-list 9873 ;; CASE 16E: Closing a statement block? This catches
9847 ((= (point) indent-point) 9874 ;; cases where it's preceded by a statement keyword,
9848 (if (consp special-brace-list) 9875 ;; which works even when used in an "invalid" context,
9849 (goto-char (car (car special-brace-list))) 9876 ;; e.g. a macro argument.
9850 (goto-char containing-sexp)) 9877 ((c-after-conditional)
9851 (if (eq (point) (c-point 'boi)) 9878 (c-backward-to-block-anchor lim)
9852 (c-add-syntax 'brace-list-intro (point)) 9879 (c-add-stmt-syntax 'block-close nil t lim paren-state))
9853 (setq lim (c-most-enclosing-brace c-state-cache (point))) 9880
9854 (c-beginning-of-statement-1 lim) 9881 ;; CASE 16A: closing a lambda defun or an in-expression
9855 (c-add-stmt-syntax 'brace-list-intro nil t lim paren-state))) 9882 ;; block? C.f. cases 4, 7B and 17E.
9856 9883 ((setq placeholder (c-looking-at-inexpr-block
9857 ;; CASE 9D: this is just a later brace-list-entry or 9884 (c-safe-position containing-sexp paren-state)
9858 ;; brace-entry-open 9885 nil))
9859 (t (if (or (eq char-after-ip ?{) 9886 (setq tmpsymbol (if (eq (car placeholder) 'inlambda)
9860 (and c-special-brace-lists 9887 'inline-close
9861 (save-excursion 9888 'block-close))
9862 (goto-char indent-point)
9863 (c-forward-syntactic-ws (c-point 'eol))
9864 (c-looking-at-special-brace-list (point)))))
9865 (c-add-syntax 'brace-entry-open (point))
9866 (c-add-syntax 'brace-list-entry (point))
9867 ))
9868 ))))
9869
9870 ;; CASE 10: A continued statement or top level construct.
9871 ((and (not (memq char-before-ip '(?\; ?:)))
9872 (not (c-at-vsemi-p before-ws-ip))
9873 (or (not (eq char-before-ip ?}))
9874 (c-looking-at-inexpr-block-backward c-state-cache))
9875 (> (point)
9876 (save-excursion
9877 (c-beginning-of-statement-1 containing-sexp)
9878 (setq placeholder (point))))
9879 (/= placeholder containing-sexp))
9880 ;; This is shared with case 18.
9881 (c-guess-continued-construct indent-point
9882 char-after-ip
9883 placeholder
9884 containing-sexp
9885 paren-state))
9886
9887 ;; CASE 16: block close brace, possibly closing the defun or
9888 ;; the class
9889 ((eq char-after-ip ?})
9890 ;; From here on we have the next containing sexp in lim.
9891 (setq lim (c-most-enclosing-brace paren-state))
9892 (goto-char containing-sexp) 9889 (goto-char containing-sexp)
9893 (cond 9890 (back-to-indentation)
9891 (if (= containing-sexp (point))
9892 (c-add-syntax tmpsymbol (point))
9893 (goto-char (cdr placeholder))
9894 (back-to-indentation)
9895 (c-add-stmt-syntax tmpsymbol nil t
9896 (c-most-enclosing-brace paren-state (point))
9897 paren-state)
9898 (if (/= (point) (cdr placeholder))
9899 (c-add-syntax (car placeholder)))))
9894 9900
9895 ;; CASE 16E: Closing a statement block? This catches 9901 ;; CASE 16B: does this close an inline or a function in
9896 ;; cases where it's preceded by a statement keyword, 9902 ;; a non-class declaration level block?
9897 ;; which works even when used in an "invalid" context, 9903 ((save-excursion
9898 ;; e.g. a macro argument. 9904 (and lim
9899 ((c-after-conditional) 9905 (progn
9900 (c-backward-to-block-anchor lim) 9906 (goto-char lim)
9901 (c-add-stmt-syntax 'block-close nil t lim paren-state)) 9907 (c-looking-at-decl-block
9902 9908 (c-most-enclosing-brace paren-state lim)
9903 ;; CASE 16A: closing a lambda defun or an in-expression 9909 nil))
9904 ;; block? C.f. cases 4, 7B and 17E. 9910 (setq placeholder (point))))
9905 ((setq placeholder (c-looking-at-inexpr-block 9911 (c-backward-to-decl-anchor lim)
9906 (c-safe-position containing-sexp paren-state) 9912 (back-to-indentation)
9907 nil)) 9913 (if (save-excursion
9908 (setq tmpsymbol (if (eq (car placeholder) 'inlambda) 9914 (goto-char placeholder)
9909 'inline-close 9915 (looking-at c-other-decl-block-key))
9910 'block-close)) 9916 (c-add-syntax 'defun-close (point))
9911 (goto-char containing-sexp) 9917 (c-add-syntax 'inline-close (point))))
9912 (back-to-indentation) 9918
9913 (if (= containing-sexp (point)) 9919 ;; CASE 16F: Can be a defun-close of a function declared
9914 (c-add-syntax tmpsymbol (point)) 9920 ;; in a statement block, e.g. in Pike or when using gcc
9915 (goto-char (cdr placeholder)) 9921 ;; extensions, but watch out for macros followed by
9916 (back-to-indentation) 9922 ;; blocks. Let it through to be handled below.
9917 (c-add-stmt-syntax tmpsymbol nil t 9923 ;; C.f. cases B.3 and 17G.
9918 (c-most-enclosing-brace paren-state (point)) 9924 ((save-excursion
9919 paren-state) 9925 (and (not (c-at-statement-start-p))
9920 (if (/= (point) (cdr placeholder)) 9926 (eq (c-beginning-of-statement-1 lim nil nil t) 'same)
9921 (c-add-syntax (car placeholder))))) 9927 (setq placeholder (point))
9922 9928 (let ((c-recognize-typeless-decls nil))
9923 ;; CASE 16B: does this close an inline or a function in 9929 ;; Turn off recognition of constructs that
9924 ;; a non-class declaration level block? 9930 ;; lacks a type in this case, since that's more
9925 ((save-excursion 9931 ;; likely to be a macro followed by a block.
9926 (and lim 9932 (c-forward-decl-or-cast-1 (c-point 'bosws) nil nil))))
9927 (progn 9933 (back-to-indentation)
9928 (goto-char lim) 9934 (if (/= (point) containing-sexp)
9929 (c-looking-at-decl-block 9935 (goto-char placeholder))
9930 (c-most-enclosing-brace paren-state lim) 9936 (c-add-stmt-syntax 'defun-close nil t lim paren-state))
9931 nil)) 9937
9932 (setq placeholder (point)))) 9938 ;; CASE 16C: If there is an enclosing brace then this is
9933 (c-backward-to-decl-anchor lim) 9939 ;; a block close since defun closes inside declaration
9934 (back-to-indentation) 9940 ;; level blocks have been handled above.
9935 (if (save-excursion 9941 (lim
9936 (goto-char placeholder) 9942 ;; If the block is preceded by a case/switch label on
9937 (looking-at c-other-decl-block-key)) 9943 ;; the same line, we anchor at the first preceding label
9938 (c-add-syntax 'defun-close (point)) 9944 ;; at boi. The default handling in c-add-stmt-syntax
9939 (c-add-syntax 'inline-close (point)))) 9945 ;; really fixes it better, but we do like this to keep
9940 9946 ;; the indentation compatible with version 5.28 and
9941 ;; CASE 16F: Can be a defun-close of a function declared 9947 ;; earlier. C.f. case 17H.
9942 ;; in a statement block, e.g. in Pike or when using gcc 9948 (while (and (/= (setq placeholder (point)) (c-point 'boi))
9943 ;; extensions, but watch out for macros followed by 9949 (eq (c-beginning-of-statement-1 lim) 'label)))
9944 ;; blocks. Let it through to be handled below. 9950 (goto-char placeholder)
9945 ;; C.f. cases B.3 and 17G. 9951 (if (looking-at c-label-kwds-regexp)
9946 ((save-excursion 9952 (c-add-syntax 'block-close (point))
9947 (and (not (c-at-statement-start-p)) 9953 (goto-char containing-sexp)
9948 (eq (c-beginning-of-statement-1 lim nil nil t) 'same) 9954 ;; c-backward-to-block-anchor not necessary here; those
9949 (setq placeholder (point)) 9955 ;; situations are handled in case 16E above.
9950 (let ((c-recognize-typeless-decls nil)) 9956 (c-add-stmt-syntax 'block-close nil t lim paren-state)))
9951 ;; Turn off recognition of constructs that
9952 ;; lacks a type in this case, since that's more
9953 ;; likely to be a macro followed by a block.
9954 (c-forward-decl-or-cast-1 (c-point 'bosws) nil nil))))
9955 (back-to-indentation)
9956 (if (/= (point) containing-sexp)
9957 (goto-char placeholder))
9958 (c-add-stmt-syntax 'defun-close nil t lim paren-state))
9959
9960 ;; CASE 16C: If there is an enclosing brace then this is
9961 ;; a block close since defun closes inside declaration
9962 ;; level blocks have been handled above.
9963 (lim
9964 ;; If the block is preceded by a case/switch label on
9965 ;; the same line, we anchor at the first preceding label
9966 ;; at boi. The default handling in c-add-stmt-syntax
9967 ;; really fixes it better, but we do like this to keep
9968 ;; the indentation compatible with version 5.28 and
9969 ;; earlier. C.f. case 17H.
9970 (while (and (/= (setq placeholder (point)) (c-point 'boi))
9971 (eq (c-beginning-of-statement-1 lim) 'label)))
9972 (goto-char placeholder)
9973 (if (looking-at c-label-kwds-regexp)
9974 (c-add-syntax 'block-close (point))
9975 (goto-char containing-sexp)
9976 ;; c-backward-to-block-anchor not necessary here; those
9977 ;; situations are handled in case 16E above.
9978 (c-add-stmt-syntax 'block-close nil t lim paren-state)))
9979
9980 ;; CASE 16D: Only top level defun close left.
9981 (t
9982 (goto-char containing-sexp)
9983 (c-backward-to-decl-anchor lim)
9984 (c-add-stmt-syntax 'defun-close nil nil
9985 (c-most-enclosing-brace paren-state)
9986 paren-state))
9987 ))
9988 9957
9989 ;; CASE 17: Statement or defun catchall. 9958 ;; CASE 16D: Only top level defun close left.
9990 (t 9959 (t
9991 (goto-char indent-point) 9960 (goto-char containing-sexp)
9992 ;; Back up statements until we find one that starts at boi. 9961 (c-backward-to-decl-anchor lim)
9993 (while (let* ((prev-point (point)) 9962 (c-add-stmt-syntax 'defun-close nil nil
9994 (last-step-type (c-beginning-of-statement-1 9963 (c-most-enclosing-brace paren-state)
9995 containing-sexp))) 9964 paren-state))
9996 (if (= (point) prev-point) 9965 ))
9997 (progn 9966
9998 (setq step-type (or step-type last-step-type)) 9967 ;; CASE 19: line is an expression, not a statement, and is directly
9999 nil) 9968 ;; contained by a template delimiter. Most likely, we are in a
10000 (setq step-type last-step-type) 9969 ;; template arglist within a statement. This case is based on CASE
10001 (/= (point) (c-point 'boi))))) 9970 ;; 7. At some point in the future, we may wish to create more
10002 (cond 9971 ;; syntactic symbols such as `template-intro',
9972 ;; `template-cont-nonempty', etc., and distinguish between them as we
9973 ;; do for `arglist-intro' etc. (2009-12-07).
9974 ((and c-recognize-<>-arglists
9975 (setq containing-< (c-up-list-backward indent-point containing-sexp))
9976 (eq (char-after containing-<) ?\<))
9977 (setq placeholder (c-point 'boi containing-<))
9978 (goto-char containing-sexp) ; Most nested Lbrace/Lparen (but not
9979 ; '<') before indent-point.
9980 (if (>= (point) placeholder)
9981 (progn
9982 (forward-char)
9983 (skip-chars-forward " \t"))
9984 (goto-char placeholder))
9985 (c-add-stmt-syntax 'template-args-cont (list containing-<) t
9986 (c-most-enclosing-brace c-state-cache (point))
9987 paren-state))
10003 9988
10004 ;; CASE 17B: continued statement 9989 ;; CASE 17: Statement or defun catchall.
10005 ((and (eq step-type 'same) 9990 (t
10006 (/= (point) indent-point)) 9991 (goto-char indent-point)
10007 (c-add-stmt-syntax 'statement-cont nil nil 9992 ;; Back up statements until we find one that starts at boi.
10008 containing-sexp paren-state)) 9993 (while (let* ((prev-point (point))
10009 9994 (last-step-type (c-beginning-of-statement-1
10010 ;; CASE 17A: After a case/default label? 9995 containing-sexp)))
10011 ((progn 9996 (if (= (point) prev-point)
10012 (while (and (eq step-type 'label) 9997 (progn
10013 (not (looking-at c-label-kwds-regexp))) 9998 (setq step-type (or step-type last-step-type))
10014 (setq step-type 9999 nil)
10015 (c-beginning-of-statement-1 containing-sexp))) 10000 (setq step-type last-step-type)
10016 (eq step-type 'label)) 10001 (/= (point) (c-point 'boi)))))
10017 (c-add-stmt-syntax (if (eq char-after-ip ?{) 10002 (cond
10018 'statement-case-open
10019 'statement-case-intro)
10020 nil t containing-sexp paren-state))
10021
10022 ;; CASE 17D: any old statement
10023 ((progn
10024 (while (eq step-type 'label)
10025 (setq step-type
10026 (c-beginning-of-statement-1 containing-sexp)))
10027 (eq step-type 'previous))
10028 (c-add-stmt-syntax 'statement nil t
10029 containing-sexp paren-state)
10030 (if (eq char-after-ip ?{)
10031 (c-add-syntax 'block-open)))
10032
10033 ;; CASE 17I: Inside a substatement block.
10034 ((progn
10035 ;; The following tests are all based on containing-sexp.
10036 (goto-char containing-sexp)
10037 ;; From here on we have the next containing sexp in lim.
10038 (setq lim (c-most-enclosing-brace paren-state containing-sexp))
10039 (c-after-conditional))
10040 (c-backward-to-block-anchor lim)
10041 (c-add-stmt-syntax 'statement-block-intro nil t
10042 lim paren-state)
10043 (if (eq char-after-ip ?{)
10044 (c-add-syntax 'block-open)))
10045
10046 ;; CASE 17E: first statement in an in-expression block.
10047 ;; C.f. cases 4, 7B and 16A.
10048 ((setq placeholder (c-looking-at-inexpr-block
10049 (c-safe-position containing-sexp paren-state)
10050 nil))
10051 (setq tmpsymbol (if (eq (car placeholder) 'inlambda)
10052 'defun-block-intro
10053 'statement-block-intro))
10054 (back-to-indentation)
10055 (if (= containing-sexp (point))
10056 (c-add-syntax tmpsymbol (point))
10057 (goto-char (cdr placeholder))
10058 (back-to-indentation)
10059 (c-add-stmt-syntax tmpsymbol nil t
10060 (c-most-enclosing-brace c-state-cache (point))
10061 paren-state)
10062 (if (/= (point) (cdr placeholder))
10063 (c-add-syntax (car placeholder))))
10064 (if (eq char-after-ip ?{)
10065 (c-add-syntax 'block-open)))
10066
10067 ;; CASE 17F: first statement in an inline, or first
10068 ;; statement in a top-level defun. we can tell this is it
10069 ;; if there are no enclosing braces that haven't been
10070 ;; narrowed out by a class (i.e. don't use bod here).
10071 ((save-excursion
10072 (or (not (setq placeholder (c-most-enclosing-brace
10073 paren-state)))
10074 (and (progn
10075 (goto-char placeholder)
10076 (eq (char-after) ?{))
10077 (c-looking-at-decl-block (c-most-enclosing-brace
10078 paren-state (point))
10079 nil))))
10080 (c-backward-to-decl-anchor lim)
10081 (back-to-indentation)
10082 (c-add-syntax 'defun-block-intro (point)))
10083 10003
10084 ;; CASE 17G: First statement in a function declared inside 10004 ;; CASE 17B: continued statement
10085 ;; a normal block. This can occur in Pike and with 10005 ((and (eq step-type 'same)
10086 ;; e.g. the gcc extensions, but watch out for macros 10006 (/= (point) indent-point))
10087 ;; followed by blocks. C.f. cases B.3 and 16F. 10007 (c-add-stmt-syntax 'statement-cont nil nil
10088 ((save-excursion 10008 containing-sexp paren-state))
10089 (and (not (c-at-statement-start-p)) 10009
10090 (eq (c-beginning-of-statement-1 lim nil nil t) 'same) 10010 ;; CASE 17A: After a case/default label?
10091 (setq placeholder (point)) 10011 ((progn
10092 (let ((c-recognize-typeless-decls nil)) 10012 (while (and (eq step-type 'label)
10093 ;; Turn off recognition of constructs that lacks 10013 (not (looking-at c-label-kwds-regexp)))
10094 ;; a type in this case, since that's more likely 10014 (setq step-type
10095 ;; to be a macro followed by a block. 10015 (c-beginning-of-statement-1 containing-sexp)))
10096 (c-forward-decl-or-cast-1 (c-point 'bosws) nil nil)))) 10016 (eq step-type 'label))
10017 (c-add-stmt-syntax (if (eq char-after-ip ?{)
10018 'statement-case-open
10019 'statement-case-intro)
10020 nil t containing-sexp paren-state))
10021
10022 ;; CASE 17D: any old statement
10023 ((progn
10024 (while (eq step-type 'label)
10025 (setq step-type
10026 (c-beginning-of-statement-1 containing-sexp)))
10027 (eq step-type 'previous))
10028 (c-add-stmt-syntax 'statement nil t
10029 containing-sexp paren-state)
10030 (if (eq char-after-ip ?{)
10031 (c-add-syntax 'block-open)))
10032
10033 ;; CASE 17I: Inside a substatement block.
10034 ((progn
10035 ;; The following tests are all based on containing-sexp.
10036 (goto-char containing-sexp)
10037 ;; From here on we have the next containing sexp in lim.
10038 (setq lim (c-most-enclosing-brace paren-state containing-sexp))
10039 (c-after-conditional))
10040 (c-backward-to-block-anchor lim)
10041 (c-add-stmt-syntax 'statement-block-intro nil t
10042 lim paren-state)
10043 (if (eq char-after-ip ?{)
10044 (c-add-syntax 'block-open)))
10045
10046 ;; CASE 17E: first statement in an in-expression block.
10047 ;; C.f. cases 4, 7B and 16A.
10048 ((setq placeholder (c-looking-at-inexpr-block
10049 (c-safe-position containing-sexp paren-state)
10050 nil))
10051 (setq tmpsymbol (if (eq (car placeholder) 'inlambda)
10052 'defun-block-intro
10053 'statement-block-intro))
10054 (back-to-indentation)
10055 (if (= containing-sexp (point))
10056 (c-add-syntax tmpsymbol (point))
10057 (goto-char (cdr placeholder))
10097 (back-to-indentation) 10058 (back-to-indentation)
10098 (if (/= (point) containing-sexp) 10059 (c-add-stmt-syntax tmpsymbol nil t
10099 (goto-char placeholder)) 10060 (c-most-enclosing-brace c-state-cache (point))
10100 (c-add-stmt-syntax 'defun-block-intro nil t 10061 paren-state)
10101 lim paren-state)) 10062 (if (/= (point) (cdr placeholder))
10063 (c-add-syntax (car placeholder))))
10064 (if (eq char-after-ip ?{)
10065 (c-add-syntax 'block-open)))
10066
10067 ;; CASE 17F: first statement in an inline, or first
10068 ;; statement in a top-level defun. we can tell this is it
10069 ;; if there are no enclosing braces that haven't been
10070 ;; narrowed out by a class (i.e. don't use bod here).
10071 ((save-excursion
10072 (or (not (setq placeholder (c-most-enclosing-brace
10073 paren-state)))
10074 (and (progn
10075 (goto-char placeholder)
10076 (eq (char-after) ?{))
10077 (c-looking-at-decl-block (c-most-enclosing-brace
10078 paren-state (point))
10079 nil))))
10080 (c-backward-to-decl-anchor lim)
10081 (back-to-indentation)
10082 (c-add-syntax 'defun-block-intro (point)))
10102 10083
10103 ;; CASE 17H: First statement in a block. 10084 ;; CASE 17G: First statement in a function declared inside
10104 (t 10085 ;; a normal block. This can occur in Pike and with
10105 ;; If the block is preceded by a case/switch label on the 10086 ;; e.g. the gcc extensions, but watch out for macros
10106 ;; same line, we anchor at the first preceding label at 10087 ;; followed by blocks. C.f. cases B.3 and 16F.
10107 ;; boi. The default handling in c-add-stmt-syntax is 10088 ((save-excursion
10108 ;; really fixes it better, but we do like this to keep the 10089 (and (not (c-at-statement-start-p))
10109 ;; indentation compatible with version 5.28 and earlier. 10090 (eq (c-beginning-of-statement-1 lim nil nil t) 'same)
10110 ;; C.f. case 16C. 10091 (setq placeholder (point))
10111 (while (and (/= (setq placeholder (point)) (c-point 'boi)) 10092 (let ((c-recognize-typeless-decls nil))
10112 (eq (c-beginning-of-statement-1 lim) 'label))) 10093 ;; Turn off recognition of constructs that lacks
10113 (goto-char placeholder) 10094 ;; a type in this case, since that's more likely
10114 (if (looking-at c-label-kwds-regexp) 10095 ;; to be a macro followed by a block.
10115 (c-add-syntax 'statement-block-intro (point)) 10096 (c-forward-decl-or-cast-1 (c-point 'bosws) nil nil))))
10116 (goto-char containing-sexp) 10097 (back-to-indentation)
10117 ;; c-backward-to-block-anchor not necessary here; those 10098 (if (/= (point) containing-sexp)
10118 ;; situations are handled in case 17I above. 10099 (goto-char placeholder))
10119 (c-add-stmt-syntax 'statement-block-intro nil t 10100 (c-add-stmt-syntax 'defun-block-intro nil t
10120 lim paren-state)) 10101 lim paren-state))
10121 (if (eq char-after-ip ?{)
10122 (c-add-syntax 'block-open)))
10123 ))
10124 )
10125 10102
10126 ;; now we need to look at any modifiers 10103 ;; CASE 17H: First statement in a block.
10127 (goto-char indent-point) 10104 (t
10128 (skip-chars-forward " \t") 10105 ;; If the block is preceded by a case/switch label on the
10106 ;; same line, we anchor at the first preceding label at
10107 ;; boi. The default handling in c-add-stmt-syntax is
10108 ;; really fixes it better, but we do like this to keep the
10109 ;; indentation compatible with version 5.28 and earlier.
10110 ;; C.f. case 16C.
10111 (while (and (/= (setq placeholder (point)) (c-point 'boi))
10112 (eq (c-beginning-of-statement-1 lim) 'label)))
10113 (goto-char placeholder)
10114 (if (looking-at c-label-kwds-regexp)
10115 (c-add-syntax 'statement-block-intro (point))
10116 (goto-char containing-sexp)
10117 ;; c-backward-to-block-anchor not necessary here; those
10118 ;; situations are handled in case 17I above.
10119 (c-add-stmt-syntax 'statement-block-intro nil t
10120 lim paren-state))
10121 (if (eq char-after-ip ?{)
10122 (c-add-syntax 'block-open)))
10123 ))
10124 )
10125
10126 ;; now we need to look at any modifiers
10127 (goto-char indent-point)
10128 (skip-chars-forward " \t")
10129
10130 ;; are we looking at a comment only line?
10131 (when (and (looking-at c-comment-start-regexp)
10132 (/= (c-forward-token-2 0 nil (c-point 'eol)) 0))
10133 (c-append-syntax 'comment-intro))
10134
10135 ;; we might want to give additional offset to friends (in C++).
10136 (when (and c-opt-friend-key
10137 (looking-at c-opt-friend-key))
10138 (c-append-syntax 'friend))
10139
10140 ;; Set syntactic-relpos.
10141 (let ((p c-syntactic-context))
10142 (while (and p
10143 (if (integerp (c-langelem-pos (car p)))
10144 (progn
10145 (setq syntactic-relpos (c-langelem-pos (car p)))
10146 nil)
10147 t))
10148 (setq p (cdr p))))
10129 10149
10130 ;; are we looking at a comment only line? 10150 ;; Start of or a continuation of a preprocessor directive?
10131 (when (and (looking-at c-comment-start-regexp) 10151 (if (and macro-start
10132 (/= (c-forward-token-2 0 nil (c-point 'eol)) 0)) 10152 (eq macro-start (c-point 'boi))
10133 (c-append-syntax 'comment-intro)) 10153 (not (and (c-major-mode-is 'pike-mode)
10134 10154 (eq (char-after (1+ macro-start)) ?\"))))
10135 ;; we might want to give additional offset to friends (in C++). 10155 (c-append-syntax 'cpp-macro)
10136 (when (and c-opt-friend-key 10156 (when (and c-syntactic-indentation-in-macros macro-start)
10137 (looking-at c-opt-friend-key)) 10157 (if in-macro-expr
10138 (c-append-syntax 'friend)) 10158 (when (or
10139 10159 (< syntactic-relpos macro-start)
10140 ;; Set syntactic-relpos. 10160 (not (or
10141 (let ((p c-syntactic-context)) 10161 (assq 'arglist-intro c-syntactic-context)
10142 (while (and p 10162 (assq 'arglist-cont c-syntactic-context)
10143 (if (integerp (c-langelem-pos (car p))) 10163 (assq 'arglist-cont-nonempty c-syntactic-context)
10144 (progn 10164 (assq 'arglist-close c-syntactic-context))))
10145 (setq syntactic-relpos (c-langelem-pos (car p))) 10165 ;; If inside a cpp expression, i.e. anywhere in a
10146 nil) 10166 ;; cpp directive except a #define body, we only let
10147 t)) 10167 ;; through the syntactic analysis that is internal
10148 (setq p (cdr p)))) 10168 ;; in the expression. That means the arglist
10149 10169 ;; elements, if they are anchored inside the cpp
10150 ;; Start of or a continuation of a preprocessor directive? 10170 ;; expression.
10151 (if (and macro-start 10171 (setq c-syntactic-context nil)
10152 (eq macro-start (c-point 'boi)) 10172 (c-add-syntax 'cpp-macro-cont macro-start))
10153 (not (and (c-major-mode-is 'pike-mode) 10173 (when (and (eq macro-start syntactic-relpos)
10154 (eq (char-after (1+ macro-start)) ?\")))) 10174 (not (assq 'cpp-define-intro c-syntactic-context))
10155 (c-append-syntax 'cpp-macro) 10175 (save-excursion
10156 (when (and c-syntactic-indentation-in-macros macro-start) 10176 (goto-char macro-start)
10157 (if in-macro-expr 10177 (or (not (c-forward-to-cpp-define-body))
10158 (when (or 10178 (<= (point) (c-point 'boi indent-point)))))
10159 (< syntactic-relpos macro-start) 10179 ;; Inside a #define body and the syntactic analysis is
10160 (not (or 10180 ;; anchored on the start of the #define. In this case
10161 (assq 'arglist-intro c-syntactic-context) 10181 ;; we add cpp-define-intro to get the extra
10162 (assq 'arglist-cont c-syntactic-context) 10182 ;; indentation of the #define body.
10163 (assq 'arglist-cont-nonempty c-syntactic-context) 10183 (c-add-syntax 'cpp-define-intro)))))
10164 (assq 'arglist-close c-syntactic-context)))) 10184
10165 ;; If inside a cpp expression, i.e. anywhere in a 10185 ;; return the syntax
10166 ;; cpp directive except a #define body, we only let 10186 c-syntactic-context)))
10167 ;; through the syntactic analysis that is internal
10168 ;; in the expression. That means the arglist
10169 ;; elements, if they are anchored inside the cpp
10170 ;; expression.
10171 (setq c-syntactic-context nil)
10172 (c-add-syntax 'cpp-macro-cont macro-start))
10173 (when (and (eq macro-start syntactic-relpos)
10174 (not (assq 'cpp-define-intro c-syntactic-context))
10175 (save-excursion
10176 (goto-char macro-start)
10177 (or (not (c-forward-to-cpp-define-body))
10178 (<= (point) (c-point 'boi indent-point)))))
10179 ;; Inside a #define body and the syntactic analysis is
10180 ;; anchored on the start of the #define. In this case
10181 ;; we add cpp-define-intro to get the extra
10182 ;; indentation of the #define body.
10183 (c-add-syntax 'cpp-define-intro)))))
10184
10185 ;; return the syntax
10186 c-syntactic-context)))
10187 10187
10188 10188
10189;; Indentation calculation. 10189;; Indentation calculation.
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 53918b903ee..47cbdf19ed2 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -3127,7 +3127,9 @@ class of the file (using s to separate nested class ids)."
3127 ("^document\\s-.*\\(\n\\)" (1 "< b")) 3127 ("^document\\s-.*\\(\n\\)" (1 "< b"))
3128 ("^end\\(\\>\\)" 3128 ("^end\\(\\>\\)"
3129 (1 (ignore 3129 (1 (ignore
3130 (unless (eq (match-beginning 0) (point-min)) 3130 (when (and (> (match-beginning 0) (point-min))
3131 (eq 1 (nth 7 (save-excursion
3132 (syntax-ppss (1- (match-beginning 0)))))))
3131 ;; We change the \n in front, which is more difficult, but results 3133 ;; We change the \n in front, which is more difficult, but results
3132 ;; in better highlighting. If the doc is empty, the single \n is 3134 ;; in better highlighting. If the doc is empty, the single \n is
3133 ;; both the beginning and the end of the docstring, which can't be 3135 ;; both the beginning and the end of the docstring, which can't be
diff --git a/src/ChangeLog b/src/ChangeLog
index add827a9dc4..90722187e6c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,4 @@
12011-03-06 Paul Eggert <eggert@cs.ucla.edu> 12011-03-07 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * xmenu.c (menu_highlight_callback): Now static. 3 * xmenu.c (menu_highlight_callback): Now static.
4 (set_frame_menubar): Remove unused local. 4 (set_frame_menubar): Remove unused local.
@@ -12,10 +12,18 @@
12 (note_mouse_highlight): Mark variables that gcc -Wuninitialized 12 (note_mouse_highlight): Mark variables that gcc -Wuninitialized
13 does not deduce are never used uninitialized. 13 does not deduce are never used uninitialized.
14 14
15 * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c 15 * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c.
16 which in turn is copied from coreutils. 16
172011-03-06 Chong Yidong <cyd@stupidchicken.com>
18
19 * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06
20 change.
17 21
18 current_column: Now returns EMACS_INT, fixing some iftc. 222011-03-06 Paul Eggert <eggert@cs.ucla.edu>
23
24 current_column: Now returns EMACS_INT, fixing some iftc
25 that was introduced in the 2002-06-02 change "temporarily"; see
26 <http://lists.gnu.org/archive/html/emacs-devel/2002-06/msg00039.html>.
19 * bytecode.c (Fbyte_code): Don't cast current_column () to int. 27 * bytecode.c (Fbyte_code): Don't cast current_column () to int.
20 * cmds.c (internal_self_insert): Likewise. 28 * cmds.c (internal_self_insert): Likewise.
21 * indent.c (Fcurrent_column): Likewise. 29 * indent.c (Fcurrent_column): Likewise.
@@ -25,7 +33,6 @@
25 to int. 33 to int.
26 * xdisp.c (redisplay_internal, redisplay_window, decode_mode_spec): 34 * xdisp.c (redisplay_internal, redisplay_window, decode_mode_spec):
27 Likewise. 35 Likewise.
28
29 * cmds.c (internal_self_insert): Declare locals to be EMACS_INT, 36 * cmds.c (internal_self_insert): Declare locals to be EMACS_INT,
30 not int or double, if they might contain a column number. 37 not int or double, if they might contain a column number.
31 * indent.c (current_column, Findent_to, indented_beyond_p): 38 * indent.c (current_column, Findent_to, indented_beyond_p):
diff --git a/src/xdisp.c b/src/xdisp.c
index f7f887f7850..858a0f74fb1 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13697,6 +13697,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
13697 int buffer_unchanged_p = 0; 13697 int buffer_unchanged_p = 0;
13698 int temp_scroll_step = 0; 13698 int temp_scroll_step = 0;
13699 int count = SPECPDL_INDEX (); 13699 int count = SPECPDL_INDEX ();
13700 int rc;
13700 int centering_position = -1; 13701 int centering_position = -1;
13701 int last_line_misfit = 0; 13702 int last_line_misfit = 0;
13702 EMACS_INT beg_unchanged, end_unchanged; 13703 EMACS_INT beg_unchanged, end_unchanged;
@@ -14008,15 +14009,12 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
14008 /* Handle case where text has not changed, only point, and it has 14009 /* Handle case where text has not changed, only point, and it has
14009 not moved off the frame, and we are not retrying after hscroll. 14010 not moved off the frame, and we are not retrying after hscroll.
14010 (current_matrix_up_to_date_p is nonzero when retrying.) */ 14011 (current_matrix_up_to_date_p is nonzero when retrying.) */
14011 if (current_matrix_up_to_date_p) 14012 if (current_matrix_up_to_date_p
14013 && (rc = try_cursor_movement (window, startp, &temp_scroll_step),
14014 rc != CURSOR_MOVEMENT_CANNOT_BE_USED))
14012 { 14015 {
14013 int rc = try_cursor_movement (window, startp, &temp_scroll_step);
14014
14015 switch (rc) 14016 switch (rc)
14016 { 14017 {
14017 case CURSOR_MOVEMENT_CANNOT_BE_USED:
14018 break;
14019
14020 case CURSOR_MOVEMENT_SUCCESS: 14018 case CURSOR_MOVEMENT_SUCCESS:
14021 used_current_matrix_p = 1; 14019 used_current_matrix_p = 1;
14022 goto done; 14020 goto done;