From de7161526014b781468cea5d84411e23be945f79 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 5 Jan 2000 04:41:21 +0000 Subject: 20000105 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- misc/ruby-mode.el | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'misc/ruby-mode.el') diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el index 098ddd5e04..1b7effc459 100644 --- a/misc/ruby-mode.el +++ b/misc/ruby-mode.el @@ -189,7 +189,7 @@ The variable ruby-indent-level controls the amount of indentation. (indent-to x) (move-to-column (+ x shift)))))) -(defun ruby-expr-beg (&optional modifier) +(defun ruby-expr-beg (&optional option) (save-excursion (if (looking-at "\\?") (progn @@ -201,15 +201,11 @@ The variable ruby-indent-level controls the amount of indentation. (or (bolp) (looking-at ruby-operator-re) (looking-at "[\\[({]") - (and (not modifier) (looking-at "[!?]")) + (and (not (eq option 'modifier)) + (looking-at "[!?]")) (and (looking-at ruby-symbol-re) - (save-restriction - (let ((p (point))) - (beginning-of-line) - (narrow-to-region (point) p) - (goto-char p) - (forward-word -1))) - (if (and (not modifier) (bolp)) + (skip-chars-backward ruby-symbol-chars) + (if (and (not (eq option 'modifier)) (bolp)) t (if (or (looking-at ruby-block-beg-re) (looking-at ruby-block-op-re) @@ -217,7 +213,8 @@ The variable ruby-indent-level controls the amount of indentation. (progn (goto-char (match-end 0)) (looking-at "\\>")) - (looking-at "[a-zA-Z][a-zA-z0-9_]* +/[^ \t]")))))))) + (and (not (eq option 'expr-arg)) + (looking-at "[a-zA-Z][a-zA-z0-9_]* +/[^ \t]"))))))))) (defun ruby-parse-region (start end) (let ((indent-point end) @@ -252,7 +249,7 @@ The variable ruby-indent-level controls the amount of indentation. (goto-char indent-point)))) ((looking-at "/") (cond - ((and (not (eobp)) (ruby-expr-beg)) + ((and (not (eobp)) (ruby-expr-beg 'expr-arg)) (if (re-search-forward "[^\\]/" indent-point t) nil (setq in-string (point)) @@ -261,7 +258,7 @@ The variable ruby-indent-level controls the amount of indentation. (goto-char pnt)))) ((looking-at "%") (cond - ((and (not (eobp)) (ruby-expr-beg) + ((and (not (eobp)) (ruby-expr-beg 'expr-arg) (not (looking-at "%=")) (looking-at "%[Qqrxw]?\\(.\\)")) (setq w (buffer-substring (match-beginning 1) @@ -352,7 +349,7 @@ The variable ruby-indent-level controls the amount of indentation. (progn (goto-char (match-beginning 0)) (if (looking-at ruby-modifier-re) - (ruby-expr-beg t) + (ruby-expr-beg 'modifier) t)) t) (goto-char pnt) -- cgit v1.2.3