emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 066f3bc 1/4: Recognize iuwu-mod after an escaped


From: Dmitry Gutov
Subject: [Emacs-diffs] emacs-25 066f3bc 1/4: Recognize iuwu-mod after an escaped newline
Date: Mon, 07 Mar 2016 03:08:21 +0000

branch: emacs-25
commit 066f3bc3f3d024b2e10ee11e09ae6aaa1003bbda
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    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.
---
 lisp/progmodes/ruby-mode.el |    9 +++++++--
 test/indent/ruby.rb         |    3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index cebc1dc..fa94992 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -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)
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb
index dfd1c75..4947860 100644
--- a/test/indent/ruby.rb
+++ b/test/indent/ruby.rb
@@ -223,6 +223,9 @@ z = {
 foo if
   bar
 
+fail "stuff" \
+  unless all_fine?
+
 if foo?
   bar
 end



reply via email to

[Prev in Thread] Current Thread [Next in Thread]