Skip to content

Instantly share code, notes, and snippets.

@snogglethorpe
Created July 29, 2013 05:54
Show Gist options
  • Save snogglethorpe/6102371 to your computer and use it in GitHub Desktop.
Save snogglethorpe/6102371 to your computer and use it in GitHub Desktop.
custom Emacs c-mode indentation hook
;; custom Emacs c-mode indentation hook
(defvar c-basic-offset) ; standard variable in c-mode
(defun miles-c-lineup-arglist-intro-indented-after-function (langelem)
"Works with: defun-block-intro, brace-list-intro,
statement-block-intro, statement-case-intro, arglist-intro."
(save-excursion
(beginning-of-line)
(backward-up-list 1)
(backward-sexp)
(vector (+ (current-column) c-basic-offset))))
(defun miles-c-mode-common-hook ()
(c-set-offset 'arglist-intro
'miles-c-lineup-arglist-intro-indented-after-function))
(add-hook 'c-mode-common-hook 'miles-c-mode-common-hook)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment