Skip to content

Instantly share code, notes, and snippets.

@epylinkn
Forked from dgutov/gist:1274520
Created October 20, 2013 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epylinkn/7063548 to your computer and use it in GitHub Desktop.
Save epylinkn/7063548 to your computer and use it in GitHub Desktop.
(defadvice ruby-indent-line (after unindent-closing-paren activate)
(let ((column (current-column))
indent offset)
(save-excursion
(back-to-indentation)
(let ((state (syntax-ppss)))
(setq offset (- column (current-column)))
(when (and (eq (char-after) ?\))
(not (zerop (car state))))
(goto-char (cadr state))
(setq indent (current-indentation)))))
(when indent
(indent-line-to indent)
(when (> offset 0) (forward-char offset)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment