(defcustom c-tab-always-indent t
"*Controls the operation of the TAB key.
-If t, hitting TAB always just indents the current line. If nil,
-hitting TAB indents the current line if point is at the left margin or
-in the line's indentation, otherwise it insert a `real' tab character
-\(see note\). If the symbol `other', then tab is inserted only within
-literals -- defined as comments and strings -- and inside preprocessor
-directives, but the line is always reindented.
+If t, hitting TAB always just indents the current line. If nil, hitting
+TAB indents the current line if point is at the left margin or in the
+line's indentation, otherwise it inserts a `real' tab character \(see
+note\). If some other value (not nil or t), then tab is inserted only
+within literals \(comments and strings), but the line is always
+reindented.
Note: The value of `indent-tabs-mode' will determine whether a real
tab character will be inserted, or the equivalent number of spaces.
handle the paragraph filling. That's done at mode initialization or
when you switch to a style which sets this variable. Thus, if you
change it in some other way, e.g. interactively in a CC Mode buffer,
-you will need to do \\[c-mode] (or whatever mode you're currently
-using) to reinitialize.
+you will need to do \\[c-setup-paragraph-variables] afterwards so that
+the other variables are updated with the new value.
-Note also that when CC Mode starts up, the other variables are
-modified before the mode hooks are run. If you change this variable
-in a mode hook, you can call `c-setup-paragraph-variables' afterwards
-to redo it."
+Note also that when CC Mode starts up, all variables are initialized
+before the mode hooks are run. It's therefore necessary to make a
+call to `c-setup-paragraph-variables' explicitly if you change this
+variable in a mode hook."
:type '(radio
(regexp :tag "Regexp for all modes")
(list
'((c-mode . t)
(c++-mode . t)
(objc-mode . t))
- "*Controls whether a final newline is ensured when the file is saved.
-The value is an association list that for each language mode specifies
-the value to give to `require-final-newline' at mode initialization;
-see that variable for details about the value. If a language isn't
-present on the association list, CC Mode won't set
-`require-final-newline' in buffers for that language."
+ "*Controls `require-final-newline' in C-related major modes.
+The value is an association list specifying, for each specific mode,
+whether to override `require-final-newline'. If the cdr of the element
+is non-nil, that means to use `mode-require-final-newline' instead."
:type `(set (cons :format "%v"
(const :format "C " c-mode)
- (symbol :format "%v" :value ,require-final-newline))
+ (const t))
(cons :format "%v"
(const :format "C++ " c++-mode)
- (symbol :format "%v" :value ,require-final-newline))
+ (const t))
(cons :format "%v"
(const :format "ObjC " objc-mode)
- (symbol :format "%v" :value ,require-final-newline))
+ (const t))
(cons :format "%v"
(const :format "Java " java-mode)
- (symbol :format "%v" :value ,require-final-newline))
+ (const t))
(cons :format "%v"
(const :format "IDL " idl-mode)
- (symbol :format "%v" :value ,require-final-newline))
+ (const t))
(cons :format "%v"
(const :format "Pike " pike-mode)
- (symbol :format "%v" :value ,require-final-newline)))
+ (const t)))
:group 'c)
(defcustom c-electric-pound-behavior nil
:group 'c)
(defcustom-c-stylevar c-label-minimum-indentation 1
- "*Minimum indentation for lines inside of top-level constructs.
+ "*Minimum indentation for lines inside code blocks.
This variable typically only affects code using the `gnu' style, which
-mandates a minimum of one space in front of every line inside
-top-level constructs. Specifically, the function
-`c-gnu-impose-minimum' on your `c-special-indent-hook' is what
-enforces this."
+mandates a minimum of one space in front of every line inside code
+blocks. Specifically, the function `c-gnu-impose-minimum' on your
+`c-special-indent-hook' is what enforces this."
:type 'integer
:group 'c)
(get 'c-offsets-alist 'c-stylevar-fallback)))
:group 'c)
+;; The syntactic symbols that can occur inside code blocks. Used by
+;; `c-gnu-impose-minimum'.
+(defconst c-inside-block-syms
+ '(defun-block-intro block-open block-close statement statement-cont
+ statement-block-intro statement-case-intro statement-case-open
+ substatement substatement-open substatement-label case-label label
+ do-while-closure else-clause catch-clause inlambda))
+
(defcustom c-style-variables-are-local-p t
"*Whether style variables should be buffer local by default.
If non-nil, then all indentation style related variables will be made
working due to this change.")
(define-widget 'c-extra-types-widget 'radio
- ;; Widget for a list of regexps for the extra types.
+ "Internal CC Mode widget for the `*-font-lock-extra-types' variables."
:args '((const :tag "none" nil)
(repeat :tag "types" regexp)))
;; in older versions in Emacs, so depending on the load order we might
;; not install the values below. There's no kludge to cope with this
;; (as opposed to the *-font-lock-keywords-* variables) since the old
-;; values works fairly well anyway.
+;; values work fairly well anyway.
(defcustom c-font-lock-extra-types
'("FILE" "\\sw+_t"
Set from `c-comment-prefix-regexp' at mode initialization.")
(make-variable-buffer-local 'c-current-comment-prefix)
-\f
-;; Figure out what features this Emacs has
-
-(cc-bytecomp-defvar open-paren-in-column-0-is-defun-start)
-
-(defconst c-emacs-features
- (let (list)
-
- (if (boundp 'infodock-version)
- ;; I've no idea what this actually is, but it's legacy. /mast
- (setq list (cons 'infodock list)))
-
- ;; XEmacs 19 and beyond use 8-bit modify-syntax-entry flags.
- ;; Emacs 19 uses a 1-bit flag. We will have to set up our
- ;; syntax tables differently to handle this.
- (let ((table (copy-syntax-table))
- entry)
- (modify-syntax-entry ?a ". 12345678" table)
- (cond
- ;; XEmacs 19, and beyond Emacs 19.34
- ((arrayp table)
- (setq entry (aref table ?a))
- ;; In Emacs, table entries are cons cells
- (if (consp entry) (setq entry (car entry))))
- ;; XEmacs 20
- ((fboundp 'get-char-table) (setq entry (get-char-table ?a table)))
- ;; before and including Emacs 19.34
- ((and (fboundp 'char-table-p)
- (char-table-p table))
- (setq entry (car (char-table-range table [?a]))))
- ;; incompatible
- (t (error "CC Mode is incompatible with this version of Emacs")))
- (setq list (cons (if (= (logand (lsh entry -16) 255) 255)
- '8-bit
- '1-bit)
- list)))
-
- (let ((buf (generate-new-buffer "test"))
- parse-sexp-lookup-properties
- parse-sexp-ignore-comments
- lookup-syntax-properties)
- (save-excursion
- (set-buffer buf)
- (set-syntax-table (make-syntax-table))
-
- ;; For some reason we have to set some of these after the
- ;; buffer has been made current. (Specifically,
- ;; `parse-sexp-ignore-comments' in Emacs 21.)
- (setq parse-sexp-lookup-properties t
- parse-sexp-ignore-comments t
- lookup-syntax-properties t)
-
- ;; Find out if the `syntax-table' text property works.
- (modify-syntax-entry ?< ".")
- (modify-syntax-entry ?> ".")
- (insert "<()>")
- (c-mark-<-as-paren 1)
- (c-mark->-as-paren 4)
- (goto-char 1)
- (c-forward-sexp)
- (if (= (point) 5)
- (setq list (cons 'syntax-properties list)))
-
- ;; Find out if generic comment delimiters work.
- (c-safe
- (modify-syntax-entry ?x "!")
- (if (string-match "\\s!" "x")
- (setq list (cons 'gen-comment-delim list))))
-
- ;; Find out if generic string delimiters work.
- (c-safe
- (modify-syntax-entry ?x "|")
- (if (string-match "\\s|" "x")
- (setq list (cons 'gen-string-delim list))))
-
- ;; See if `open-paren-in-column-0-is-defun-start' exists and
- ;; isn't buggy.
- (when (boundp 'open-paren-in-column-0-is-defun-start)
- (let ((open-paren-in-column-0-is-defun-start nil)
- (parse-sexp-ignore-comments t))
- (set-syntax-table (make-syntax-table))
- (modify-syntax-entry ?\' "\"")
- (cond
- ;; XEmacs. Afaik this is currently an Emacs-only
- ;; feature, but it's good to be prepared.
- ((memq '8-bit list)
- (modify-syntax-entry ?/ ". 1456")
- (modify-syntax-entry ?* ". 23"))
- ;; Emacs
- ((memq '1-bit list)
- (modify-syntax-entry ?/ ". 124b")
- (modify-syntax-entry ?* ". 23")))
- (modify-syntax-entry ?\n "> b")
- (insert "/* '\n () */")
- (backward-sexp)
- (if (bobp)
- (setq list (cons 'col-0-paren list))))
- (kill-buffer buf))
-
- (set-buffer-modified-p nil))
- (kill-buffer buf))
-
- ;; See if `parse-partial-sexp' returns the eighth element.
- (when (c-safe (>= (length (save-excursion (parse-partial-sexp 1 1))) 10))
- (setq list (cons 'pps-extended-state list)))
-
- ;; See if POSIX char classes work.
- (when (string-match "[[:alpha:]]" "a")
- (setq list (cons 'posix-char-classes list)))
-
- list)
- "A list of certain features in the (X)Emacs you are using.
-There are many flavors of Emacs out there, each with different
-features supporting those needed by CC Mode. The following values
-might be present:
-
-'8-bit 8 bit syntax entry flags (XEmacs style).
-'1-bit 1 bit syntax entry flags (Emacs style).
-'syntax-properties It works to override the syntax for specific characters
- in the buffer with the 'syntax-table property.
-'gen-comment-delim Generic comment delimiters work
- (i.e. the syntax class `!').
-'gen-string-delim Generic string delimiters work
- (i.e. the syntax class `|').
-'pps-extended-state `parse-partial-sexp' returns a list with at least 10
- elements, i.e. it contains the position of the
- start of the last comment or string.
-'posix-char-classes The regexp engine understands POSIX character classes.
-'col-0-paren It's possible to turn off the ad-hoc rule that a paren
- in column zero is the start of a defun.
-'infodock This is Infodock (based on XEmacs).
-
-'8-bit and '1-bit are mutually exclusive.")
-
\f
(cc-provide 'cc-vars)
+;;; arch-tag: d62e9a55-c9fe-409b-b5b6-050b6aa202c9
;;; cc-vars.el ends here