diff options
| author | Stefan Monnier | 2013-11-03 17:56:03 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2013-11-03 17:56:03 -0500 |
| commit | e61845c1db42405938b9dca7dfff73b4ab6aa52a (patch) | |
| tree | 5dcf9ea81d4015156240064276f4b85715f7bd40 /lisp/progmodes/ruby-mode.el | |
| parent | 295559b0fda938555055d0e7769d823428d99865 (diff) | |
| download | emacs-e61845c1db42405938b9dca7dfff73b4ab6aa52a.tar.gz emacs-e61845c1db42405938b9dca7dfff73b4ab6aa52a.zip | |
* lisp/emacs-lisp/smie.el (smie-rule-parent): Always call
smie-indent-virtual rather than only for hanging tokens.
(smie--next-indent-change): New helper command.
* lisp/progmodes/ruby-mode.el (ruby-smie--rule-parent-skip-assign): Remove.
(ruby-smie-rules): Use smie-rule-parent instead.
Diffstat (limited to 'lisp/progmodes/ruby-mode.el')
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 36aa8eeae96..75c59ebe1fd 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -467,16 +467,6 @@ explicitly declared in magic comment." | |||
| 467 | (t ";"))) | 467 | (t ";"))) |
| 468 | (t tok))))))) | 468 | (t tok))))))) |
| 469 | 469 | ||
| 470 | (defun ruby-smie--rule-parent-skip-assign () | ||
| 471 | (let* ((parent (smie-indent--parent)) | ||
| 472 | (tok (caddr parent))) | ||
| 473 | (if (and (stringp tok) (string-match-p "[+-*&|^]?=\\'" tok)) | ||
| 474 | (progn | ||
| 475 | (goto-char (cadr parent)) | ||
| 476 | (let (smie--parent) | ||
| 477 | (smie-rule-parent))) | ||
| 478 | (smie-rule-parent)))) | ||
| 479 | |||
| 480 | (defun ruby-smie-rules (kind token) | 470 | (defun ruby-smie-rules (kind token) |
| 481 | (pcase (cons kind token) | 471 | (pcase (cons kind token) |
| 482 | (`(:elem . basic) ruby-indent-level) | 472 | (`(:elem . basic) ruby-indent-level) |
| @@ -499,7 +489,7 @@ explicitly declared in magic comment." | |||
| 499 | ((and (equal token "{") | 489 | ((and (equal token "{") |
| 500 | (not (smie-rule-prev-p "(" "{" "[" "," "=>" "=" "return" ";"))) | 490 | (not (smie-rule-prev-p "(" "{" "[" "," "=>" "=" "return" ";"))) |
| 501 | ;; Curly block opener. | 491 | ;; Curly block opener. |
| 502 | (ruby-smie--rule-parent-skip-assign)) | 492 | (smie-rule-parent)) |
| 503 | ((smie-rule-hanging-p) | 493 | ((smie-rule-hanging-p) |
| 504 | ;; Treat purely syntactic block-constructs as being part of their parent, | 494 | ;; Treat purely syntactic block-constructs as being part of their parent, |
| 505 | ;; when the opening statement is hanging. | 495 | ;; when the opening statement is hanging. |
| @@ -508,7 +498,7 @@ explicitly declared in magic comment." | |||
| 508 | (cons 'column (smie-indent-virtual))))) | 498 | (cons 'column (smie-indent-virtual))))) |
| 509 | (`(:after . ,(or "=" "iuwu-mod")) 2) | 499 | (`(:after . ,(or "=" "iuwu-mod")) 2) |
| 510 | (`(:after . " @ ") (smie-rule-parent)) | 500 | (`(:after . " @ ") (smie-rule-parent)) |
| 511 | (`(:before . "do") (ruby-smie--rule-parent-skip-assign)) | 501 | (`(:before . "do") (smie-rule-parent)) |
| 512 | (`(,(or :before :after) . ".") | 502 | (`(,(or :before :after) . ".") |
| 513 | (unless (smie-rule-parent-p ".") | 503 | (unless (smie-rule-parent-p ".") |
| 514 | (smie-rule-parent ruby-indent-level))) | 504 | (smie-rule-parent ruby-indent-level))) |