Function: c-initialize-cc-mode

c-initialize-cc-mode is an autoloaded and byte-compiled function defined in cc-mode.el.gz.

Signature

(c-initialize-cc-mode &optional NEW-STYLE-INIT)

Documentation

Initialize CC Mode for use in the current buffer.

If the optional NEW-STYLE-INIT is nil or left out then all necessary initialization to run CC Mode for the C language is done. Otherwise only some basic setup is done, and a call to c-init-language-vars or c-init-language-vars-for is necessary too (which gives more control). See "cc-mode.el" for more info.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-mode.el.gz
;;;###autoload
(defun c-initialize-cc-mode (&optional new-style-init)
  "Initialize CC Mode for use in the current buffer.
If the optional NEW-STYLE-INIT is nil or left out then all necessary
initialization to run CC Mode for the C language is done.  Otherwise
only some basic setup is done, and a call to `c-init-language-vars' or
`c-init-language-vars-for' is necessary too (which gives more
control).  See \"cc-mode.el\" for more info."

  (setq c-buffer-is-cc-mode t)

  (let ((initprop 'cc-mode-is-initialized)
	c-initialization-ok)
    (unless (get 'c-initialize-cc-mode initprop)
      (unwind-protect
	  (progn
	    (put 'c-initialize-cc-mode initprop t)
	    (c-initialize-builtin-style)
	    (run-hooks 'c-initialization-hook)
	    ;; Fix obsolete variables.
	    (if (boundp 'c-comment-continuation-stars)
		(setq c-block-comment-prefix c-comment-continuation-stars))
	    (add-hook 'change-major-mode-hook 'c-leave-cc-mode-mode)
	    ;; Connect up with Emacs's electric-pair-mode
	    (eval-after-load "elec-pair"
	      '(when (boundp 'electric-pair-inhibit-predicate)
		 (dolist (buf (buffer-list))
		   (with-current-buffer buf
		     (when c-buffer-is-cc-mode
		       (make-local-variable 'electric-pair-inhibit-predicate)
		       (setq electric-pair-inhibit-predicate
			     #'c-electric-pair-inhibit-predicate))))))
	    (setq c-initialization-ok t)
	    ;; Connect up with Emacs's electric-indent-mode, for >= Emacs 24.4
            (when (fboundp 'electric-indent-local-mode)
	      (add-hook 'electric-indent-mode-hook 'c-electric-indent-mode-hook)
              (add-hook 'electric-indent-local-mode-hook
                        'c-electric-indent-local-mode-hook)))
	;; Will try initialization hooks again if they failed.
	(put 'c-initialize-cc-mode initprop c-initialization-ok))))

  (unless new-style-init
    (c-init-language-vars-for 'c-mode)))