emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Dmitry Gutov
Subject: [Emacs-diffs] trunk r114809: * lisp/progmodes/ruby-mode.el (ruby-smie--args-separator-p): Be more
Date: Sat, 26 Oct 2013 01:16:42 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114809
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Sat 2013-10-26 05:16:37 +0400
message:
  * lisp/progmodes/ruby-mode.el (ruby-smie--args-separator-p): Be more
  specific in what the first arg can be: a non-keyword word,
  string/regexp/percent literal opener, opening paren, or unary
  operator followed directly by word.
  
  * test/automated/ruby-mode-tests.el (ruby-toggle-block-to-brace): Fix
  the test, in respect to adding the space after the curly.
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-10-25 15:23:45 +0000
+++ b/lisp/ChangeLog    2013-10-26 01:16:37 +0000
@@ -1,3 +1,10 @@
+2013-10-26  Dmitry Gutov  <address@hidden>
+
+       * progmodes/ruby-mode.el (ruby-smie--args-separator-p): Be more
+       specific in what the first arg can be: a non-keyword word,
+       string/regexp/percent literal opener, opening paren, or unary
+       operator followed directly by word.
+
 2013-10-25  Stefan Monnier  <address@hidden>
 
        * progmodes/prolog.el: Remove old indent; use post-self-insert-hook.

=== modified file 'lisp/progmodes/ruby-mode.el'
--- a/lisp/progmodes/ruby-mode.el       2013-10-25 04:35:56 +0000
+++ b/lisp/progmodes/ruby-mode.el       2013-10-26 01:16:37 +0000
@@ -372,9 +372,18 @@
   (and
    (< pos (line-end-position))
    (or (eq (char-syntax (preceding-char)) '?w)
+       ;; FIXME: Check that the preceding token is not a keyword.
+       ;; This isn't very important most of the time, though.
        (and (memq (preceding-char) '(?! ??))
             (eq (char-syntax (char-before (1- (point)))) '?w)))
-   (memq (char-syntax (char-after pos)) '(?w ?\"))))
+   (or (and (eq (char-syntax (char-after pos)) ?w)
+            (not (looking-at (regexp-opt '("unless" "if" "while" "until"
+                                           "else" "elsif" "do" "end")
+                                         'symbols))))
+       (memq (syntax-after pos) '(7 15))
+       (save-excursion
+         (goto-char pos)
+         (looking-at "\\s(\\|[-+!~:]\\sw")))))
 
 (defun ruby-smie--at-dot-call ()
   (and (eq ?w (char-syntax (following-char)))

=== modified file 'test/ChangeLog'
--- a/test/ChangeLog    2013-10-24 07:38:45 +0000
+++ b/test/ChangeLog    2013-10-26 01:16:37 +0000
@@ -1,3 +1,8 @@
+2013-10-26  Dmitry Gutov  <address@hidden>
+
+       * automated/ruby-mode-tests.el (ruby-toggle-block-to-brace): Fix
+       the test, in respect to adding the space after the curly.
+
 2013-10-24  Michael Albinus  <address@hidden>
 
        * automated/ert-tests.el (ert-test-skip-unless): New test case.

=== modified file 'test/automated/ruby-mode-tests.el'
--- a/test/automated/ruby-mode-tests.el 2013-10-10 21:43:47 +0000
+++ b/test/automated/ruby-mode-tests.el 2013-10-26 01:16:37 +0000
@@ -292,8 +292,8 @@
     (should (string= "foo do |b|\nend" (buffer-string)))))
 
 (ert-deftest ruby-toggle-block-to-brace ()
-  (let ((pairs '((16 . "foo {|b| b + 2 }")
-                 (15 . "foo {|b|\n  b + 2\n}"))))
+  (let ((pairs '((17 . "foo { |b| b + 2 }")
+                 (16 . "foo { |b|\n  b + 2\n}"))))
     (dolist (pair pairs)
       (with-temp-buffer
         (let ((fill-column (car pair)))

=== modified file 'test/indent/ruby.rb'
--- a/test/indent/ruby.rb       2013-10-24 00:47:28 +0000
+++ b/test/indent/ruby.rb       2013-10-26 01:16:37 +0000
@@ -174,6 +174,19 @@
 method! arg1,
         arg2
 
+method !arg1,
+       arg2
+
+method [],
+       arg2
+
+method :foo,
+       :bar
+
+method (a + b),
+       c, :d => :e,
+       f: g
+
 it "is a method call with block" do |asd|
   foo
 end
@@ -213,18 +226,6 @@
   i + 1
 end
 
-method !arg1,
-       arg2
-
-method [],
-       arg2
-
-method :foo,
-       :bar
-
-method (a + b),
-       c
-
 bar.foo do # "." is parent to "do"; it shouldn't be.
   bar
 end


reply via email to

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