1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00
emacs/lisp/progmodes
Alan Mackenzie c417f08b16 Correctly fontify C++ direct initializations with parens inside functions
Or, more clearly, when something looks like a function declaration and it's
inside a function, fontify it as a direct initialization.

For this purpose, introduce a "brace stack" for each buffer, where an entry on
the brace stack states how deeply nested a particular position is inside
braces inside a "top level", which includes classes and namespaces.

Also introduce a new "context", "top", with which c-font-lock-declarations
signals to c-forward-decl-or-cast-1 that point is at the top level.

* lisp/progmodes/cc-langs.el (c-get-state-before-change-functions): add
c-truncate-bs-cache.
(c-flat-decl-block-kwds, c-brace-stack-thing-key, c-brace-stack-no-semi-key)
(c-type-decl-operator-prefix-key): new language constants/variables.

* lisp/progmodes/cc-engine.el (c-bs-interval, c-bs-cache, c-bs-cache-limit)
(c-bs-prev-pos, c-bs-prev-stack): New mostly local variables for the brace
stack cache.
(c-init-bs-cache, c-truncate-bs-cache, c-truncate-bs-cache, c-brace-stack-at)
(c-bs-at-toplevel-p): New functions which manipulate the brace stack (cache).
(c-find-decl-prefix-search): Keep track of whether we're at top level.
(c-find-decl-spots): New local variable cfd-top-level which records what it
says.  On calling cfd-fun, pass cfd-top-level as an additional argument.
(c-forward-declarator): Add new element DECORATED to the result list.  Set it
to non-nil when a match for c-type-decl-operator-prefix-key is found.
(c-forward-decl-or-cast-1): Handle the newly introduced context "top".
Introduce "CASE 9.5", which recognizes direct initializations.

* lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare)
(c-font-lock-enum-tail, c-font-lock-cut-off-declarators)
(c-font-lock-enclosing-decls, c-simple-decl-matchers, c-basic-matchers-after):
Add appropriate `not-top' argument to calls to c-font-lock-declarators.
(c-font-lock-declarators): Additional parameter `not-top'.  Use not-top to
participate in the decision whether to fontify an identifier as a function or
a variable.
(c-font-lock-declarations): The internal lambda function takes an additional
argument `toplev' from c-find-decl-spots, which it uses in determining the
"context" of a declaration.  Add appropriate `not-top' argument to calls to
c-font-lock-declarators.
(c-font-lock-objc-methods): Add extra parameter to internal lambda function,
like for c-font-lock-declarators.

