1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 02:31:03 -08:00

* 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.
This commit is contained in:
Stefan Monnier 2013-11-03 17:56:03 -05:00
parent 295559b0fd
commit e61845c1db
3 changed files with 25 additions and 25 deletions

View file

@ -467,16 +467,6 @@ explicitly declared in magic comment."
(t ";")))
(t tok)))))))
(defun ruby-smie--rule-parent-skip-assign ()
(let* ((parent (smie-indent--parent))
(tok (caddr parent)))
(if (and (stringp tok) (string-match-p "[+-*&|^]?=\\'" tok))
(progn
(goto-char (cadr parent))
(let (smie--parent)
(smie-rule-parent)))
(smie-rule-parent))))
(defun ruby-smie-rules (kind token)
(pcase (cons kind token)
(`(:elem . basic) ruby-indent-level)
@ -499,7 +489,7 @@ explicitly declared in magic comment."
((and (equal token "{")
(not (smie-rule-prev-p "(" "{" "[" "," "=>" "=" "return" ";")))
;; Curly block opener.
(ruby-smie--rule-parent-skip-assign))
(smie-rule-parent))
((smie-rule-hanging-p)
;; Treat purely syntactic block-constructs as being part of their parent,
;; when the opening statement is hanging.
@ -508,7 +498,7 @@ explicitly declared in magic comment."
(cons 'column (smie-indent-virtual)))))
(`(:after . ,(or "=" "iuwu-mod")) 2)
(`(:after . " @ ") (smie-rule-parent))
(`(:before . "do") (ruby-smie--rule-parent-skip-assign))
(`(:before . "do") (smie-rule-parent))
(`(,(or :before :after) . ".")
(unless (smie-rule-parent-p ".")
(smie-rule-parent ruby-indent-level)))