Commit graph

434 commits

Author SHA1 Message Date
Alan Mackenzie
e8dd0787d9 Correctly fontify Java class constructors.
* progmodes/cc-langs.el (c-type-decl-suffix-key): Now matches ")"
in Java Mode.
(c-recognize-typeless-decls): Set the Java value to t.
* progmodes/cc-engine.el (c-forward-decl-or-cast-1): While
handling a "(", add a check for, effectively, Java, and handle a
"typeless" declaration there.
2013-09-07 14:33:50 +00:00
Glenn Morris
6758b6a8db * lisp/progmodes/cc-engine.el (c-pull-open-brace): Move definition before use.
Ref: http://lists.gnu.org/archive/html/emacs-devel/2013-08/msg00773.html
2013-08-29 13:26:48 -04:00
Alan Mackenzie
8a51e84232 Improve indentation of bracelists defined by macros (without "=").
* progmodes/cc-engine.el (c-inside-bracelist-p): When a macro
expansion begins with "{", regard it as bracelist when it doesn't
contain a ";".
2013-08-25 21:06:07 +00:00
Alan Mackenzie
869455d432 Parse C++ inher-intro when there's a template split over 2 lines.
* progmodes/cc-engine.el (c-guess-basic-syntax CASE 5C): Code more
rigorously the search for "class" etc. followed by ":".

* progmodes/cc-langs.el (c-opt-<>-sexp-key): Make the value for
random languages a regexp which never matches rather than nil.
2013-08-25 13:52:14 +00:00
Alan Mackenzie
b5eb903526 Handle "/"s more accurately in test for virtual semicolons (AWK Mode).
* progmodes/cc-awk.el (c-awk-one-line-possibly-open-string-re)
(c-awk-regexp-one-line-possibly-open-char-list-re)
(c-awk-one-line-possibly-open-regexp-re)
(c-awk-one-line-non-syn-ws*-re): Remove.
(c-awk-possibly-open-string-re, c-awk-non-/-syn-ws*-re)
(c-awk-space*-/-re, c-awk-space*-regexp-/-re)
(c-awk-space*-unclosed-regexp-/-re): New constants.
(c-awk-at-vsemi-p): Reformulate better to recognize "/"s which
aren't regexp delimiters.

* progmodes/cc-engine.el (c-crosses-statement-barrier-p): Add in
handling for a rare situation in AWK Mode involving unterminated
strings/regexps.
2013-08-25 10:09:56 +00:00
Alan Mackenzie
5ab78d3d6a Make Java try-with-resources statement parse properly.
progmodes/cc-langs.el (c-block-stmt-1-2-kwds, c-block-stmt-1-2-key): New
language constants/variables.
progmodes/cc-engine.el (c-beginning-of-statement-1, c-after-conditional): Adapt
to deal with c-block-stmt-1-2-key.
progmodes/cc-fonts.el (c-font-lock-declarations): Adapt to deal with
c-block-stmt-1-2-key.
2013-07-27 12:07:43 +00:00
Paul Eggert
3af1c8684e Spelling fixes. 2013-07-13 22:18:48 -07:00
Alan Mackenzie
2cdb769811 progmodes/cc-engine.el (c-forward-decl-or-cast-1): Label CASE 13
and comment it out.  This out-commenting enables certain C++
declarations to be parsed correctly.
2013-07-13 17:45:07 +00:00
Alan Mackenzie
6490c52ee8 Remove faulty optimisation from indentation calculation.
* progmodes/cc-engine.el (c-guess-basic-syntax): Don't calculate
        search limit based on 2000 characters back from indent-point.
2013-06-04 13:26:15 +00:00
Glenn Morris
683853b9fe Plain fboundp silences compilation warnings since Emacs 22.1
* progmodes/cc-cmds.el (delete-forward-p):
* progmodes/cc-defs.el (buffer-syntactic-context-depth):
* progmodes/cc-engine.el (buffer-syntactic-context):
* progmodes/cc-fonts.el (face-property-instance):
* progmodes/cc-mode.el (set-keymap-parents):
* progmodes/cc-vars.el (get-char-table): No need for cc-bytecomp-defun.
* progmodes/cc-defs.el (c-set-region-active, c-beginning-of-defun-1)
* progmodes/cc-mode.el (c-make-inherited-keymap): Use plain fboundp.
2013-06-01 11:19:29 -07:00
Alan Mackenzie
3d1c39faa4 Handle arbitrarily long C++ member initialisation lists.
* progmodes/cc-engine.el (c-back-over-member-initializers): new
        function.
        (c-guess-basic-syntax): New CASE 5R (extracted from 5B) to handle
        (most) member init lists.
