4

I installed jedi along with some other packages via el-get the other day, and initially it all worked great (auto-completion, popup menus etc).

In the past few days, however, jedi has stopped working (i.e. auto-completion, popups and function argument suggestion no longer work).

I've discovered part of the reason for this not working is that, for some reason, auto-complete is not enabled on startup. I've tried adding (setq auto-complete-mode t) to my .emacs file both before and after el-get loads jedi, but despite enabling auto-complete, it still doesn't work for some reason. Instead, I have to enable auto-complete using M-x auto-complete-mode once emacs has loaded (I have also tried the suggestions here Emacs auto-complete-mode at startup, but that just throws a load of errors when emacs loads).

Besides this, when I type M-x jedi RET, some of the commands listed on the jedi troubleshooting page (such as jed:setup-keys) seem to be missing.

I also seem to be experiencing the same problems as this guy here: emacs-jedi does not find numpy completions, but I'm not sure if the two problems are linked.

Community
  • 1
  • 1
orentago
  • 558
  • 1
  • 7
  • 13
  • I was about to suggest `(global-auto-complete-mode t)`, but I see that this is in your linked answer. Can you try that, start emacs with --debug-init, and post the errors you get here? – Rob Mar 27 '13 at 13:25
  • I get this: `Debugger entered--Lisp error: (void-variable z) eval-buffer(# nil "/home/matthew/.emacs" nil t) ; Reading at buffer position 2 load-with-code-conversion("/home/matthew/.emacs" "/home/matthew/.emacs" t t) load("~/.emacs" t t) #[nil "\205\264` – orentago Mar 27 '13 at 18:30
  • Actually ignore that as that error was caused by a typo in my .emacs. This is the actual error: `Debugger entered--Lisp error: (void-function global-auto-complete-mode) (global-auto-complete-mode t) eval-buffer(# nil "/home/matthew/.emacs" nil t) ; Reading at buffer position 527 load-with-code-conversion("/home/matthew/.emacs" "/home/matthew/.emacs" t t) load("~/.emacs" t t) #[nil "\205\264` – orentago Mar 28 '13 at 13:25

2 Answers2

3

I had the same problem with the auto-complete-mode. I had to manually start it.

Being a total newbie I struggled with it for a while but deduced a solution. Maybe it's not very elegant, but it works... Add it as a hook to the python-mode before enabling jedi ac.

;;enable jedi autocompletion in python
(add-hook 'python-mode-hook 'auto-complete-mode)
(add-hook 'python-mode-hook 'jedi:ac-setup)
caisah
  • 1,701
  • 1
  • 19
  • 29
  • Did you try everything in http://tkf.github.io/emacs-jedi/#troubleshooting? You can replace `(add-hook 'python-mode-hook 'auto-complete-mode)` with `(global-auto-complete-mode t)` as the emacs-jedi document suggests. global-auto-complete-mode is better because you don't need to add `auto-complete-mode` for all modes that you want to enable `auto-complete-mode`. That said, there is nothing wrong in your setup other than the redundancy. – tkf Apr 16 '13 at 16:33
  • I tried `(global-auto-complete-mode t)` but unfortunately it doesn't work. I also followed all the steps in the _troubleshooting_ section with no success. For some reason this is the only way it works for me. – caisah Apr 18 '13 at 19:35
  • Does your `ac-modes` have `python-mode` in it? – tkf Apr 19 '13 at 11:23
  • Yes my `ac-mode` has 24 _modes_ including `python-mode`. – caisah Apr 24 '13 at 17:55
2

Check out the troubleshooting section in the documentation first: http://tkf.github.com/emacs-jedi/#troubleshooting

I recommend you to start from make tryout as mentioned in the document, like this:

 curl -fsSkL https://raw.github.com/rejeep/carton/master/go | sh
 make CARTON=$HOME/.carton/bin/carton tryout

From the document:

