Skip to content

Instantly share code, notes, and snippets.

@PhilHudson
Created February 28, 2012 17:44
Show Gist options
  • Save PhilHudson/1933912 to your computer and use it in GitHub Desktop.
Save PhilHudson/1933912 to your computer and use it in GitHub Desktop.
C-style closing-paren indent for elisp
(defadvice lisp-indent-line (after my-trailing-parens-lisp-indentation)
"Make close parens on their own line indent like C"
(interactive)
(let (col-num)
(save-excursion
(beginning-of-line)
(when (looking-at "^\\s-*\)")
(search-forward "\)")
(backward-sexp)
(setf col-num (current-column))
(forward-sexp)
(backward-char)
(delete-region (line-beginning-position) (point))
(indent-to col-num)))
(when col-num (move-to-column col-num))))
@PhilHudson
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment