Commit graph

115 commits

Author SHA1 Message Date
Alan Mackenzie
38de11bd5a Fix indentation/fontification of Java enum with "implements".
* progmodes/cc-langs.el (c-postfix-decl-spec-key): New variable, a
regexp which matches "implements", etc., in Java.
* progmodes/cc-engine.el (c-inside-bracelist-p): Check for extra
specifier clauses coming after "enum".
* progmodes/cc-fonts.el (c-font-lock-declarations)
(c-font-lock-enum-tail): Check for extra specifier clauses coming
after "enum".
2013-09-28 17:17:01 +00:00
Alan Mackenzie
ece1500470 C++: fontify identifier in declaration following "public:" correctly.
* progmodes/cc-langs.el (c-decl-start-colon-kwd-re): New lang var
to match "public", etc.
(c-decl-prefix-re): Add ":" into the C++ value.
* progmodes/cc-engine.el (c-find-decl-prefix-search): Refactor a
bit.  Add a check for a ":" preceded by "public", etc.
2013-09-21 17:21:29 +00:00
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
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
f5950f7afe Fontify a Java generic method as a function.
* progmodes/cc-langs.el (c-recognize-<>-arglists): Set the Java
value to t.
2013-07-27 17:35:04 +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
Alan Mackenzie
20e527d0c5 Correct the placement of c-cpp-delimiters when there're #s not at col 0.
* progmodes/cc-langs.el (c-anchored-cpp-prefix): Reformulate and
        place a submatch around the #.
        * progmodes/cc-mode.el(c-neutralize-syntax-in-and-mark-CPP): Start
        a search at BOL.  Put the c-cpp-delimiter category text propertiy
        on the #, not BOL.
2013-04-15 16:10:24 +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
Paul Eggert
65e7ca35a6 In doc, use standard American English style for e.g., etc., i.e. 2013-02-12 09:36:54 -08:00
Paul Eggert
ab422c4d68 Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
Glenn Morris
6a2e686836 Update some function declarations
* lisp/calc/calc-ext.el (math-compose-expr):
* lisp/calc/calc.el (math-compose-expr):
* lisp/progmodes/cc-defs.el (cl-macroexpand-all):
* lisp/progmodes/cc-langs.el (delete-duplicates, mapcan)
(cl-macroexpand-all): Update declarations.
2012-09-13 14:41:21 -04:00
Leo Liu
542dfbde70 * progmodes/cc-langs.el (c-symbol-start): Include char _.
Fixes: debbugs:11986
2012-07-20 19:36:41 +08:00
Alan Mackenzie
56d093a9c8 Depessimize the handling of very large macros. 2012-03-02 22:16:21 +00:00
Alan Mackenzie
9d5a8f0b3c Optimise font locking in long enum definitions. 2012-01-08 12:49:44 +00:00
Glenn Morris
acaf905b11 Add 2012 to FSF copyright years for Emacs files 2012-01-05 01:46:05 -08:00
Alan Mackenzie
be8b11bb32 Introduce a mechanism to widen the region used in context font locking.
Use this to protect declarations from losing their contexts.
2011-12-24 19:32:31 +00:00
Alan Mackenzie
cb5e207c74 Fix unstable fontification inside templates. 2011-12-23 11:48:54 +00:00
Alan Mackenzie
898169a2d8 Add the switch statement to AWK Mode. 2011-12-13 21:13:51 +00:00
Paul Eggert
333f9019e2 Spelling fixes. 2011-12-11 21:32:49 -08:00
Paul Eggert
e47695319f Spelling fixes. 2011-11-26 20:43:11 -08:00
Juanma Barranquero
cd1181dbec Fix typos. 2011-11-20 04:48:53 +01:00
Paul Eggert
e1dbe924b5 Spelling fixes. 2011-11-19 18:29:42 -08:00
Alan Mackenzie
a6ba2ab927 Add c-nonlabel-token-2-key to cc-langs.el. 2011-11-03 21:55:15 +00:00
Alan Mackenzie
536610a433 Amend to indent and fontify macros "which include their own semicolon"
correctly, using the "virtual semicolon" mechanism.

cc-defs.el: Update "virtual semicolon" comments.

cc-engine.el (c-crosses-statement-barrier-p): Recoded to scan one line at
at time rather than having \n and \r explicitly in c-stmt-delim-chars
(for some modes, e.g. AWK).
(c-forward-label): Amend for virtual semicolons.
(c-at-macro-vsemi-p, c-macro-vsemi-status-unknown-p): New functions

