-
Notifications
You must be signed in to change notification settings - Fork 657
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
Large amount of *gocode* buffers when company-go--invoke-autocomplete has an error #435
Comments
The question is - why. Script has kill-buffer at the end there. And it worked well for years. What changed? |
In the particular case reported to Spacemacs, the user didn't have a necessary program installed, causing an (expected) error in the call to |
Makes sense. Will try using with-temp-buffer then. |
I think I fixed it, but please take a look at the code. I'm not very good with elisp. Also maybe there is a simpler way to do it? It's just a bit messy. I need to get args from current buffer, stuff like cursor position, then I need to create a temporary buffer and get its name for |
I looked at it, I'm not sure there's a cleaner way to write the code with (unwind-protect
(progn
(apply #'call-process-region
(point-min)
(point-max)
company-go-gocode-command
nil
temp-buffer
nil
gocode-args)
(with-current-buffer temp-buffer (buffer-string)))
(kill-buffer temp-buffer)) What this code does, is that it calls |
Well, ok, let's keep it this way then, feel free to close the issue if with-temp-buffer one works for you. |
I'm closing the issue because I'm fairly certain the issue is solved. I haven't actually test it because I wasan't affected by it. @InvisibleTech @rbrtl @nyxwulf if you can confirm this works it'd be nice (this only fixes the |
In
company-go--invoke-autocomplete
, ifcall-process-region
encounters an error then the temporary*gocode*
buffer isn't killed, resulting in many*gocode*
temporary buffers accumulating in the background. It seems that usingwith-temp-buffer
instead ofgenerate-new-buffer
orcondition-case
instead ofprog2
(and suitable refactoring) should fix this.Original report: syl20bnr/spacemacs#7979
The text was updated successfully, but these errors were encountered: