r/emacs•
fredmorcos

Help: "before" and "after" hooks for jedi, auto-complete or popup

Hello,

This isn't a question about python-mode or jedi specifically, but rather more related to either emacs itself, auto-complete or popup.

I am looking for before and after hooks to either jedi's completion, emacs' auto-complete or popup.

The reason is that I am trying to disable global-whitespace-mode and flycheck-mode before a menu shows up, and re-enable them after a menu is closed.

Now the reason for that is shown here. The first two screenshots show jedi + auto-complete while global-whitespace-mode and flycheck are active and the second two screenshots show the same while these modes are inactive. There is also flashing and flickering of flycheck markers in the first two screenshots, which is quite annoying.

Thanks!

EDIT: The solution is to advise the auto-complete functions that activate and deactivate the menu, as follows:

(defadvice ac-activate-completing-map (before disable-ws-and-fc activate)
  "Disable WS and FC before AC completion."
  (progn (global-whitespace-mode -1)
         (flycheck-mode -1)))

(defadvice ac-deactivate-completing-map (after enable-ws-and-fc activate)
  "Enable WS and FC after AC completion."
  (progn (global-whitespace-mode 1)
         (flycheck-mode 1)))

Posted Feb 19, 2016, 10:05 AM UTC · edited

213
Loading comments…