summaryrefslogtreecommitdiff
path: root/lisp/progmodes/ruby-mode.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2016-03-15 03:12:19 +0200
committerDmitry Gutov <dgutov@yandex.ru>2016-03-15 03:16:27 +0200
commit040362001d66fd721d3a85cddfadf8041cc23f7f (patch)
tree3a4a11905728e90916dd2be93be148d2c07ca707 /lisp/progmodes/ruby-mode.el
parente6776f8362bbf6466c671cc8d381ba7da9e95301 (diff)
downloademacs-040362001d66fd721d3a85cddfadf8041cc23f7f.tar.gz
Don't misindent arguments of a method call inside continuation
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Use smie-indent-virtual instead of smie-rule-parent (bug#23015). Simplify the traversal loop.
Diffstat (limited to 'lisp/progmodes/ruby-mode.el')
-rw-r--r--lisp/progmodes/ruby-mode.el20
1 files changed, 7 insertions, 13 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 1c9f0f43086..35d0cc44ed8 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -629,19 +629,13 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
;; because when `.' is inside the line, the
;; additional indentation from it looks out of place.
((smie-rule-parent-p ".")
- (let (smie--parent)
- (save-excursion
- ;; Traverse up the parents until the parent is "." at
- ;; indentation, or any other token.
- (while (and (let ((parent (smie-indent--parent)))
- (goto-char (cadr parent))
- (save-excursion
- (unless (integerp (car parent)) (forward-char -1))
- (not (ruby-smie--bosp))))
- (progn
- (setq smie--parent nil)
- (smie-rule-parent-p "."))))
- (smie-rule-parent))))
+ ;; Traverse up the call chain until the parent is not `.',
+ ;; or `.' at indentation, or at eol.
+ (while (and (not (ruby-smie--bosp))
+ (equal (nth 2 (smie-backward-sexp ".")) ".")
+ (not (ruby-smie--bosp)))
+ (forward-char -1))
+ (smie-indent-virtual))
(t (smie-rule-parent))))))
(`(:after . ,(or `"(" "[" "{"))
;; FIXME: Shouldn't this be the default behavior of