diff options
Diffstat (limited to 'lisp/progmodes/ruby-mode.el')
-rw-r--r-- | lisp/progmodes/ruby-mode.el | 11 |
1 files changed, 8 insertions, 3 deletions
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." |