I've got auto-complete package working for functions for *.R files, but now I'm struggling with auto-complete for file paths.
I've bound the "TAB" key to:
(global-set-key (kbd "TAB") 'ac-complete-filename)
And it does work after "/" symbol as suggested here. However it works only on new line. As in:
/
And it does not work from within a function such as:
read.table("/...")
Placing pointer after "/" when anything precedes it does not do anything. Any suggestions?
Update:
Changing binding to ess-mode instead of global fixed it. Why? No idea...
(define-key ess-mode-map (kbd "TAB") 'ac-complete-filename)
iESS [R]
, file completion works using the standard emacs file completion, butauto-complete
also works for functions (this works with or without(define-key ess-mode-map (kbd "TAB") 'ac-complete-filename)
. This seems to be the best of both worlds. It would be great if someone with a deeper knowledge of ESS could shed some light on how to get this formulation to work for*.R
files as well.r-mode
comes with file-name completion built-in. You shouldn't have to bindac-complete-filename
to anything, as by default ess modifiescompletion-at-point-functions
to work as you want without further configuration. That is, tab completes R objects in code, and completes filenames inside strings, which is what you'd normally want.