cc-fonts.el (c-font-lock-declarations): Take account of the new C macros.

cc-langs.el (c-at-vsemi-p-fn, c-vsemi-status-unknown-p-fn): move to
earlier in the file.
(c-opt-cpp-symbol, c-line-comment-start-regexp): New language variables.
(c-opt-cpp-macro-define): Make into a full language variable.
(c-stmt-delim-chars, c-stmt-delim-chars-with-comma): Special value for
AWK Mode (including \n, \r) removed, no longer needed.

cc-mode.el (c-mode, c++-mode, objc-mode): Invoke
c-make-macro-with-semi-re.

cc-vars.el (c-macro-with-semi-re, c-macro-names-with-semicolon): New
variables.
(c-make-macro-with-semi-re): New function

cc-mode.texi (Indentation Commands): Mention "macros with semicolons".
(Other Special Indentations): Add an xref to "Macros with ;".
(Customizing Macros): Add stuff about syntax in macros.  Add an xref to
"Macros with ;".
(Macros with ;): New page.
2011-10-27 20:34:23 +00:00
Alan Mackenzie
e371503373 Resolve invalid use of a regexp in regexp-opt.
cc-fonts.el (c-complex-decl-matchers): Add in special detection for a
java annotation.

cc-engine.el (c-forward-decl-or-cast-1): Add in special detection for a
java annotation.

cc-langs.el (c-prefix-spec-kwds-re): Remove the special handling for
java.
(c-modifier-kwds): Remove the regexp "@[A-za-z0-9]+".
2011-08-20 22:02:25 +00:00
Alan Mackenzie
b128268e44 Fontify CPP expressions correctly when starting in the middle of such a
construct.  Mainly for when jit-lock etc. starts a chunk here.

cc-fonts.el (c-font-lock-context): new buffer local variable.
(c-make-font-lock-search-form): new function, extracted from
c-make-font-lock-search-function.
(c-make-font-lock-search-function): Use the above function.
(c-make-font-lock-context-search-function): New function.
(c-cpp-matchers): Enhance the preprocessor expression case with the above
function
(c-font-lock-complex-decl-prepare):  Test for being in a CPP form which
takes an expression.

cc-langs.el (c-cpp-expr-intro-re): New lang-variable.
2011-08-20 14:43:33 +00:00
Alan Mackenzie
b248a85d10 Fontify bitfield declarations properly.
cc-langs.el (c-has-bitfields): New lang variable.
(c-symbol-chars): Now exported as a lang variable.
(c-not-primitive-type-keywords): New lang variable.

cc-fonts.el (c-font-lock-declarations): Jump over the QT keyword "more"
to prevent "more slots: ...." being spuriously parsed as a bitfield
declaraion.

cc-engine.el (c-beginning-of-statement-1): Refactor and enhance to handle
bitfield declarations.
(c-punctuation-in): New function.
(c-forward-decl-or-cast-1): Enhance CASE 3 to handle bitfield
declarations properly.
2011-07-26 19:18:40 +00:00
Alan Mackenzie
a9901f61c7 Prevent cc-langs.elc being loaded at run time.
cc-mode.el: Remove two autoload forms which loaded cc-langs.

