Commit graph

104 commits

Author SHA1 Message Date
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
Glenn Morris
5858f68cd1 Comment (minor header format fixes). 2009-01-11 00:37:05 +00:00
Glenn Morris
ae940284fa Add 2009 to copyright years. 2009-01-05 03:18:22 +00:00
Glenn Morris
c97833f0ee (c-opt-op-identitier-prefix): Fix typo. 2008-09-02 02:30:38 +00:00
Glenn Morris
b1fc2b5014 Switch to recommended form of GPLv3 permissions notice. 2008-05-06 07:25:26 +00:00
Miles Bader
d02fe47dd3 Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1112
2008-04-18 02:56:45 +00:00
Stefan Monnier
cbee283dd7 Fix up comment convention on the arch-tag lines. 2008-04-10 14:10:46 +00:00
Alan Mackenzie
8835a0f7e6 (c-before-font-lock-function): Correct a typo in the doc string. 2008-04-06 21:14:28 +00:00
Alan Mackenzie
772a35442b (c-before-font-lock-function): Correct a typo in the doc string. 2008-04-06 20:34:25 +00:00
Alan Mackenzie
212906e24a (c-before-font-lock-function): Fix bug in doc-string, "c-old-LEN" ->
"c-old-END".
2008-03-04 22:14:37 +00:00
Alan Mackenzie
38cdd6f89d (c-before-font-lock-function): Fix bug in doc-string, "c-old-LEN" ->
"c-old-END".
2008-03-01 08:52:25 +00:00
Alan Mackenzie
5ee2e9881b Set of changes so that "obtrusive" syntactic elements in a
C/C++/ObjC preprocessor line (e.g. an unbalanced string quote or
unmatched paren) don't interact syntactically with stuff outside
the CPP line.
(c-get-state-before-change-function, c-before-font-lock-function,
c-anchored-cpp-prefix): new language variables.
(c-cpp-message-directives): Handle "#warning" in C, C++ and ObjC.
2008-02-19 22:11:38 +00:00