[#43412] [Ruby 1.9 - Feature #4592][Open] Tempfileを直接保存したい — Takeyuki Fujioka <xibbar@...>

15 messages 2011/04/21

[#43453] ThreadGroup の強化案 — Hidetoshi NAGAI <nagai@...>

永井@知能.九工大です.

14 messages 2011/04/28
[#43901] ThreadGroup#make_local_space! (Re: ThreadGroup の強化案) — Hidetoshi NAGAI <nagai@...> 2011/06/25

永井@知能.九工大です.少々長いメールで失礼します.

[#43920] Re: ThreadGroup#make_local_space! (Re: ThreadGroup の強化案) — Urabe Shyouhei <shyouhei@...> 2011/06/26

ひっじょうに根本的な質問をするのですけれども、ThreadGroupって何に使うん

[#43978] Re: ThreadGroup#make_local_space! — Hidetoshi NAGAI <nagai@...> 2011/06/28

永井@知能.九工大です.

[ruby-dev:43376] [Ruby 1.9 - Bug #4546] ruby-indent-beg-re の値が壊れている

From: Kenta Murata <muraken@...>
Date: 2011-04-01 01:08:13 UTC
List: ruby-dev #43376
Issue #4546 has been updated by Kenta Murata.


新しい Redmine に慣れてなくて、patch が崩れてしまいました。
以下に再掲します。
 
 diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
 index c799d8c..9023b77 100644
 --- a/misc/ruby-mode.el
 +++ b/misc/ruby-mode.el
 @@ -72,7 +72,7 @@
 "Regexp to match")
 
 (defconst ruby-indent-beg-re
 -  (concat "\\(\\s *" (regexp-opt '("class" "module" "def") t) "\\)"
 +  (concat "\\(\\s *" (regexp-opt '("class" "module" "def") t) "\\)\\|"
 (regexp-opt '("if" "unless" "case" "while" "until" "for" "begin")))
 "Regexp to match where the indentation gets deeper.")
 
 
----------------------------------------
Bug #4546: ruby-indent-beg-re の値が壊れている
http://redmine.ruby-lang.org/issues/4546

Author: Kenta Murata
Status: Open
Priority: Normal
Assignee: 
Category: lib
Target version: 1.9.x
ruby -v: trunk


vim-ruby の indent/ruby.vim を修正しようと思い ruby-mode.el を読んでいたところ
ruby-indent-beg-re の値が壊れているような気がしたので報告します。

r19205 で regexp-opt を使って正規表現を最適化するよう改善されていますが、
そのときに \\| が抜けてしまっています。

r19204 の 場合:
"\\(\\s *\\(class\\|module\\|def\\)\\)\\|if\\|unless\\|case\\|while\\|until\\|for\\|begin"

r19205 の場合:
"\\(\\s *\\(class\\|def\\|module\\)\\)\\(?:begin\\|case\\|for\\|if\\|un\\(?:less\\|til\\)\\|while\\)"

このように class, def, module を囲む括弧の直後にあった \\| が落ちています。

それでも、なぜか適切にインデントできていて不思議だったので少しだけ調査してみました。
r19205 以降では、ruby-beginning-of-indent が classif や defbegin のような不適切な語をインデントの開始として
判断してしまいますが、このような語が存在しない場合はバッファの先頭まで戻っていました。
ですから、以下のパッチを当ててこの間違いを修正すると、長いファイルのインデント計算が
若干高速化されるかもしれません。

diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index c799d8c..9023b77 100644
--- a/misc/ruby-mode.el
+++ b/misc/ruby-mode.el
@@ -72,7 +72,7 @@
   "Regexp to match")
 
 (defconst ruby-indent-beg-re
-  (concat "\\(\\s *" (regexp-opt '("class" "module" "def") t) "\\)"
+  (concat "\\(\\s *" (regexp-opt '("class" "module" "def") t) "\\)\\|"
           (regexp-opt '("if" "unless" "case" "while" "until" "for" "begin")))
   "Regexp to match where the indentation gets deeper.")
 


-- 
http://redmine.ruby-lang.org

In This Thread