Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion using company mode does not work well with whitespace mode cleanup enabled. #246

Open
yesudeep opened this issue Sep 23, 2015 · 2 comments

Comments

@yesudeep
Copy link

Namaste,

Here's my configuration for whitespace-mode:

;; Use whitespace mode. Cleans up trailing spaces, shows tabs, unnecessary
;; whitespace, EOF newline, bad indentation, margin bleeds, etc.
(require 'whitespace)
(global-whitespace-mode t)
(setq whitespace-style
      '(face empty indentation lines-tail newline trailing)
      whitespace-action '(auto-cleanup warn-read-only)
      whitespace-line-column 80)

Somewhere in the completion routines, emacs-eclim saves the buffer
to disk, which triggers a call to whitespace-cleanup, so by the time
autocompletion suggestions can be displayed, the pointer moves one
character to the left as a result of the trailing space being removed.

I'm not sure why completion needs saving the buffer. Can this be reworked
in some way so that completion does not require saving the file? I'd most
certainly like to clean up trailing whitespace automatically!

Thank you. :)

Cheers,
Yesudeep.

@yesudeep
Copy link
Author

I've currently worked around this by disabling automatic whitespace sanitization for java-mode
(although this is not a real solution):

(add-hook 'java-mode-hook (lambda ()
                        (setq c-basic-offset 2
                              tab-width 2
                              indent-tabs-mode nil)
                        (eclim-mode t)
                        ;; Whitespace mode does not work well with completion in java mode with eclim.
                        (set (make-local-variable 'whitespace-action) nil)
                        ))

@jchochli
Copy link
Collaborator

AFAIK the buffer has to be saved for eclipse to pick up the changes.

How about trying a before-save-hook and maybe this package https://github.com/purcell/whitespace-cleanup-mode?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants