From d1e1e53dec51a9cb8aa9d6033d32428051ab7e85 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Mon, 12 Nov 2012 05:11:06 +0400 Subject: [PATCH] * lisp/progmodes/ruby-mode.el (ruby-move-to-block): When moving backward, always stop at indentation. Reverts the change from 2012-08-12T22:06:56Z!monnier@iro.umontreal.ca. Fixes: debbugs:12851 --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/ruby-mode.el | 12 +----------- test/automated/ruby-mode-tests.el | 4 ++-- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8228d857233..bfd74a15a8a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-11-12 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-move-to-block): When moving + backward, always stop at indentation. Reverts the change from + 2012-08-12T22:06:56Z!monnier@iro.umontreal.ca (Bug#12851). + 2012-11-11 Glenn Morris * ibuffer.el (ibuffer-mode-map, ibuffer-mode): diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 84cf7308d75..e4bfffa73c1 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -898,17 +898,7 @@ or blocks containing the current block." (back-to-indentation) (if (looking-at (concat "\\<\\(" ruby-block-mid-re "\\)\\>")) (setq done nil))))) - (back-to-indentation) - (when (< n 0) - (let ((eol (point-at-eol)) state next) - (if (< orig eol) (setq eol orig)) - (setq orig (point)) - (while (and (setq next (apply 'ruby-parse-partial eol state)) - (< (point) eol)) - (setq state next)) - (when (cdaadr state) - (goto-char (cdaadr state))) - (backward-word))))) + (back-to-indentation))) (defun ruby-beginning-of-block (&optional arg) "Move backward to the beginning of the current block. diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el index ba3040577b1..8da0041e9a4 100644 --- a/test/automated/ruby-mode-tests.el +++ b/test/automated/ruby-mode-tests.el @@ -202,13 +202,13 @@ VALUES-PLIST is a list with alternating index and value elements." | end |")) -(ert-deftest ruby-move-to-block-stops-at-opening () +(ert-deftest ruby-move-to-block-stops-at-indentation () (with-temp-buffer (insert "def f\nend") (beginning-of-line) (ruby-mode) (ruby-move-to-block -1) - (should (looking-at "f$")))) + (should (looking-at "^def")))) (ert-deftest ruby-toggle-block-to-do-end () (with-temp-buffer -- 2.39.2