Skip to content

Instantly share code, notes, and snippets.

@fujin
Forked from chrisroberts/gist:5173018
Created March 15, 2013 22:36
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save fujin/5173680 to your computer and use it in GitHub Desktop.
Save fujin/5173680 to your computer and use it in GitHub Desktop.
Fix the fucking indentation rules for ruby-mode
(setq ruby-deep-indent-paren nil)
(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)))))
@dancar
Copy link

dancar commented Mar 16, 2013

omg what a life-saver! 👍 👍 👍

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