[#24536] 「Rubyの落し方」 v.s. ruby_1_8 — akira yamada / やまだあきら <akira@...>

<URL:http://jp.rubyist.net/magazine/?0002-RubyCore>

40 messages 2004/10/20
[#24541] Re: 「Rubyの落し方」 v.s. ruby_1_8 — Yukihiro Matsumoto <matz@...> 2004/10/20

まつもと ゆきひろです

[#24599] 1.8.2 preview3? — akira yamada / やまだあきら <akira@...> 2004/10/26

2004-10-20 (水) の 21:38 +0900 に Yukihiro Matsumoto さんは書きました:

[#24605] Re: 1.8.2 preview3? — akira yamada / やまだあきら <akira@...> 2004/10/27

2004-10-26 (火) の 16:16 +0900 に akira yamada / やまだあきら さんは書きました:

[#24606] Re: 1.8.2 preview3? — Yukihiro Matsumoto <matz@...> 2004/10/27

まつもと ゆきひろです

[#24608] Re: 1.8.2 preview3? — akira yamada / やまだあきら <akira@...> 2004/10/27

2004-10-27 (水) の 11:48 +0900 に Yukihiro Matsumoto さんは書きました:

[#24620] Re: 1.8.2 preview3? — akira yamada / やまだあきら <akira@...> 2004/10/27

2004-10-27 (水) の 12:42 +0900 に akira yamada / やまだあきら さんは書きました:

[#24629] Re: 1.8.2 preview3? — Tanaka Akira <akr@...17n.org> 2004/10/29

In article <1098888819.9446.14.camel@rice.p.arika.org>,

[ruby-dev:24634] ruby-mode doesn't recognize close-paren after heredoc-identifier

From: Daiki Ueno <ueno@...>
Date: 2004-10-29 07:22:57 UTC
List: ruby-dev #24634
上野と申します。

ruby-mode 使用時に、次のようなコードの直後でインデントが狂うのが気になっ
ています。

  puts(<<-End)
  ...
  End
# <- ここで TAB

手元では以下のパッチでしのいでいますが、よろしければ取り込んでいただけな
いでしょうか。

Index: ruby-mode.el
===================================================================
RCS file: /src/ruby/misc/ruby-mode.el,v
retrieving revision 1.83
diff -u -F^( -r1.83 ruby-mode.el
--- ruby-mode.el	17 Aug 2004 09:02:39 -0000	1.83
+++ ruby-mode.el	29 Oct 2004 07:21:31 -0000
@@ -521,10 +521,24 @@ (defun ruby-parse-partial (&optional end
 	       (looking-at "<<\\(-\\)?\\(\\([\"'`]\\)\\([^\n]+?\\)\\3\\|\\sw+\\)"))
 	  (setq re (regexp-quote (or (match-string 4) (match-string 2))))
 	  (if (match-beginning 1) (setq re (concat "\\s *" re)))
-	  (if (re-search-forward (concat "^" re "$") end 'move)
-	      (forward-line 1)
-	    (setq in-string (match-end 0))
-	    (goto-char end)))
+	  (let* ((id-end (goto-char (match-end 0)))
+		 (line-end-position (save-excursion (end-of-line) (point)))
+		 state)
+	    ;; parse the rest of the line
+	    (while (and (> line-end-position (point))
+			(setq state (ruby-parse-partial
+				     line-end-position
+				     in-string nest depth pcol indent))))
+	    (setq in-string (car state)
+		  nest (nth 1 state)
+		  depth (nth 2 state)
+		  pcol (nth 3 state)
+		  indent (nth 4 state))
+	    ;; skip heredoc section
+	    (if (re-search-forward (concat "^" re "$") end 'move)
+		(forward-line 1)
+	      (setq in-string id-end)
+	      (goto-char end))))
 	 (t
 	  (goto-char pnt))))
        ((looking-at "^__END__$")

-- 
Daiki Ueno

In This Thread

Prev Next