summaryrefslogtreecommitdiff
path: root/misc/ruby-mode.el
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-06 22:30:34 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-06 22:30:34 +0000
commit2d1c5d2c248938d0a957c2c811fcb40b7cf81e0b (patch)
tree697d7bd0071857fd1b9218855f9d4debe923ab89 /misc/ruby-mode.el
parent0771b987a46a7533a0af1e4e936a4339944511c1 (diff)
* misc/*.el: merged the following patches from Nathan Weizenbaum
<nex342 at gmail.com>. [ruby-core:18424] * misc/ruby-mode.el: improve here-doc performance. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'misc/ruby-mode.el')
-rw-r--r--misc/ruby-mode.el26
1 files changed, 13 insertions, 13 deletions
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index 1eeaa6575f..a2755f44e0 100644
--- a/misc/ruby-mode.el
+++ b/misc/ruby-mode.el
@@ -68,8 +68,8 @@
(let ((match (match-string 1)))
(if (and match (> (length match) 0))
(concat "\\(?:-\\([\"']?\\)\\|\\([\"']\\)" (match-string 1) "\\)"
- contents "\\(\\1\\|\\2\\)")
- (concat "-?\\([\"']\\|\\)" contents "\\1"))))))
+ contents "\\b\\(\\1\\|\\2\\)")
+ (concat "-?\\([\"']\\|\\)" contents "\\b\\1"))))))
(defconst ruby-delimiter
(concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\<\\("
@@ -1179,17 +1179,17 @@ buffer position `limit' or the end of the buffer."
(string-to-syntax "|"))))
(defun ruby-here-doc-end-syntax ()
- (save-excursion
- (goto-char (match-end 0))
- (let ((old-point (point))
- (beg-exists (re-search-backward (ruby-here-doc-beg-match) nil t))
- (eol (save-excursion (end-of-line) (point))))
- (if (and beg-exists ; If there is a heredoc that matches this line...
- (null (syntax-ppss-context (syntax-ppss))) ; And that's not inside a heredoc/string/comment...
- (progn (goto-char (match-end 0)) ; And it's the last heredoc on its line...
- (not (re-search-forward ruby-here-doc-beg-re eol t)))
- (eq old-point (ruby-here-doc-find-end old-point))) ; And it ends at this point...
- (string-to-syntax "|")))))
+ (let ((pss (syntax-ppss)))
+ (when (eq (syntax-ppss-context pss) 'string)
+ (save-excursion
+ (goto-char (nth 8 pss))
+ (let ((eol (point)))
+ (beginning-of-line)
+ (if (and (re-search-forward (ruby-here-doc-beg-match) eol t) ; If there is a heredoc that matches this line...
+ (null (syntax-ppss-context (syntax-ppss))) ; And that's not inside a heredoc/string/comment...
+ (progn (goto-char (match-end 0)) ; And it's the last heredoc on its line...
+ (not (re-search-forward ruby-here-doc-beg-re eol t))))
+ (string-to-syntax "|")))))))
(if (featurep 'xemacs)
(put 'ruby-mode 'font-lock-defaults