User:Andrew Nikitin/completename

From J Wiki
Jump to: navigation, search

This tool is for interactive use in J session.

It performs name completions.

NB. y = list of locale names where to look for candidates for completion
completename_jijs_=:3 : 0
if. ''-:y do. y=.<'base' end.
smselact''
pos=. {. smgetsel''
txt=. smread''
NB. smreplace ''
try.
  w=.>{:;: ''''-.~utf8 _80{.pos{.txt
  lw=.w (({.@E. > )"_ 0 # ]) ;(3 : '<nl__y ''''')"> y
  cpl=.(#w)}. ; (({.@] # ({~ {:)) >@wdselect)^:(1<#) lw
catch.
  cpl=.''
end.
smsetselect 1,~2#(pos)
smreplace cpl
smsetselect 1,~2#(pos+#cpl)
)

Edit → Configure → FKeys → Modify → Code:

completename_jijs_ (,copath) coname''

Use quiet

F-key binding is run as immex phrase, which is executed in current locale.