This will install requirements for Jedi.el separated from your local setup in .emacs.d. You can also check the configuration file tryout-jedi.el which is used by make tryout to see the minimum working configuration. If you have trouble setting up Jedi.el, compare your configuration file and tryout-jedi.el.

tkf
  • 2,880
  • 15
  • 32
  • Ok so I tried that, with the same results as in the link in my OP. I get: `mkdir -p elpa EL4T_EMACS=emacs EMACS=tools/el4t/emacs.sh carton install 2> elpa/install.log Installing modules using carton.lock (deployment mode) make: *** [elpa] Error 2` Autocomplete is still not enabled at startup. I get context help for function arguments that aren't numpy/scipy functions, but otherwise I get nothing. My whole configuration is a nightmare to debug, as the configuration is buried in some files in the el-get directory of my .emacs.d directory, so finding the configuration is a hopeless exercise. – orentago Mar 27 '13 at 21:03
  • Do you use `make tryout` or `make CARTON=... tryout`? I guess `carton` you have is different from the one I am talking about (probably you have the one for Perl). In that case, make sure to specify `CARTON`. BTW, you said you got an error when you put `(global-auto-complete-mode t)` in your config but where did you put it? Make sure to put it after auto-complete is loaded (i.e., after `(el-get 'sync)` or something like that is called). You may need to put `(require 'auto-complete)` before calling `global-auto-complete-mode`. – tkf Mar 27 '13 at 21:26
  • Ok so I have carton installed, and when I run the curl command it tells me that carton is already installed. There's no binary in my .carton directory though, so I use /usr/bin/carton instead: `make CARTON=/usr/bin/carton tryout rm -rf *.elc EL4T_EMACS=emacs EMACS=tools/el4t/emacs.sh /usr/bin/carton exec tools/el4t/emacs.sh -Q -batch \ -L . -f batch-byte-compile *.el Unknown option: q Unknown option: batch Unknown option: l Unknown option: f ...` – orentago Mar 28 '13 at 11:36
  • `... env/bin/pip install --requirement requirements.txt env/bin/pip:5: UserWarning: Module dap was already imported from None, but /usr/lib/python2.7/dist-packages is being added to sys.path from pkg_resources import load_entry_point Requirement already satisfied (use --upgrade to upgrade): jedi>=0.5b4 in ./env/lib/python2.7/site-packages (from -r requirements.txt (line 1)) ... ` – orentago Mar 28 '13 at 11:37
  • `... Requirement already satisfied (use --upgrade to upgrade): epc in ./env/lib/python2.7/site-packages (from -r requirements.txt (line 2)) Requirement already satisfied (use --upgrade to upgrade): argparse in /usr/lib/python2.7 (from -r requirements.txt (line 3)) Requirement already satisfied (use --upgrade to upgrade): sexpdata in ./env/lib/python2.7/site-packages (from epc->-r requirements.txt (line 2)) Cleaning up... EL4T_EMACS=emacs EMACS=tools/el4t/emacs.sh /usr/bin/carton exec tools/el4t/emacs.sh -Q -L . -l tryout-jedi.el Unknown option: q Unknown option: l Unknown option: l` – orentago Mar 28 '13 at 11:37
  • I also tried moving the location of the global-auto-complete-mode command to after el-get sync, but that made no difference (shouldn't the elisp files in the el-get configuration be set to load auto-complete properly anyway? I don't understand why it's not working out the box). – orentago Mar 28 '13 at 11:38
  • Ok so the latest development is that autocompletion works for numpy and scipy commands, so I assume one of the above commands must have done the trick. However, autocomplete remains off by default on init, so I have to do M-x auto-complete-mode once emacs has started. I'll investigate which of the above commands did the trick and post my answer here. – orentago Mar 28 '13 at 13:14
  • In the end it was `VIRTUALENV_SYSTEM_SITE_PACKAGES=true make clean requirements` that did the trick with the numpy and scipy autocompletion. Auto-complete itself though still needs to be started manually each time emacs starts up with `auto-complete-mode`. – orentago Apr 13 '13 at 17:13