mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-28 07:50:48 -08:00
CC Mode: Allow lists of strings as safe values for *-font-lock-extra-types
* lisp/progmodes/cc-vars.el (c-list-of-strings): New function. (c-font-lock-extra-types, c++-font-lock-extra-types) (objc-font-lock-extra-types, java-font-lock-extra-types) (idl-font-lock-extra-types, pike-font-lock-extra-types): Add a :safe entry into each of thes defcustoms for c-list-of-string. (Top level): Add an autoload entry for each of the above.
This commit is contained in:
parent
aedb9e3ec3
commit
f77ea400db
1 changed files with 28 additions and 0 deletions
|
|
@ -1561,6 +1561,16 @@ also elsewhere in CC Mode to tell types from other identifiers."))
|
||||||
;; (as opposed to the *-font-lock-keywords-* variables) since the old
|
;; (as opposed to the *-font-lock-keywords-* variables) since the old
|
||||||
;; values work fairly well anyway.
|
;; values work fairly well anyway.
|
||||||
|
|
||||||
|
(defun c-list-of-strings (obj)
|
||||||
|
"Return non-nil when OBJ is a list of strings (including the empty list)."
|
||||||
|
(and
|
||||||
|
(listp obj)
|
||||||
|
(catch 'check
|
||||||
|
(dolist (elt obj)
|
||||||
|
(when (not (stringp elt))
|
||||||
|
(throw 'check nil)))
|
||||||
|
t)))
|
||||||
|
|
||||||
(defcustom c-font-lock-extra-types
|
(defcustom c-font-lock-extra-types
|
||||||
'("\\sw+_t"
|
'("\\sw+_t"
|
||||||
;; Defined in C99:
|
;; Defined in C99:
|
||||||
|
|
@ -1576,8 +1586,11 @@ also elsewhere in CC Mode to tell types from other identifiers."))
|
||||||
"For example, a value of (\"FILE\" \"\\\\sw+_t\") means the word \"FILE\"
|
"For example, a value of (\"FILE\" \"\\\\sw+_t\") means the word \"FILE\"
|
||||||
and words ending in \"_t\" are treated as type names.")
|
and words ending in \"_t\" are treated as type names.")
|
||||||
:type 'c-extra-types-widget
|
:type 'c-extra-types-widget
|
||||||
|
:safe #'c-list-of-strings
|
||||||
:group 'c)
|
:group 'c)
|
||||||
|
|
||||||
|
;;;###autoload (put 'c-font-lock-extra-types 'safe-local-variable #'c-list-of-strings)
|
||||||
|
|
||||||
(defcustom c++-font-lock-extra-types
|
(defcustom c++-font-lock-extra-types
|
||||||
'("\\sw+_t"
|
'("\\sw+_t"
|
||||||
;; C library types (except those matched by the _t pattern):
|
;; C library types (except those matched by the _t pattern):
|
||||||
|
|
@ -1607,8 +1620,11 @@ and words ending in \"_t\" are treated as type names.")
|
||||||
"For example, a value of (\"string\") means the word \"string\" is treated
|
"For example, a value of (\"string\") means the word \"string\" is treated
|
||||||
as a type name.")
|
as a type name.")
|
||||||
:type 'c-extra-types-widget
|
:type 'c-extra-types-widget
|
||||||
|
:safe #'c-list-of-strings
|
||||||
:group 'c)
|
:group 'c)
|
||||||
|
|
||||||
|
;;;###autoload (put 'c++-font-lock-extra-types 'safe-local-variable #'c-list-of-strings)
|
||||||
|
|
||||||
(defcustom objc-font-lock-extra-types nil
|
(defcustom objc-font-lock-extra-types nil
|
||||||
(c-make-font-lock-extra-types-blurb "ObjC" "objc-mode" (concat
|
(c-make-font-lock-extra-types-blurb "ObjC" "objc-mode" (concat
|
||||||
"For example, a value of (\"[" c-upper "]\\\\sw*[" c-lower "]\\\\sw*\") means
|
"For example, a value of (\"[" c-upper "]\\\\sw*[" c-lower "]\\\\sw*\") means
|
||||||
|
|
@ -1616,8 +1632,11 @@ capitalized words are treated as type names (the requirement for a
|
||||||
lower case char is to avoid recognizing all-caps macro and constant
|
lower case char is to avoid recognizing all-caps macro and constant
|
||||||
names)."))
|
names)."))
|
||||||
:type 'c-extra-types-widget
|
:type 'c-extra-types-widget
|
||||||
|
:safe #'c-list-of-strings
|
||||||
:group 'c)
|
:group 'c)
|
||||||
|
|
||||||
|
;;;###autoload (put 'objc-font-lock-extra-types 'safe-local-variable #'c-list-of-strings)
|
||||||
|
|
||||||
(defcustom java-font-lock-extra-types
|
(defcustom java-font-lock-extra-types
|
||||||
(list (concat "[" c-upper "]\\sw*[" c-lower "]\\sw"))
|
(list (concat "[" c-upper "]\\sw*[" c-lower "]\\sw"))
|
||||||
(c-make-font-lock-extra-types-blurb "Java" "java-mode" (concat
|
(c-make-font-lock-extra-types-blurb "Java" "java-mode" (concat
|
||||||
|
|
@ -1625,13 +1644,19 @@ names)."))
|
||||||
capitalized words are treated as type names (the requirement for a
|
capitalized words are treated as type names (the requirement for a
|
||||||
lower case char is to avoid recognizing all-caps constant names)."))
|
lower case char is to avoid recognizing all-caps constant names)."))
|
||||||
:type 'c-extra-types-widget
|
:type 'c-extra-types-widget
|
||||||
|
:safe #'c-list-of-strings
|
||||||
:group 'c)
|
:group 'c)
|
||||||
|
|
||||||
|
;;;###autoload (put 'java-font-lock-extra-types 'safe-local-variable #'c-list-of-strings)
|
||||||
|
|
||||||
(defcustom idl-font-lock-extra-types nil
|
(defcustom idl-font-lock-extra-types nil
|
||||||
(c-make-font-lock-extra-types-blurb "IDL" "idl-mode" "")
|
(c-make-font-lock-extra-types-blurb "IDL" "idl-mode" "")
|
||||||
:type 'c-extra-types-widget
|
:type 'c-extra-types-widget
|
||||||
|
:safe #'c-list-of-strings
|
||||||
:group 'c)
|
:group 'c)
|
||||||
|
|
||||||
|
;;;###autoload (put 'idl-font-lock-extra-types 'safe-local-variable #'c-list-of-strings)
|
||||||
|
|
||||||
(defcustom pike-font-lock-extra-types
|
(defcustom pike-font-lock-extra-types
|
||||||
(list (concat "[" c-upper "]\\sw*[" c-lower "]\\sw*"))
|
(list (concat "[" c-upper "]\\sw*[" c-lower "]\\sw*"))
|
||||||
(c-make-font-lock-extra-types-blurb "Pike" "pike-mode" (concat
|
(c-make-font-lock-extra-types-blurb "Pike" "pike-mode" (concat
|
||||||
|
|
@ -1640,8 +1665,11 @@ capitalized words are treated as type names (the requirement for a
|
||||||
lower case char is to avoid recognizing all-caps macro and constant
|
lower case char is to avoid recognizing all-caps macro and constant
|
||||||
names)."))
|
names)."))
|
||||||
:type 'c-extra-types-widget
|
:type 'c-extra-types-widget
|
||||||
|
:safe #'c-list-of-strings
|
||||||
:group 'c)
|
:group 'c)
|
||||||
|
|
||||||
|
;;;###autoload (put 'pike-font-lock-extra-types 'safe-local-variable #'c-list-of-strings)
|
||||||
|
|
||||||
(defcustom c-asymmetry-fontification-flag t
|
(defcustom c-asymmetry-fontification-flag t
|
||||||
"Whether to fontify certain ambiguous constructs by white space asymmetry.
|
"Whether to fontify certain ambiguous constructs by white space asymmetry.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue