+2013-10-09 Dmitry Gutov <dgutov@yandex.ru>
+
+ * 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 <juri@jurta.org>
* isearch.el (isearch-help-map, isearch-mode-map): Don't bind [t]
(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) ?.))))))
(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))
(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
(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)))))))
;; 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
| def foo
| self.end
| D.new.class
+ | [1, 2, 3].map do |i|
+ | i + 1
+ | end.sum
| end
|end"))
(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)))))