diff options
| author | Dmitry Gutov <dgutov@yandex.ru> | 2013-11-04 12:50:47 +0200 |
|---|---|---|
| committer | Dmitry Gutov <dgutov@yandex.ru> | 2013-11-04 12:50:47 +0200 |
| commit | dca01b092347246195d35c4bbce321f62323d8d8 (patch) | |
| tree | 7dd2cf291a2bb58fe23a9c5d322d262b4d9694c6 /lisp/progmodes/ruby-mode.el | |
| parent | 91f2d272895257f23596075a0cc42e6e5f4e490f (diff) | |
| download | emacs-dca01b092347246195d35c4bbce321f62323d8d8.tar.gz | |
* 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.
Diffstat (limited to 'lisp/progmodes/ruby-mode.el')
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 75c59ebe1fd..1c9663cc22c 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -393,7 +393,12 @@ explicitly declared in magic comment." (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 @@ explicitly declared in magic comment." (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 |