2013-04-30 16:19:14 +00:00
Alan Mackenzie
691e26ae7d Handle `parse-partial-sexp' landing inside a comment opener
(Bug#13244). Also adapt to the new values of element 7 of a parse
	state.

	* progmodes/cc-engine.el (c-state-pp-to-literal): New optional
	parameter `not-in-delimiter'.  Handle being inside comment opener.
	(c-invalidate-state-cache-1): Reckon with an extra "invalid"
	character in case we're typing a '*' after a '/'.
	(c-literal-limits): Handle the awkward "not-in-delimiter" cond arm
	instead by passing the parameter to c-state-pp-to-literal.

	* progmodes/cc-fonts.el (c-font-lock-doc-comments): New handling
	for elt. 7 of a parse state.
2013-04-03 17:50:39 +00:00
Paul Eggert
c38e0c974e Prefer UTF-8 when the encoding shouldn't matter and changes are small. 2013-03-05 09:13:01 -08:00
Glenn Morris
8c4b24b2ab Merge from emacs-24; up to 2012-12-14T15:22:24Z!monnier@iro.umontreal.ca 2013-02-06 22:23:54 -08:00
Alan Mackenzie
d23b0804fb Fix bug in the state cache mechanism. Remove 'BOD "strategy". Refactor.
cc-engine.el (c-get-fallback-scan-pos): Remove.
(c-parse-state-get-strategy): Don't return 'BOD any more.
(c-append-lower-brace-pair-to-state-cache): Extra parameter HERE instead
of narrowing.  Widen to top of buffer before searching backwards for a
brace pair.
(c-state-push-any-brace-pair): Add HERE parameter to function call.
(c-append-to-state-cache): Extra parameter HERE in place of narrowing.
Narrow to parameter HERE, in place of being called narrowed.
(c-remove-stale-state-cache): Extra parameter HERE in place of narrowing.
Check there's an open brace in the cache before searching for its match.
(c-invalidate-state-cache-1): Add HERE parameter to function call.
(c-parse-state-1): Don't narrow here for 'forward strategy, instead
passing extra parameter HERE to several functions.  Remove 'BOD strategy.
2013-02-02 18:24:10 +00:00
Alan Mackenzie
b7aea0ffb6 AWK Mode: Fix indentation bug at top level. Bug #12274.
progmodes/cc-engine.el (c-guess-basic-syntax): Move CASE 5P to just
before CASE 5D.
2013-01-25 18:18:14 +00:00
Alan Mackenzie
267eacb5e3 Fix a bug in the state cache mechanism. Refactor this a bit.
cc-engine.el (c-parse-state-get-strategy): Remove the `cache-pos' element
from the return value.
(c-append-lower-brace-pair-to-state-cache): "Narrow" to end of buffer to
enable proper searching from beyond HERE.
Amend the test for detecting the sought brace pair.  Amend the value
written to the "brace desert cache" when the brace isn't found.
(c-remove-stale-state-cache): Rename `good-pos' to `start-point', and
several other variables analogously.
(c-remove-stale-state-cache-backwards): Change `cache-pos' from a
parameter to a locally calculated variable.
(c-parse-state-1): Change the calling conventions to the two defuns
involving `cache-pos'.
2013-01-23 18:58:11 +00:00
Alan Mackenzie
8cff5febae Fix bugs in the c-parse-state mechanism. Reuse some markers instead of
continually generating new ones.

