Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #37 from lewang/master

fix previously botched defn of er/ruby-backward-up
  • Loading branch information...
commit d7513b8ae7703d35f7ef2b0ea911990cef1db9ac 2 parents d9525dc + 2756147
@magnars magnars authored
Showing with 21 additions and 5 deletions.
  1. +21 −5 ruby-mode-expansions.el
View
26 ruby-mode-expansions.el
@@ -46,17 +46,33 @@
(concat ruby-block-end-re "\\|}"))
(defsubst er/ruby-skip-past-block-end ()
+ "ensure that point is at bol"
(if (looking-at-p er/ruby-skip-past-block-end)
(forward-line 1)
(forward-line 0)))
(defun er/ruby-backward-up ()
- "a la paredit-backward-up"
+ "a la `paredit-backward-up'"
(interactive)
- (forward-line 1)
- (beginning-of-line)
- (ruby-beginning-of-block)
- (set-mark (point))
+ (loop do
+ (let ((orig-point (point))
+ progress-beg
+ progress-end)
+ (ruby-beginning-of-block)
+ (setq progress-beg (point))
+ (ruby-end-of-block)
+ (ruby-skip-past-block-end)
+ (setq progress-end (point))
+ (goto-char progress-beg)
+ (if (> progress-end orig-point)
+ (return)))))
+
+;;; This command isn't used here explicitly, but it's symmetrical with
+;;; `er/ruby-backward-up', and nifty for interactive use.
+(defun er/ruby-forward-up ()
+ "a la `paredit-forward-up'"
+ (interactive)
+ (ruby-backward-up)
(ruby-end-of-block)
(ruby-skip-past-block-end))
Please sign in to comment.
Something went wrong with that request. Please try again.