emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r114935: * lisp/progmodes/ruby-mode.el (ruby-smie--f


From: Dmitry Gutov
Subject: [Emacs-diffs] trunk r114935: * lisp/progmodes/ruby-mode.el (ruby-smie--forward-token)
Date: Mon, 04 Nov 2013 10:51:05 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114935
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Mon 2013-11-04 12:50:47 +0200
message:
  * lisp/progmodes/ruby-mode.el (ruby-smie--forward-token)
  (ruby-smie--backward-token): Tokenize heredocs as semicolons.
  
  * test/automated/ruby-mode-tests.el: Remove outdated comment.
  
  * test/indent/ruby.rb: Add a statement on the line after heredoc.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/ruby-mode.el    
rubymode.el-20091113204419-o5vbwnq5f7feedwu-8804
  test/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-8588
  test/automated/ruby-mode-tests.el 
rubymodetests.el-20120720101201-mn39s4kfopdxj3ek-1
  test/indent/ruby.rb            ruby.rb-20120424165921-h044139hbrd7snvw-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-11-04 04:29:59 +0000
+++ b/lisp/ChangeLog    2013-11-04 10:50:47 +0000
@@ -1,3 +1,8 @@
+2013-11-04  Dmitry Gutov  <address@hidden>
+
+       * progmodes/ruby-mode.el (ruby-smie--forward-token)
+       (ruby-smie--backward-token): Tokenize heredocs as semicolons.
+
 2013-11-04  Michal Nazarewicz  <address@hidden>
 
        * textmodes/fill.el (fill-single-char-nobreak-p): New function

=== modified file 'lisp/progmodes/ruby-mode.el'
--- a/lisp/progmodes/ruby-mode.el       2013-11-03 22:56:03 +0000
+++ b/lisp/progmodes/ruby-mode.el       2013-11-04 10:50:47 +0000
@@ -393,7 +393,12 @@
   (let ((pos (point)))
     (skip-chars-forward " \t")
     (cond
-     ((looking-at "\\s\"") "")          ;A heredoc or a string.
+     ((looking-at "\\s\"") ;A heredoc or a string.
+      (if (not (looking-at "\n"))
+          ""
+        ;; Tokenize the whole heredoc as semicolon.
+        (goto-char (scan-sexps (point) 1))
+        ";"))
      ((and (looking-at "[\n#]")
            (ruby-smie--implicit-semi-p)) ;Only add implicit ; when needed.
       (if (eolp) (forward-char 1) (forward-comment 1))
@@ -435,7 +440,10 @@
     (cond
      ((and (> pos (line-end-position)) (ruby-smie--implicit-semi-p))
       (skip-chars-forward " \t") ";")
-     ((and (bolp) (not (bobp))) "")         ;Presumably a heredoc.
+     ((and (bolp) (not (bobp)))         ;Presumably a heredoc.
+      ;; Tokenize the whole heredoc as semicolon.
+      (goto-char (scan-sexps (point) -1))
+      ";")
      ((and (> pos (point)) (not (bolp))
            (ruby-smie--args-separator-p pos))
       ;; We have "ID SPC ID", which is a method call, but it binds less tightly

=== modified file 'test/ChangeLog'
--- a/test/ChangeLog    2013-11-04 01:48:08 +0000
+++ b/test/ChangeLog    2013-11-04 10:50:47 +0000
@@ -1,3 +1,9 @@
+2013-11-04  Dmitry Gutov  <address@hidden>
+
+       * indent/ruby.rb: Add a statement on the line after heredoc.
+
+       * automated/ruby-mode-tests.el: Remove outdated comment.
+
 2013-11-04  Glenn Morris  <address@hidden>
 
        * automated/Makefile.in (abs_srcdir): Remove.

=== modified file 'test/automated/ruby-mode-tests.el'
--- a/test/automated/ruby-mode-tests.el 2013-10-26 01:16:37 +0000
+++ b/test/automated/ruby-mode-tests.el 2013-11-04 10:50:47 +0000
@@ -585,8 +585,6 @@
     (end-of-defun)
     (should (= 5 (line-number-at-pos)))))
 
-;; Tests below fail when using SMIE.
-
 (defvar ruby-sexp-test-example
   (ruby-test-string
    "class C

=== modified file 'test/indent/ruby.rb'
--- a/test/indent/ruby.rb       2013-11-02 05:18:11 +0000
+++ b/test/indent/ruby.rb       2013-11-04 10:50:47 +0000
@@ -3,6 +3,7 @@
   boo hoo
   end
   eowarn
+  foo
 end
 
 # Percent literals.


reply via email to

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