reapply our hacks for R completion to new ace source

fixes #352

reapplies the changes in commits 4b0cf87b502cd, 58186b1817, c7d7c295c36