From 7790a27058bf9ec3dcdf31746853f125d6c84693 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 22 Oct 2013 11:45:56 -0400 Subject: [PATCH] * lisp/emacs-lisp/smie.el (smie-rule-parent): Fix opener-test. * lisp/progmodes/ruby-mode.el (ruby-smie-rules): Remove corresponding workaround. Fix indentation rule of ";" so it also applies when ";" is the parent. --- lisp/ChangeLog | 12 ++++++++++-- lisp/emacs-lisp/smie.el | 3 ++- lisp/progmodes/ruby-mode.el | 14 ++------------ 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6e1b8c1373..0b08cd6bad 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,10 +1,18 @@ +2013-10-22 Stefan Monnier + + + * emacs-lisp/smie.el (smie-rule-parent): Fix opener-test. + * progmodes/ruby-mode.el (ruby-smie-rules): + Remove corresponding workaround. Fix indentation rule of ";" so it + also applies when ";" is the parent. + 2013-10-22 Xue Fuqiao * frame.el (display-screens, display-pixel-height) (display-pixel-width, display-mm-width, display-backing-store) (display-save-under, display-planes, display-color-cells) - (display-visual-class, display-monitor-attributes-list): Mention - the optional ‘display’ argument in doc strings. + (display-visual-class, display-monitor-attributes-list): + Mention the optional ‘display’ argument in doc strings. 2013-10-22 Michael Gauland diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index ebb82f4bf5..f1ffdec5ec 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -1242,7 +1242,8 @@ Only meaningful when called from within `smie-rules-function'." ;; rules-function, so it gives it a chance to tweak ;; indentation (e.g. by forcing indentation relative to ;; its own parent, as in fn a => fn b => fn c =>). - (if (or (listp (car smie--parent)) (smie-indent--hanging-p)) + (if (or (not (numberp (car smie--parent))) + (smie-indent--hanging-p)) (smie-indent-virtual) (current-column)))))) (defvar smie-rule-separator-outdent 2) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index a6e54701ff..fa681e5cde 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -444,23 +444,13 @@ explicitly declared in magic comment." ;; should be aligned with the first. (`(:elem . args) (if (looking-at "\\s\"") 0)) ;; (`(:after . ",") (smie-rule-separator kind)) - (`(:after . ";") + (`(:before . ";") (cond ((smie-rule-parent-p "def" "begin" "do" "class" "module" "for" "while" "until" "unless" "if" "then" "elsif" "else" "when" - "rescue" "ensure") + "rescue" "ensure" "{") (smie-rule-parent ruby-indent-level)) - ((and (smie-rule-parent-p "{") - (save-excursion - (goto-char (1+ (cadr (smie-indent--parent)))) - (ruby-smie--opening-pipe-p) - (forward-char -1) - ;; Can't delegate to `smie-rule-parent' because it - ;; short-circuits to `current-column' when the parent - ;; token is of paren syntax class and not hanging. - (cons 'column (+ (smie-indent-virtual) - ruby-indent-level))))) ;; For (invalid) code between switch and case. ;; (if (smie-parent-p "switch") 4) (t 0))) -- 2.20.1