* misc/ruby-mode.el (ruby-expr-beg, ruby-in-here-doc-p): tell
singleton class definitions from here documents. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
360e0b93fd
commit
5f3e191f95
@ -1,4 +1,7 @@
|
|||||||
Tue Feb 8 00:53:14 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Feb 8 00:56:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* misc/ruby-mode.el (ruby-expr-beg, ruby-in-here-doc-p): tell
|
||||||
|
singleton class definitions from here documents.
|
||||||
|
|
||||||
* misc/ruby-mode.el (ruby-expr-beg, ruby-parse-partial): keyword
|
* misc/ruby-mode.el (ruby-expr-beg, ruby-parse-partial): keyword
|
||||||
followed by colon is label.
|
followed by colon is label.
|
||||||
|
@ -438,6 +438,12 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||||||
((and (eq c ?:) (or (not b) (eq (char-syntax b) ? ))))
|
((and (eq c ?:) (or (not b) (eq (char-syntax b) ? ))))
|
||||||
((eq c ?\\) (eq b ??)))))
|
((eq c ?\\) (eq b ??)))))
|
||||||
|
|
||||||
|
(defun ruby-singleton-class-p ()
|
||||||
|
(save-excursion
|
||||||
|
(forward-word -1)
|
||||||
|
(and (or (bolp) (not (eq (char-before (point)) ?_)))
|
||||||
|
(looking-at "class\\s *<<"))))
|
||||||
|
|
||||||
(defun ruby-expr-beg (&optional option)
|
(defun ruby-expr-beg (&optional option)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(store-match-data nil)
|
(store-match-data nil)
|
||||||
@ -451,7 +457,9 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||||||
(or (eq (char-syntax (char-before (point))) ?w)
|
(or (eq (char-syntax (char-before (point))) ?w)
|
||||||
(ruby-special-char-p))))
|
(ruby-special-char-p))))
|
||||||
nil)
|
nil)
|
||||||
((and (eq option 'heredoc) (< space 0)) t)
|
((and (progn (goto-char start) (eq option 'heredoc))
|
||||||
|
(not (ruby-singleton-class-p)))
|
||||||
|
t)
|
||||||
((or (looking-at ruby-operator-re)
|
((or (looking-at ruby-operator-re)
|
||||||
(looking-at "[\\[({,;]")
|
(looking-at "[\\[({,;]")
|
||||||
(and (looking-at "[!?]")
|
(and (looking-at "[!?]")
|
||||||
@ -1229,7 +1237,8 @@ balanced expression is found."
|
|||||||
(let ((old-point (point)) (case-fold-search nil))
|
(let ((old-point (point)) (case-fold-search nil))
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(catch 'found-beg
|
(catch 'found-beg
|
||||||
(while (re-search-backward ruby-here-doc-beg-re nil t)
|
(while (and (re-search-backward ruby-here-doc-beg-re nil t)
|
||||||
|
(not (ruby-singleton-class-p)))
|
||||||
(if (not (or (ruby-in-ppss-context-p 'anything)
|
(if (not (or (ruby-in-ppss-context-p 'anything)
|
||||||
(ruby-here-doc-find-end old-point)))
|
(ruby-here-doc-find-end old-point)))
|
||||||
(throw 'found-beg t)))))))
|
(throw 'found-beg t)))))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user