diff options
| author | Nobuyoshi Nakada | 2018-12-11 03:12:46 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2018-12-11 03:14:35 +0200 |
| commit | 3729a3f88fd7ce1d8a1a7f2ea61e8c4d05e954ab (patch) | |
| tree | 0fe2191e9d64bbe41e3c9984fd0d8119c6d8a398 /lisp/progmodes/ruby-mode.el | |
| parent | 0054961acf319378a588bda1df7d32d2bc0f284d (diff) | |
| download | emacs-3729a3f88fd7ce1d8a1a7f2ea61e8c4d05e954ab.tar.gz emacs-3729a3f88fd7ce1d8a1a7f2ea61e8c4d05e954ab.zip | |
Support Ruby block arguments ending with , or *
* lisp/progmodes/ruby-mode.el (ruby-smie--forward-token):
Recognize punctuation before "closing-|" as a separate token.
(ruby-smie--backward-token): Same (bug#33487).
* test/lisp/progmodes/ruby-mode-tests.el
(ruby-forward-sexp-jumps-do-end-block-with-no-args)
(ruby-backward-sexp-jumps-do-end-block-with-no-args)
(ruby-forward-sexp-jumps-do-end-block-with-empty-args)
(ruby-backward-sexp-jumps-do-end-block-with-empty-args)
(ruby-forward-sexp-jumps-do-end-block-with-args)
(ruby-backward-sexp-jumps-do-end-block-with-args)
(ruby-forward-sexp-jumps-do-end-block-with-any-args)
(ruby-forward-sexp-jumps-do-end-block-with-expanded-one-arg)
(ruby-forward-sexp-jumps-do-end-block-with-one-and-any-args)
(ruby-backward-sexp-jumps-do-end-block-with-one-and-any-args):
New tests.
Diffstat (limited to 'lisp/progmodes/ruby-mode.el')
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 2f68f004e7b..d60899cf182 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -517,6 +517,9 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." | |||
| 517 | ((ruby-smie--opening-pipe-p) "opening-|") | 517 | ((ruby-smie--opening-pipe-p) "opening-|") |
| 518 | ((ruby-smie--closing-pipe-p) "closing-|") | 518 | ((ruby-smie--closing-pipe-p) "closing-|") |
| 519 | (t tok))) | 519 | (t tok))) |
| 520 | ((string-match "\\`[^|]+|\\'" tok) | ||
| 521 | (forward-char -1) | ||
| 522 | (substring tok 0 -1)) | ||
| 520 | ((and (equal tok "") (looking-at "\\\\\n")) | 523 | ((and (equal tok "") (looking-at "\\\\\n")) |
| 521 | (goto-char (match-end 0)) (ruby-smie--forward-token)) | 524 | (goto-char (match-end 0)) (ruby-smie--forward-token)) |
| 522 | ((equal tok "do") | 525 | ((equal tok "do") |
| @@ -559,6 +562,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." | |||
| 559 | ((ruby-smie--opening-pipe-p) "opening-|") | 562 | ((ruby-smie--opening-pipe-p) "opening-|") |
| 560 | ((ruby-smie--closing-pipe-p) "closing-|") | 563 | ((ruby-smie--closing-pipe-p) "closing-|") |
| 561 | (t tok))) | 564 | (t tok))) |
| 565 | ((string-match-p "\\`[^|]+|\\'" tok) "closing-|") | ||
| 562 | ((string-match-p "\\`|[*&]\\'" tok) | 566 | ((string-match-p "\\`|[*&]\\'" tok) |
| 563 | (forward-char 1) | 567 | (forward-char 1) |
| 564 | (substring tok 1)) | 568 | (substring tok 1)) |