Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs: How can I eliminate whitespace-mode in auto-complete pop-ups?

Here is a screenshot of what is going wrong:

Imgur

As you can see, the whitespace characters are getting in the way of auto-complete's pop-up text and making things look really terrible.

When really, I'd like it to look like this:

Imgur

Is there anyone out there who has been able to use whitespace-mode but eliminate it from popping up in the auto-complete stuff?

like image 708
emish Avatar asked Oct 19 '12 00:10

emish


1 Answers

There is an issue about compatibility between auto-complete and whitespace-mode in the Prelude issue tracker which has the following workaround in its comments (improved a bit from the original):

(defvar my-prev-whitespace-mode nil)
(make-variable-buffer-local 'my-prev-whitespace-mode)

(defadvice popup-draw (before my-turn-off-whitespace activate compile)
  "Turn off whitespace mode before showing autocomplete box"
  (if whitespace-mode
      (progn
        (setq my-prev-whitespace-mode t)
        (prelude-turn-off-whitespace))
    (setq my-prev-whitespace-mode nil)))

(defadvice popup-delete (after my-restore-whitespace activate compile)
  "Restore previous whitespace mode when deleting autocomplete box"
  (if my-prev-whitespace-mode
      (prelude-turn-on-whitespace)))

Essentially this disables whitespace mode for the whole buffer while a popup is shown.

The issue is also reported in the popup.el issue tracker.

like image 112
lunaryorn Avatar answered Sep 20 '22 02:09

lunaryorn