* lisp/progmodes/cc-mode.el (c-basic-common-init): Initialize the brace stack
cache.
2016-09-11 21:09:08 +00:00
..
ada-mode.el Fix problems caused by new implementation of sub-word mode 2016-03-21 17:47:22 -07:00
ada-prj.el
ada-stmt.el
ada-xref.el Prefer grep -E/-F to egrep/fgrep 2016-05-07 18:40:55 -07:00
antlr-mode.el
asm-mode.el
autoconf.el
bat-mode.el
bug-reference.el
cc-align.el Fix problems caused by new implementation of sub-word mode 2016-03-21 17:47:22 -07:00
cc-awk.el
cc-bytecomp.el
cc-cmds.el Fix c-declaration-limits to return correct limits in all cases. 2016-09-01 18:12:43 +00:00
cc-defs.el * lisp/progmodes/cc-defs.el (c-safe-scan-lists): Resolve overelaborate "nil" 2016-08-20 20:46:39 +00:00
cc-engine.el Correctly fontify C++ direct initializations with parens inside functions 2016-09-11 21:09:08 +00:00
cc-fonts.el Correctly fontify C++ direct initializations with parens inside functions 2016-09-11 21:09:08 +00:00
cc-guess.el
cc-langs.el Correctly fontify C++ direct initializations with parens inside functions 2016-09-11 21:09:08 +00:00
cc-menus.el
cc-mode.el Correctly fontify C++ direct initializations with parens inside functions 2016-09-11 21:09:08 +00:00
cc-styles.el
cc-vars.el Fix C-M-a in a C function finding the start of a macro preceding it. 2016-06-29 20:17:39 +00:00
cfengine.el ; Revert "Use eldoc-documentation-functions" 2016-07-18 02:17:06 +03:00
cmacexp.el
compile.el Merge from origin/emacs-25 2016-05-01 18:09:29 -07:00
cperl-mode.el Remove obsolete leading * from defcustom, defface doc strings. 2016-06-09 20:13:12 -04:00
cpp.el
cwarn.el
dcl-mode.el
ebnf2ps.el
ebnf-abn.el
ebnf-bnf.el
ebnf-dtd.el
ebnf-ebx.el
ebnf-iso.el
ebnf-otz.el
ebnf-yac.el
ebrowse.el
elisp-mode.el Merge from origin/emacs-25 2016-08-05 14:10:30 -07:00
etags.el Use save-excursion in xref-location-marker more 2016-05-05 04:28:14 +03:00
executable.el
f90.el Fix problems caused by new implementation of sub-word mode 2016-03-21 17:47:22 -07:00
flymake.el
fortran.el
gdb-mi.el Avoid signaling errors when computing "Stop" in GDB menu 2016-09-11 22:07:47 +03:00
glasses.el
grep.el Escape meta chars in commands processed by shell 2016-07-13 13:27:33 +09:00
gud.el Add make-nearby-temp-file' and temporary-file-directory' 2016-08-07 13:57:23 +02:00
hideif.el An efficient built-in mapcan 2016-07-10 01:18:47 +02:00
hideshow.el Add hideshow bindings analogous to outline mode 2016-02-24 15:13:41 +11:00
icon.el Fix problems caused by new implementation of sub-word mode 2016-03-21 17:47:22 -07:00
idlw-complete-structtag.el
idlw-help.el
idlw-shell.el
idlw-toolbar.el Avoid stray As next to IDLW icons 2016-03-24 16:53:24 -07:00
idlwave.el Fix problems caused by new implementation of sub-word mode 2016-03-21 17:47:22 -07:00
inf-lisp.el
js.el Pacify 'make check-declare' 2016-05-26 13:39:41 -07:00
ld-script.el
m4-mode.el
make-mode.el Remove some face aliases obsoleted in 22.1 2016-06-23 17:13:11 -04:00
mantemp.el Fix problems caused by new implementation of sub-word mode 2016-03-21 17:47:22 -07:00
meta-mode.el
mixal-mode.el
modula2.el
octave.el ; Revert "Use eldoc-documentation-functions" 2016-07-18 02:17:06 +03:00
opascal.el
pascal.el Fix problems caused by new implementation of sub-word mode 2016-03-21 17:47:22 -07:00
perl-mode.el Fix problems caused by new implementation of sub-word mode 2016-03-21 17:47:22 -07:00
prog-mode.el Remove prog-indentation-context 2016-03-28 03:59:05 +03:00
project.el shell-quote-argument DIR when appropriate 2016-05-05 04:15:23 +03:00
prolog.el Use use-region-p in prolog.el 2016-06-25 09:49:16 +08:00
ps-mode.el Fix problems caused by new implementation of sub-word mode 2016-03-21 17:47:22 -07:00
python.el ; Revert "Use eldoc-documentation-functions" 2016-07-18 02:17:06 +03:00
ruby-mode.el Also handle escaping when string begins with a quote 2016-06-27 07:31:52 +03:00
scheme.el scheme.el: Turn literal tabs into \t 2016-05-07 12:24:27 +02:00
sh-script.el Make sh-mode always use p-s-lookup-properties 2016-08-06 16:16:02 -04:00
simula.el Fix problems caused by new implementation of sub-word mode 2016-03-21 17:47:22 -07:00
sql.el Do not sharp-quote lambdas 2016-07-26 17:10:56 +02:00
subword.el
tcl.el
vera-mode.el Fix problems caused by new implementation of sub-word mode 2016-03-21 17:47:22 -07:00
verilog-mode.el Sync with verilog-mode development tree. 2016-03-22 20:46:40 -04:00
vhdl-mode.el Fix doc string quoting 2016-06-06 09:30:22 -07:00
which-func.el
xref.el Say 'All results processed' at the end 2016-05-08 00:29:44 +03:00
xscheme.el