ruby-changes:7681
From: matz <ko1@a...>
Date: Sun, 7 Sep 2008 07:30:51 +0900 (JST)
Subject: [ruby-changes:7681] Ruby:r19202 (trunk): * misc/*.el: merged the following patches from Nathan Weizenbaum
matz 2008-09-07 07:30:34 +0900 (Sun, 07 Sep 2008) New Revision: 19202 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19202 Log: * misc/*.el: merged the following patches from Nathan Weizenbaum <nex342 at gmail.com>. [ruby-core:18424] * misc/ruby-mode.el: improve here-doc performance. Modified files: trunk/ChangeLog trunk/misc/ruby-mode.el trunk/misc/ruby-style.el Index: ChangeLog =================================================================== --- ChangeLog (revision 19201) +++ ChangeLog (revision 19202) @@ -1,3 +1,10 @@ +Sun Sep 7 07:24:09 2008 Yukihiro Matsumoto <matz@r...> + + * misc/*.el: merged the following patches from Nathan Weizenbaum + <nex342 at gmail.com>. [ruby-core:18424] + + * misc/ruby-mode.el: improve here-doc performance. + Sun Sep 7 06:31:51 2008 Yukihiro Matsumoto <matz@r...> * file.c (file_expand_path): applied a patch from Nobuhiro Tachino Index: misc/ruby-mode.el =================================================================== --- misc/ruby-mode.el (revision 19201) +++ misc/ruby-mode.el (revision 19202) @@ -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 @@ (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 Index: misc/ruby-style.el =================================================================== --- misc/ruby-style.el (revision 19201) +++ misc/ruby-style.el (revision 19202) @@ -21,7 +21,7 @@ (save-excursion (back-to-indentation) (unless (progn (backward-up-list) (back-to-indentation) - (> (point) (cdr x))) + (> (point) (cdr x))) (goto-char (cdr x)) (if (looking-at "\\<case\\|default\\>") '*)))) @@ -29,14 +29,14 @@ (save-excursion (back-to-indentation) (unless (progn (backward-up-list) (back-to-indentation) - (>= (point) (cdr x))) + (>= (point) (cdr x))) (goto-char (cdr x)) (condition-case () - (progn - (backward-up-list) - (backward-sexp 2) - (if (looking-at "\\<switch\\>") '/)) - (error))))) + (progn + (backward-up-list) + (backward-sexp 2) + (if (looking-at "\\<switch\\>") '/)) + (error))))) (require 'cc-styles) (c-add-style -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/