summaryrefslogtreecommitdiff
path: root/lisp/progmodes/ruby-mode.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2012-11-14 10:34:17 +0400
committerDmitry Gutov <dgutov@yandex.ru>2012-11-14 10:34:17 +0400
commit8619323f695c733f67dad59987ca5adc3cc0a6e8 (patch)
tree1d737c4eb2ae9b4073426fec3f5cfd7202c53b7b /lisp/progmodes/ruby-mode.el
parentf360feb8ec972600bb206447be8ac31cf61b0523 (diff)
downloademacs-8619323f695c733f67dad59987ca5adc3cc0a6e8.tar.gz
emacs-8619323f695c733f67dad59987ca5adc3cc0a6e8.tar.bz2
emacs-8619323f695c733f67dad59987ca5adc3cc0a6e8.zip
* lisp/progmodes/ruby-mode.el (ruby-expr-beg): Make heredoc detection
more strict. Add docstring. * test/automated/ruby-mode-tests.el (ruby-indent-singleton-class): Pass. (ruby-indent-inside-heredoc-after-operator) (ruby-indent-inside-heredoc-after-space): New tests.
Diffstat (limited to 'lisp/progmodes/ruby-mode.el')
-rw-r--r--lisp/progmodes/ruby-mode.el12
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 0bc41033367..686bec89a95 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -384,7 +384,9 @@ and `\\' when preceded by `?'."
(looking-at "class\\s *<<"))))
(defun ruby-expr-beg (&optional option)
- "TODO: document."
+ "Check if point is possibly at the beginning of an expression.
+OPTION specifies the type of the expression.
+Can be one of `heredoc', `modifier', `expr-qstr', `expr-re'."
(save-excursion
(store-match-data nil)
(let ((space (skip-chars-backward " \t"))
@@ -397,10 +399,10 @@ and `\\' when preceded by `?'."
(or (eq (char-syntax (char-before (point))) ?w)
(ruby-special-char-p))))
nil)
- ((and (eq option 'heredoc) (< space 0))
- (not (progn (goto-char start) (ruby-singleton-class-p))))
- ((or (looking-at ruby-operator-re)
- (looking-at "[\\[({,;]")
+ ((looking-at ruby-operator-re))
+ ((eq option 'heredoc)
+ (and (< space 0) (not (ruby-singleton-class-p start))))
+ ((or (looking-at "[\\[({,;]")
(and (looking-at "[!?]")
(or (not (eq option 'modifier))
(bolp)