[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r114587: * lisp/progmodes/ruby-mode.el (ruby-smie-ru
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] trunk r114587: * lisp/progmodes/ruby-mode.el (ruby-smie-rules): Indent after hanging |
Date: |
Wed, 09 Oct 2013 03:18:07 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 114587
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Wed 2013-10-09 06:18:01 +0300
message:
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Indent after hanging
iuwu-mod token.
(ruby-smie--implicit-semi-p): Prohibit implicit semicolon after
hanging iuwu-mod token.
(ruby-smie--forward-token): Do not include a dot after a token in
that token.
(ruby-smie--backward-token): Likewise.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/progmodes/ruby-mode.el
rubymode.el-20091113204419-o5vbwnq5f7feedwu-8804
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-08 23:20:12 +0000
+++ b/lisp/ChangeLog 2013-10-09 03:18:01 +0000
@@ -1,3 +1,13 @@
+2013-10-09 Dmitry Gutov <address@hidden>
+
+ * progmodes/ruby-mode.el (ruby-smie-rules): Indent after hanging
+ iuwu-mod token.
+ (ruby-smie--implicit-semi-p): Prohibit implicit semicolon after
+ hanging iuwu-mod token.
+ (ruby-smie--forward-token): Do not include a dot after a token in
+ that token.
+ (ruby-smie--backward-token): Likewise.
+
2013-10-08 Juri Linkov <address@hidden>
* isearch.el (isearch-help-map, isearch-mode-map): Don't bind [t]
=== modified file 'lisp/progmodes/ruby-mode.el'
--- a/lisp/progmodes/ruby-mode.el 2013-10-07 23:03:16 +0000
+++ b/lisp/progmodes/ruby-mode.el 2013-10-09 03:18:01 +0000
@@ -296,6 +296,9 @@
(let ((tok (save-excursion (ruby-smie--backward-token))))
(or (equal tok "?")
(string-match "\\`\\s." tok))))
+ (and (eq (car (syntax-after (1- (point)))) 2)
+ (equal (save-excursion (ruby-smie--backward-token))
+ "iuwu-mod"))
(save-excursion
(forward-comment 1)
(eq (char-after) ?.))))))
@@ -334,9 +337,6 @@
(if (looking-at ":\\s.+")
(progn (goto-char (match-end 0)) (match-string 0)) ;; bug#15208.
(let ((tok (smie-default-forward-token)))
- (when (eq ?. (char-after))
- (forward-char 1)
- (setq tok (concat tok "." (ruby-smie--forward-id))))
(cond
((member tok '("unless" "if" "while" "until"))
(if (save-excursion (forward-word -1) (ruby-smie--bosp))
@@ -375,7 +375,7 @@
(let ((tok (smie-default-backward-token)))
(when (eq ?. (char-before))
(forward-char -1)
- (setq tok (concat (ruby-smie--backward-id) "." tok)))
+ (setq tok (concat "." tok)))
(when (and (eq ?: (char-before)) (string-match "\\`\\s." tok))
(forward-char -1) (setq tok (concat ":" tok))) ;; bug#15208.
(cond
@@ -394,6 +394,9 @@
(line-end-position))
(ruby-smie--backward-token)) ;Fully redundant.
(t ";")))
+ ;; FIXME: We shouldn't merge the dot with preceding token here
+ ;; either, but not doing that breaks indentation of hanging
+ ;; method calls with dot on the first line.
((equal tok ".")
(concat (ruby-smie--backward-id) tok))
(t tok)))))))
@@ -419,7 +422,7 @@
;; when the opening statement is hanging.
(when (smie-rule-hanging-p)
(smie-backward-sexp 'halfsexp) (smie-indent-virtual)))
- (`(:after . "=") 2)
+ (`(:after . ,(or "=" "iuwu-mod")) 2)
(`(:before . "do")
(when (or (smie-rule-hanging-p)
(save-excursion
=== modified file 'test/automated/ruby-mode-tests.el'
--- a/test/automated/ruby-mode-tests.el 2013-10-06 01:21:51 +0000
+++ b/test/automated/ruby-mode-tests.el 2013-10-09 03:18:01 +0000
@@ -594,6 +594,9 @@
| def foo
| self.end
| D.new.class
+ | [1, 2, 3].map do |i|
+ | i + 1
+ | end.sum
| end
|end"))
@@ -601,11 +604,11 @@
(ruby-with-temp-buffer ruby-sexp-test-example
(goto-line 2)
(ruby-forward-sexp)
- (should (= 5 (line-number-at-pos)))))
+ (should (= 8 (line-number-at-pos)))))
(ert-deftest ruby-backward-sexp-skips-method-calls-with-keyword-names ()
(ruby-with-temp-buffer ruby-sexp-test-example
- (goto-line 5)
+ (goto-line 8)
(end-of-line)
(ruby-backward-sexp)
(should (= 2 (line-number-at-pos)))))
=== modified file 'test/indent/ruby.rb'
--- a/test/indent/ruby.rb 2013-10-07 23:01:23 +0000
+++ b/test/indent/ruby.rb 2013-10-09 03:18:01 +0000
@@ -148,10 +148,14 @@
}
}
+foo if
+ bar
+
# Examples below still fail with `ruby-use-smie' on:
foo +
bar
-foo if
- bar
+foo = [1, 2, 3].map do |i|
+ i + 1
+end
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r114587: * lisp/progmodes/ruby-mode.el (ruby-smie-rules): Indent after hanging,
Dmitry Gutov <=