From: Dmitry Gutov Date: Mon, 9 Dec 2013 03:27:21 +0000 (+0200) Subject: * lisp/progmodes/ruby-mode.el (ruby-accurate-end-of-block): When X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~500 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ff8c9764201440d24f928d864235d66263b6ed2f;p=emacs.git * lisp/progmodes/ruby-mode.el (ruby-accurate-end-of-block): When `ruby-use-smie' is t, use `smie-forward-sexp' instead of `ruby-parse-partial'. Fixes: debbugs:16078 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d09e3a4174d..2e36fdbe4cd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-12-09 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-accurate-end-of-block): When + `ruby-use-smie' is t, use `smie-forward-sexp' instead of + `ruby-parse-partial' (Bug#16078). + 2013-12-09 Leo Liu * subr.el (read-passwd): Disable show-paren-mode. (Bug#16091) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 3d30cb015d6..0f5a2a5b2a0 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -614,11 +614,16 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." (nreverse (ruby-imenu-create-index-in-block nil (point-min) nil))) (defun ruby-accurate-end-of-block (&optional end) - "TODO: document." + "Jump to the end of the current block or END, whichever is closer." (let (state (end (or end (point-max)))) - (while (and (setq state (apply 'ruby-parse-partial end state)) - (>= (nth 2 state) 0) (< (point) end))))) + (if ruby-use-smie + (save-restriction + (back-to-indentation) + (narrow-to-region (point) end) + (smie-forward-sexp)) + (while (and (setq state (apply 'ruby-parse-partial end state)) + (>= (nth 2 state) 0) (< (point) end)))))) (defun ruby-mode-variables () "Set up initial buffer-local variables for Ruby mode."