Created
October 27, 2011 15:50
-
-
Save hayeah/1319949 to your computer and use it in GitHub Desktop.
Emacs Lisp For The Fail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun ruby-reindent-then-newline-and-indent () | |
| (interactive "*") | |
| (let* ((cur (point)) | |
| ;; we need to insert a space artificially for this test to work properly :( | |
| (expand-p (progn (insert " ") | |
| (ruby-electric-space-can-be-expanded-p)))) | |
| ;; remove the inserted space | |
| (progn (goto-char cur) | |
| (delete-char 1)) | |
| (if expand-p | |
| (progn (ruby-indent-line t) | |
| (newline) | |
| (newline) ;; want to open up a new line to go back to | |
| (ruby-insert-end) | |
| (previous-line) | |
| (indent-according-to-mode)) | |
| (progn (newline) | |
| (save-excursion | |
| (end-of-line 0) | |
| (indent-according-to-mode) | |
| (delete-region (point) (progn (skip-chars-backward " \t") (point)))) | |
| (indent-according-to-mode))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment