Commit 066f3bc3 authored by Dmitry Gutov's avatar Dmitry Gutov

Recognize iuwu-mod after an escaped newline

* lisp/progmodes/ruby-mode.el (ruby-smie--bosp): Check if the
newline is escaped.
(ruby-smie-rules): Indent iuwu-mod after an escaped newline
correctly.
parent 6f7a57c7
......@@ -420,7 +420,10 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
(defun ruby-smie--bosp ()
(save-excursion (skip-chars-backward " \t")
(or (bolp) (memq (char-before) '(?\; ?=)))))
(or (and (bolp)
;; Newline is escaped.
(not (eq (char-before (1- (point))) ?\\)))
(memq (char-before) '(?\; ?=)))))
(defun ruby-smie--implicit-semi-p ()
(save-excursion
......@@ -669,7 +672,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
;; Align to the previous `when', but look up the virtual
;; indentation of `case'.
(if (smie-rule-sibling-p) 0 (smie-rule-parent)))
(`(:after . ,(or "=" "iuwu-mod" "+" "-" "*" "/" "&&" "||" "%" "**" "^" "&"
(`(:after . ,(or "=" "+" "-" "*" "/" "&&" "||" "%" "**" "^" "&"
"<=>" ">" "<" ">=" "<=" "==" "===" "!=" "<<" ">>"
"+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^=" "|"
"<<=" ">>=" "&&=" "||=" "and" "or"))
......@@ -682,6 +685,8 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
(if (ruby-smie--indent-to-stmt-p token)
(ruby-smie--indent-to-stmt)
(cons 'column (current-column)))))
(`(:before . "iuwu-mod")
(smie-rule-parent ruby-indent-level))
))
(defun ruby--at-indentation-p (&optional point)
......
......@@ -223,6 +223,9 @@ def foo
foo if
bar
fail "stuff" \
unless all_fine?
if foo?
bar
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment