ruby-changes:19023
From: nobu <ko1@a...>
Date: Tue, 8 Mar 2011 12:30:30 +0900 (JST)
Subject: [ruby-changes:19023] Ruby:r31061 (trunk): * misc/ruby-mode.el (ruby-deep-indent-paren-p, ruby-calculate-indent):
nobu 2011-03-08 12:30:23 +0900 (Tue, 08 Mar 2011) New Revision: 31061 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31061 Log: * misc/ruby-mode.el (ruby-deep-indent-paren-p, ruby-calculate-indent): do not apply deep-indent inside parens at the beginning of expressions. Modified files: trunk/ChangeLog trunk/misc/ruby-mode.el Index: ChangeLog =================================================================== --- ChangeLog (revision 31060) +++ ChangeLog (revision 31061) @@ -1,3 +1,9 @@ +Tue Mar 8 12:30:06 2011 Nobuyoshi Nakada <nobu@r...> + + * misc/ruby-mode.el (ruby-deep-indent-paren-p, ruby-calculate-indent): + do not apply deep-indent inside parens at the beginning of + expressions. + Tue Mar 8 09:32:48 2011 Nobuyoshi Nakada <nobu@r...> * common.mk (configure-ext, build-ext), ext/extmk.rb (extmake): Index: misc/ruby-mode.el =================================================================== --- misc/ruby-mode.el (revision 31060) +++ misc/ruby-mode.el (revision 31061) @@ -496,8 +496,12 @@ (no-error nil) ((error "unterminated string"))))) -(defun ruby-deep-indent-paren-p (c) - (cond ((listp ruby-deep-indent-paren) +(defun ruby-deep-indent-paren-p (c &optional pos) + (cond ((save-excursion + (if pos (goto-char pos)) + (ruby-expr-beg)) + nil) + ((listp ruby-deep-indent-paren) (let ((deep (assoc c ruby-deep-indent-paren))) (cond (deep (or (cdr deep) ruby-deep-indent-paren-style)) @@ -752,7 +756,8 @@ (setq indent nil)) ; do nothing ((car (nth 1 state)) ; in paren (goto-char (setq begin (cdr (nth 1 state)))) - (let ((deep (ruby-deep-indent-paren-p (car (nth 1 state))))) + (let ((deep (ruby-deep-indent-paren-p (car (nth 1 state)) + (1- (cdr (nth 1 state)))))) (if deep (cond ((and (eq deep t) (eq (car (nth 1 state)) paren)) (skip-syntax-backward " ") @@ -771,7 +776,8 @@ (goto-char parse-start) (back-to-indentation)) (setq indent (ruby-indent-size (current-column) (nth 2 state)))) (and (eq (car (nth 1 state)) paren) - (ruby-deep-indent-paren-p (matching-paren paren)) + (ruby-deep-indent-paren-p (matching-paren paren) + (1- (cdr (nth 1 state)))) (search-backward (char-to-string paren)) (setq indent (current-column))))) ((and (nth 2 state) (> (nth 2 state) 0)) ; in nest @@ -796,7 +802,9 @@ (setq eol (point)) (beginning-of-line) (cond - ((and (not (ruby-deep-indent-paren-p paren)) + ((and (not (ruby-deep-indent-paren-p paren + (and (cdr (nth 1 state)) + (1- (cdr (nth 1 state)))))) (re-search-forward ruby-negative eol t)) (and (not (eq ?_ (char-after (match-end 0)))) (setq indent (- indent ruby-indent-level)))) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/