summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-08 03:30:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-08 03:30:23 +0000
commit85df40e9ab4559cd4ddde3f106ab56c76a808cc8 (patch)
tree4abd8f32b85ef15f6d3503148187e41d90ecfe09 /misc
parentbc650f27b4b700cc0c0702b7e77e23ffdc1015c2 (diff)
* misc/ruby-mode.el (ruby-deep-indent-paren-p, ruby-calculate-indent):
do not apply deep-indent inside parens at the beginning of expressions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'misc')
-rw-r--r--misc/ruby-mode.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index bdd6fc73fe..c86c65c3e7 100644
--- a/misc/ruby-mode.el
+++ b/misc/ruby-mode.el
@@ -496,8 +496,12 @@ The variable ruby-indent-level controls the amount of indentation.
(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 @@ The variable ruby-indent-level controls the amount of indentation.
(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 @@ The variable ruby-indent-level controls the amount of indentation.
(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 @@ The variable ruby-indent-level controls the amount of indentation.
(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))))