Variable: c++-font-lock-extra-types

c++-font-lock-extra-types is a customizable variable defined in cc-vars.el.gz.

Value

("\\sw+_t" "FILE" "lconv" "tm" "va_list" "jmp_buf" "istream" "istreambuf" "ostream" "ostreambuf" "ifstream" "ofstream" "fstream" "strstream" "strstreambuf" "istrstream" "ostrstream" "ios" "string" "rope" "list" "slist" "deque" "vector" "bit_vector" "set" "multiset" "map" "multimap" "hash" "hash_set" "hash_multiset" "hash_map" "hash_multimap" "stack" "queue" "priority_queue" "type_info" "iterator" "const_iterator" "reverse_iterator" "const_reverse_iterator" "reference" "const_reference")

Documentation

*List of extra types (aside from the type keywords) to recognize in C++ mode.

Each list item should be a regexp matching a single identifier. For example, a value of ("string") means the word "string" is treated as a type name.

Note that items on this list that don't include any regexp special characters are automatically optimized using regexp-opt, so you should not use regexp-opt explicitly to build regexps here.

On decoration level 3 (and higher, where applicable), a method is used that finds most types and declarations by syntax alone. This variable is still used as a first step, but other types are recognized correctly anyway in most cases. Therefore this variable should be fairly restrictive and not contain patterns that are uncertain.

Note that this variable is only consulted when the major mode is initialized. If you change it later you have to reinitialize CC Mode by doing M-x c++-mode (c++-mode).

Despite the name, this variable is not only used for font locking but also elsewhere in CC Mode to tell types from other identifiers.

Probably introduced at or before Emacs version 20.1.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-vars.el.gz
;;;###autoload (put 'c-font-lock-extra-types 'safe-local-variable #'c-string-list-p)

(defcustom c++-font-lock-extra-types
  '("\\sw+_t"
    ;; C library types (except those matched by the _t pattern):
    "FILE" "lconv" "tm" "va_list" "jmp_buf"
    ;; Some standard C++ types that came from font-lock.el.
    ;; Experienced C++ users says there's no clear benefit in
    ;; extending this to all the types in the standard library, at
    ;; least not when they'll be recognized without "std::" too.
    "istream" "istreambuf"
    "ostream" "ostreambuf"
    "ifstream" "ofstream" "fstream"
    "strstream" "strstreambuf" "istrstream" "ostrstream"
    "ios"
    "string" "rope"
    "list" "slist"
    "deque" "vector" "bit_vector"
    "set" "multiset"
    "map" "multimap"
    "hash"
    "hash_set" "hash_multiset"
    "hash_map" "hash_multimap"
    "stack" "queue" "priority_queue"
    "type_info"
    "iterator" "const_iterator" "reverse_iterator" "const_reverse_iterator"
    "reference" "const_reference")
  (c-make-font-lock-extra-types-blurb "C++" "c++-mode"
"For example, a value of (\"string\") means the word \"string\" is treated
as a type name.")
  :type 'c-extra-types-widget
  :safe #'c-string-list-p
  :group 'c)