cc-engine.el (c-state-old-cpp-beg-marker, c-state-old-cpp-end-marker):
New variables.
(c-append-lower-brace-pair-to-state-cache): Start a backward search for
"}" definitively outside CPP constructs.
(c-remove-stale-state-cache): Inform the caller of a need to search back
for a brace pair in certain circumstances.
(c-state-maybe-marker): New macro.
(c-parse-state): Reuse markers when appropriate.
2013-01-09 21:33:00 +00:00
Paul Eggert
ab422c4d68 Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
Alan Mackenzie
14b8c3d926 Make CC Mode not hang when _some_ lines end in CRLF. Bug #11841.
cc-engine.el (c-backward-comments): Add code to work around
`forward-comment' not recognizing ^M as whitespace.
2012-12-11 19:06:57 +00:00
Alan Mackenzie
b03aabdac5 Fix bugs in the CC Mode state cache. Enhance a debugging mechanism. 2012-11-21 20:41:03 +00:00
Alan Mackenzie
8ed43f1548 Correct the handling of two c-state-cache state variables.
cc-engine.el (c-state-cache-init): Initialise
c-state-semi-nonlit-pos-cache\(-limit\)? properly.
(c-record-parse-state-state): record
c-state-semi-nonlit-pos-cache\(-limit\)?.
2012-09-09 11:03:37 +00:00
Alan Mackenzie
ace2989a84 AWK Mode: make auto-newline work when there's "==" in the pattern.
cc-cmds.el (c-point-syntax): Handle virtual semicolons correctly.
cc-engine.el (c-guess-basic-syntax CASE 5A.3): Test more rigorously for
"=" token.
2012-09-08 20:00:13 +00:00
Stefan Monnier
2143fa3267 * lisp/progmodes/cc-engine.el (c-forward-sws, c-backward-sws):
Avoid spuriously marking the buffer as modified because of c-is-sws.
2012-07-17 07:40:23 -04:00
Alan Mackenzie
583e23bd57 CC Mode. Adding a ) can hide the resulting (..) from searches. Fix it. 2012-04-22 11:13:09 +00:00
Alan Mackenzie
0de3da9f2f Correct two search limits in c-before-change-check_<>-operators. 2012-04-11 15:32:30 +00:00
Alan Mackenzie
2e492df3cd Further optimise the handling of large macros. 2012-03-16 14:10:54 +00:00
Paul Eggert
f003f29445 Spelling fixes. 2012-03-12 15:35:55 -07:00
Alan Mackenzie
56d093a9c8 Depessimize the handling of very large macros. 2012-03-02 22:16:21 +00:00
Alan Mackenzie
0bc5886ace Fix infinite loop with long macros. 2012-02-12 11:06:42 +00:00
Alan Mackenzie
98d7371e7a Fix spurious recognition of c-in-knr-argdecl. 2012-02-07 15:19:52 +00:00
Alan Mackenzie
667ced3a2d cc-engine.el (c-forward-objc-directive): Prevent looping in "#pragma mark
@implementation".
2012-02-07 12:01:42 +00:00
Alan Mackenzie
abbceb009c Fix an off by one error in c-guess-basic-syntax CASE 5B.1. 2012-01-31 21:59:58 +00:00
Alan Mackenzie
9657183b6f Eliminate sluggishness and hangs in fontification of "semicolon deserts".
cc-engine.el (c-state-nonlit-pos-interval): change value 10000 -> 3000.
(c-state-safe-place): Reformulate so it doesn't stack up an infinite
number of wrong entries in c-state-nonlit-pos-cache.
(c-determine-limit-get-base, c-determine-limit): New functions to
determine backward search limits disregarding literals.
(c-find-decl-spots): Amend commenting.
(c-cheap-inside-bracelist-p): New function which detects "={".

cc-fonts.el (c-make-font-lock-BO-decl-search-function): Give a limit to a
backward search.
(c-font-lock-declarations): Fix an occurrence of point being undefined.
Check additionally for point being in a bracelist or near a macro
invocation without a semicolon so as to avoid a fruitless time consuming
search for a declarator.  Give a more precise search limit for
declarators using the new c-determine-limit.
2012-01-18 13:19:31 +00:00
Alan Mackenzie
2cc769a8c3 Fix Emacs bug #10463 - put `widen's around the critical spots. 2012-01-11 22:21:44 +00:00
Glenn Morris
acaf905b11 Add 2012 to FSF copyright years for Emacs files 2012-01-05 01:46:05 -08:00
Paul Eggert
22bcf20469 Spelling fixes. 2011-12-30 17:27:15 -08:00
Paul Eggert
9858f6c326 Spelling fixes. 2011-12-29 18:52:49 -08:00
Alan Mackenzie
13d49cbb26 Large brace-block initialisation makes CC Mode slow: Fix.
Tidy up and accelerate c-in-literal, etc. by using the c-parse-state
routines.  Limit backward searching in c-font-lock-enclosing.decl.

cc-engine.el (c-state-pp-to-literal): Return the pp-state and literal
type in addition to the limits.
(c-state-safe-place): New defun, extracted from c-state-literal-at.
(c-state-literal-at): Use the above new defun.
(c-slow-in-literal, c-fast-in-literal): Removed.
(c-in-literal, c-literal-limits): Amended to use c-state-pp-to-literal.

cc-fonts.el (c-font-lock-enclosing-decls): Check for being in a literal.
Add a limit for backward searching.

cc-mode.el (awk-mode): Don't alias c-in-literal to c-slow-in-literal.
2011-12-13 18:47:08 +00:00
Paul Eggert
333f9019e2 Spelling fixes. 2011-12-11 21:32:49 -08:00
Paul Eggert
fa46310344 Spelling fixes. 2011-12-05 00:55:25 -08:00
Paul Eggert
ee7683ebb7 Spelling fixes. 2011-11-22 23:03:56 -08:00
Paul Eggert
40ba43b4b7 Spelling fixes. 2011-11-19 23:30:16 -08:00
Paul Eggert
e1dbe924b5 Spelling fixes. 2011-11-19 18:29:42 -08:00
Paul Eggert
5396468298 Spelling fixes. 2011-11-19 01:18:31 -08:00
Stefan Monnier
c400c4d798 * lisp/progmodes/cc-engine.el (c-remove-stale-state-cache-backwards):
Don't hardcode point-min==1.
2011-11-18 10:06:20 -05:00
Juanma Barranquero
58179ccebd Fix typos. 2011-11-16 13:34:47 +01:00
Juanma Barranquero
c701515351 Fix typos. 2011-11-15 18:37:37 +01:00
Paul Eggert
da6062e6ea Spelling fixes. 2011-11-14 23:55:13 -08:00
Juanma Barranquero
0d26e0b62b Fix typos. 2011-11-15 01:54:19 +01:00