Function: c-indent-defun

c-indent-defun is an interactive and byte-compiled function defined in cc-cmds.el.gz.

Signature

(c-indent-defun)

Documentation

Indent the current top-level declaration or macro syntactically.

In the macro case this also has the effect of realigning any line continuation backslashes, unless c-auto-align-backslashes is nil.

Probably introduced at or before Emacs version 19.23.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-cmds.el.gz
(defun c-indent-defun ()
  "Indent the current top-level declaration or macro syntactically.
In the macro case this also has the effect of realigning any line
continuation backslashes, unless `c-auto-align-backslashes' is nil."
  (interactive "*")
  (let ((here (point-marker)) decl-limits case-fold-search)
    (unwind-protect
	(progn
	  (c-save-buffer-state nil
	    ;; We try to be line oriented, unless there are several
	    ;; declarations on the same line.
	    (if (looking-at c-syntactic-eol)
		(c-backward-token-2 1 nil (c-point 'bol))
	      (c-forward-token-2 0 nil (c-point 'eol)))
	    (setq decl-limits (c-declaration-limits nil)))
	  (if decl-limits
	      (c-indent-region (car decl-limits)
			       (cdr decl-limits))))
      (goto-char here)
      (set-marker here nil))))