けいじゅ@日本ラショナルソフトウェアです.

In [ruby-list :7422 ] the message: "[ruby-list:7422] Re: irb ", on
Apr/10 15:33(JST) senda / ic.rdc.ricoh.co.jp writes:

>keiju> emacs-version ==> 19.34.1

>うちもmuleは19.34.1ですが、
>cc-mode-19.elというところが親切にもEmacs20で追加された関数を定義していてく
>れていたせいでした。

それって, cc-mode.elと違うんですね?

>keiju> use_promptは作ってしまったので, 消すのも何なんですし... inf_ruby_mode 
>keiju> というのを別に作りましょう.
>
>それがいいですね。最初のプロンプトだけにしてreadlineを無効にしていただけれ
>ばいいと思います。

作りました.

インデントをこちらである程度行なうようにしました. 何かlispっぽいですが, 
これ以上はinf-ruby-modeに任せるということで(^^;;;

dim% irb.rb --inf-ruby-mode
irb(main):001:0> 1+2
3
irb(main):002:0> def foo
                   print 1
                   end
nil
irb(main):005:0> "ab
cd"
"ab\ncd"
irb(main):007:0> 1+
                   2
3

irb-0.1.1.6からirb-0.1.1.7へのパッチです.

dim% rcsdiff -r1.6 irb.rb
===================================================================
RCS file: RCS/irb.rb,v
retrieving revision 1.6
diff -r1.6 irb.rb
3c3
< #   irb.rb - 
---
> #   irb.rb - intaractive ruby
5,6c5,6
< #   	$Revision: 1.6 $
< #   	$Date: 1998/04/10 04:12:05 $
---
> #   	$Revision: 1.7 $
> #   	$Date: 1998/04/10 06:52:02 $
25c25
<   @RCS_ID='-$Id: irb.rb,v 1.6 1998/04/10 04:12:05 keiju Exp $-'
---
>   @RCS_ID='-$Id: irb.rb,v 1.7 1998/04/10 06:52:02 keiju Exp keiju $-'
49c49
<   @CONF[:USE_READLINE] = true
---
>   @CONF[:USE_READLINE] = nil
55c55
< 
---
>   
59a60
>   @CONF[:INF_RUBY_MODE] = false
97a99,100
>       when "--readline"
> 	@CONF[:USE_READLINE] = true
101a105,106
>       when "--inf-ruby-mode"
> 	@CONF[:INF_RUBY_MODE] = true
383,397c388,403
< 	  if ltype && @context.prompt_s
< 	    @context.io.prompt = format(@context.prompt_s, 
< 					@context.irb_name,
< 					@context.main,
< 					line_no, indent, ltype)
< 	  elsif continue && @context.prompt_c
< 	    @context.io.prompt = format(@context.prompt_c,
< 					@context.irb_name, 
< 					@context.main,
< 					line_no, indent)
< 	  elsif @context.prompt_i
< 	    @context.io.prompt = format(@context.prompt_i,
< 					@context.irb_name, 
< 					@context.main,
< 					line_no, indent)
---
> 	  if @context.inf_ruby_mode
> 	    if ltype
> 	      @context.io.prompt = ""
> 	    elsif indent > 0 or continue or !@context.prompt_i
> 	      ind = format(@context.prompt_c, 
> 			   @context.irb_name,
> 			   @context.main, 
> 			   line_no, indent).size + indent*2
> 	      ind += 2 if continue
> 	      @context.io.prompt = " "*ind
> 	    else
> 	      @context.io.prompt = format(@context.prompt_i,
> 					  @context.irb_name, 
> 					  @context.main,
> 					  line_no, indent)
> 	    end
399c405,422
< 	    @context.io.prompt = ""
---
> 	    if ltype && @context.prompt_s
> 	      @context.io.prompt = format(@context.prompt_s, 
> 					  @context.irb_name,
> 					  @context.main,
> 					  line_no, indent, ltype)
> 	    elsif continue && @context.prompt_c && !@context.inf_ruby_mode
> 	      @context.io.prompt = format(@context.prompt_c,
> 					  @context.irb_name, 
> 					  @context.main,
> 					  line_no, indent)
> 	    elsif @context.prompt_i
> 	      @context.io.prompt = format(@context.prompt_i,
> 					  @context.irb_name, 
> 					  @context.main,
> 					  line_no, indent)
> 	    else
> 	      @context.io.prompt = ""
> 	    end
520a544
>       @inf_ruby_mode = IRB.conf[:INF_RUBY_MODE]
541c565
<       elsif use_readline?
---
>       elsif use_readline.nil? && !inf_ruby_mode || use_readline? 
574a599
>     attr :inf_ruby_mode, true


__
................................石塚 圭樹@日本ラショナルソフトェア...
----------------------------------->> e-mail: keiju / rational.com <<---