cc-langs.el (c-make-init-lang-vars-fun): Don't emit "(require 'cc-langs)".
Quote a form so it will evaluate at (cc-mode's) compilation time.
2011-07-22 12:53:46 +00:00
Alan Mackenzie
bf2c1571f4 CC Mode: Fontify declarators properly when, e.g., a jit-lock chunk begins
inside a declaration.  Changed cc-engine.el, cc-langs.el, cc-fonts.el.
2011-07-18 17:15:24 +00:00
Alan Mackenzie
b14c0c5545 progmodes/cc-guess.el: New file.
progmodes/cc-langs.el (c-mode-menu): Added "Style..." submenu.
progmodes/cc-styles.el (cc-choose-style-for-mode): New function derived
from `c-basic-common-init'.
progmodes/cc-mode.el (top-level): Require cc-guess.
(c-basic-common-init): Use `cc-choose-style-for-mode'.
2011-06-30 20:45:12 +00:00
Glenn Morris
95df8112a0 Refill some long/short copyright headers. 2011-01-26 00:36:39 -08:00
Glenn Morris
73b0cd5003 Convert consecutive FSF copyright years to ranges. 2011-01-24 20:08:28 -08:00
Glenn Morris
0d9f702fd0 Nuke arch-tags. 2011-01-15 15:16:57 -08:00
Stefan Monnier
77ab81d054 Merge from emacs-23 2011-01-14 12:18:41 -05:00
Glenn Morris
5df4f04cd3 Add 2011 to FSF/AIST copyright years. 2011-01-02 15:50:46 -08:00
Alan Mackenzie
7f0789c9db cc-langs.el (c-type-decl-prefix-key): C++ bit: move
"\(const\|throw\|volatile\)\>" nearer the start of the regexp, so that
these keywords aren't wrongly matched as identifiers.
2010-10-19 20:45:42 +00:00
Alan Mackenzie
e15f8aaa0e Enhance fontification of declarators to take account of the
presence/absence of "typedef".

cc-engine.el (c-forward-type): New &optional param "brace-block-too".
(c-forward-decl-or-cast-1): cdr of return value now indicates the
presence of either or both of a "struct"-like keyword and "typedef".

cc-fonts.el (c-complex-decl-matchers): Remove the heuristic fontification
of declarators which follow a "}".
(c-font-lock-declarations): Fontify declarators according to the
presence/absence of "typedef".

cc-langs.el (c-typedef-kwds c-typedef-key): New lang variable for
"typedef".
(c-typedef-decl-key): New lang variable built from c-typedef-decl-kwds.
2010-10-09 19:58:28 +00:00
Chong Yidong
bd78fa1d54 Add "Package:" file headers to denote built-in packages. 2010-08-29 12:17:13 -04:00
Alan Mackenzie
452ea85502 Enhance Java Mode to handle Java 5.0 (Tiger) and Java 6 (Mustang).
Contributed by Nathaniel Flath.
2010-07-31 20:01:08 +00:00
Alan Mackenzie
e42a330165 Reverse 2009-12-03T16:02:10Z!acm@muc.de "Enhance `c-parse-state' to run efficiently in
\"brace desserts\".".
2010-04-12 18:58:52 +00:00
Alan Mackenzie
7af4bf3aea Reverse change 2010-02-04T21:15:37Z!acm@muc.de: "Change strategy for marking < and > as template
delimiters: mark them strictly in matching pairs."
2010-04-12 15:15:07 +00:00
Alan Mackenzie
dd969a56a5 Change strategy for marking < and > as template delimiters: mark them
strictly in matching pairs.
2010-02-04 21:15:37 +00:00
Glenn Morris
114f9c9679 Add 2010 to copyright years. 2010-01-13 00:35:10 -08:00
Alan Mackenzie
0ec1d2c5bb Enhance `c-parse-state' to run efficiently in "brace desserts".
* progmodes/cc-mode.el (c-basic-common-init): Call
c-state-cache-init.
(c-neutralize-syntax-in-and-mark-CPP):  Renamed from
c-extend-and-neutralize-syntax-in-CPP.  Mark each CPP construct by
placing `category' properties value 'c-cpp-delimiter at its
boundaries.

* progmodes/cc-langs.el (c-before-font-lock-function):
c-extend-and-neutralize-syntax-in-CPP has been renamed
c-neutralize-syntax-in-and-mark-CPP.

* progmodes/cc-fonts.el (c-cpp-matchers): Mark template brackets
with `category' properties now, not `syntax-table' ones.

* progmodes/cc-engine.el (c-syntactic-end-of-macro): A new
enhanced (but slower) version of c-end-of-macro that won't land
inside a literal or on another awkward character.
(c-state-cache-too-far, c-state-cache-start)
(c-state-nonlit-pos-interval, c-state-nonlit-pos-cache)
(c-state-nonlit-pos-cache-limit, c-state-point-min)
(c-state-point-min-lit-type, c-state-point-min-lit-start)
(c-state-min-scan-pos, c-state-brace-pair-desert)
(c-state-old-cpp-beg, c-state-old-cpp-end): New constants and
buffer local variables.
(c-state-literal-at, c-state-lit-beg)
(c-state-cache-non-literal-place, c-state-get-min-scan-pos)
(c-state-mark-point-min-literal, c-state-cache-top-lparen)
(c-state-cache-top-paren, c-state-cache-after-top-paren)
(c-get-cache-scan-pos, c-get-fallback-scan-pos)
(c-state-balance-parens-backwards, c-parse-state-get-strategy)
(c-renarrow-state-cache)
(c-append-lower-brace-pair-to-state-cache)
(c-state-push-any-brace-pair, c-append-to-state-cache)
(c-remove-stale-state-cache)
(c-remove-stale-state-cache-backwards, c-state-cache-init)
(c-invalidate-state-cache-1, c-parse-state-1)
(c-invalidate-state-cache): New defuns/defmacros/defsubsts.
(c-parse-state): Enhanced and refactored.
(c-debug-parse-state): Amended to deal with all the new variables.

* progmodes/cc-defs.el (c-<-as-paren-syntax, c-mark-<-as-paren)
(c->-as-paren-syntax, c-mark->-as-paren, c-unmark-<->-as-paren):
modify to use category text properties rather than syntax-table
ones.
(c-suppress-<->-as-parens, c-restore-<->-as-parens): new defsubsts
to switch off/on the syntactic paren property of C++ template
delimiters using the category property.
(c-with-<->-as-parens-suppressed): Macro to invoke code with
template delims suppressed.
(c-cpp-delimiter, c-set-cpp-delimiters, c-clear-cpp-delimiters):
New constant/macros which apply category properties to the start
and end of preprocessor constructs.
(c-comment-out-cpps, c-uncomment-out-cpps): defsubsts which
"comment out" the syntactic value of characters in preprocessor
constructs.
(c-with-cpps-commented-out)
(c-with-all-but-one-cpps-commented-out): Macros to invoke code
with characters in all or all but one preprocessor constructs
"commented out".
2009-12-03 16:02:10 +00:00
Tassilo Horn
653d15547a 2009-11-20 Tassilo Horn <tassilo@member.fsf.org>
* progmodes/cc-cmds.el (c-update-modeline)
	(c-forward-into-nomenclature, c-backward-into-nomenclature): Refer
	to subword.el functions instead of cc-subword.el.

	* progmodes/cc-mode.el (subword-mode, c-mode-base-map): Refer to
	subword.el functions instead of cc-subword.el.

	* progmodes/cc-subword.el: Renamed to subword.el.
	* subword.el: Renamed from progmodes/cc-subword.el.
	(subword-mode-map): Renamed from c-subword-mode-map.
	(subword-mode): Renamed from c-subword-mode.
	(global-subword-mode): New global minor mode.
	(forward-subword): Renamed from c-forward-subword.
	(backward-subword): Renamed from c-backward-subword.
	(mark-subword): Renamed from c-mark-subword.
	(kill-subword): Renamed from c-kill-subword.
	(backward-kill-subword): Renamed from c-backward-kill-subword.
	(transpose-subwords): Renamed from c-tranpose-subword.
	(downcase-subword): Renamed from c-downcase-subword.
	(capitalize-subword): Renamed from c-capitalize-subword.
	(forward-subword-internal): Renamed from
	c-forward-subword-internal.
	(backward-subword-internal): Renamed from
	c-backward-subword-internal.
2009-11-20 08:22:32 +00:00
Alan Mackenzie
0000ee90eb cc-langs.el (c-nonlabel-token-key): Allow quoted character constants (as
case labels).

cc-engine.el (c-beginning-of-statement-1): Correct buggy bracketing.
2009-09-26 09:18:41 +00:00
Alan Mackenzie
a0526d5ee5 cc-mode.el (c-extend-and-neutralize-CPP-line): Renamed from
c-neutralize-syntax-in-CPP.  Set the variables c-new-BEG and c-new-END,
thus extending the font-lock region.
(c-font-lock-init): Don't set obsolete variable font-lock-lines-before.

cc-langs.el (c-before-font-lock-function): Rename a value to
c-extend-and-neutralize-syntax-in-CPP.
2009-05-19 22:35:07 +00:00
Alan Mackenzie
f0e4b2f240 Enhancements for Objective-C:
cc-vars.el
(c-objc-method-arg-min-delta-to-bracket,
c-objc-method-arg-unfinished-offset, c-objc-method-parameter-offset): New
variables.
(c-offsets-alist): Use c-lineup-ObjC-method-call-colons in entry for
objc-method-call-cont.

cc-langs.el (c-constant-kwds): New ObjC keywords "YES", "NO",
"NS_DURING", "NS_HANDLER", "NS_ENDHANDLER".

cc-align.el (c-lineup-ObjC-method-call-colons): New function.
2009-04-30 10:36:24 +00:00
Alan Mackenzie
d28e7f288e cc-engine.el (c-beginning-of-statement-1): Enhance to parse case clauses
with (compile-time) expressions.
cc-langs.el (c-case-kwds-regexp): New variable for the above.
2009-02-21 16:10:39 +00:00
Glenn Morris
66d279a7cd (declare-function): Add compatibility stub.
(delete-duplicates, mapcan, cl-macroexpand-all): Declare.
2009-01-17 20:02:41 +00:00