[FEATURE:trunk] Readline.completion_proc = nil を許可する。


#1

e$B9bHx9(<#$G$9!#e(B

Readline.readlinee$B$NJd408uJd$r<hF@$9$ke(B Proc e$B$re(B
Readline.completion_proc= e$B$G;XDj$G$-$^$9!#e(B
e$B$7$+$7!Jd408uJd$r<hF@$9$k=hM}$r%G%U%)%k%H$N$b$N$KLa$9J}K!$,$$j$^$;$s!#e(B
Readline.completion_proc e$B$Ke(B nil
e$B$r%;%C%H$G$-$l$P%G%U%)%k%H$N5sF0$K$J$k$N$G!"e(B
e$B$=$l$r5v2D$7$h$&$H;W$$$^$9!#0J2<$N$h$&$J5-=R$,$G$-$k$h$&$K$J$j$^$9!#e(B

begin
Readline.completion_proc = Proc.new { |s|

}
s = Readline.readline
ensure
Readline.completion_proc = nil
end

e$B8=:_$O!"e(BReadline.completion_proc= e$B%a%=%C%I$NCf$G!"e(B
e$B0z$-?t$G;XDj$5$l$?%*%V%8%%/%H$,e(B call
e$B%a%=%C%I$r$b$C$F$$$k$+$I$&$+%A%%C%/$7$F$$$k$N$G!"e(B

Readline.completion_proc = nil

e$B$Ge(B ArgumentError e$BNc30$,H/@8$7$^$9!#e(B
nile$B$N>l9g$OFCJL07$$$7$F!"e(Bcompletion_proc
e$B$KBeF~$G$-$k$h$&$K$7$h$&$H;W$$$^$9!#e(B
e$B$$$+$,$G$7$g$&$+!#e(B

Index: readline.c

readline.c (revision 21997)
+++ readline.c (working copy)
@@ -304,6 +304,8 @@

  • should take input-string, and return an array of completion
  • candidates.
    • Set default if +proc+ is nil.
    • Raises ArgumentError exception if +proc+ does not respond to call
      method.
    • Raises SecurityError exception if $SAFE is 4.
      @@ -312,7 +314,7 @@
      readline_s_set_completion_proc(VALUE self, VALUE proc)
      {
      rb_secure(4);
  • if (!rb_respond_to(proc, rb_intern(call)))
  • if (!NIL_P(proc) && !rb_respond_to(proc, rb_intern(call)))
    rb_raise(rb_eArgError, argument must respond to `call);
    return rb_ivar_set(mReadline, completion_proc, proc);
    }

#2

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message Re: [ruby-dev:37880] [FEATURE:trunk]
Readline.completion_proc = nil e$B$r5v2D$9$k!#e(B
on Tue, 3 Feb 2009 14:57:10 +0900, Takao K. removed_email_address@domain.invalid
writes:

|Readline.readlinee$B$NJd408uJd$r<hF@$9$ke(B Proc e$B$re(B Readline.completion_proc= e$B$G;XDj$G$-$^$9!#e(B
|e$B$7$+$7!Jd408uJd$r<hF@$9$k=hM}$r%G%U%)%k%H$N$b$N$KLa$9J}K!$,$$j$^$;$s!#e(B
|Readline.completion_proc e$B$Ke(B nil e$B$r%;%C%H$G$-$l$P%G%U%)%k%H$N5sF0$K$J$k$N$G!"e(B
|e$B$=$l$r5v2D$7$h$&$H;W$$$^$9!#0J2<$N$h$&$J5-=R$,$G$-$k$h$&$K$J$j$^$9!#e(B

|e$B$$$+$,$G$7$g$&$+!#e(B

e$B$$$$$s$8$c$J$$$G$7$g$&$+!#e(B


#3

e$B%A%1%C%He(B #1095 e$B$,99?7$5$l$^$7$?!#e(B (by Kouji T.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r22012.

http://redmine.ruby-lang.org/issues/show/1095