diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index f0337775d51..c3c77d68e9a 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -546,6 +546,12 @@ ruby-ts--indent-rules ((n-p-gp nil nil "regex") no-indent 0) ((parent-is "regex") no-indent 0) + ;; Incomplete buffer state, better not reindent. + ((and (parent-is "ERROR") + (or (node-is ,ruby-ts--class-or-module-regex) + (node-is "\\`def\\'"))) + no-indent 0) + ;; if then else elseif notes: ;; ;; 1. The "then" starts at the end of the line that ends