Comments (26)
In case it helps, on my Windows machine I sometimes get no docstring, or I get a partial one like this:
https://dl.dropbox.com/u/29044/nrepl_weirdness_1.PNG
Hope that helps narrow it down. It may be that this partial docstring is the case that crashes emacs on the mac in the report above.
Cheers,
Ian
from ac-nrepl.
I posted some debugging information that is specific to emacs-live but might still be helpful: overtone/emacs-live#19 (comment)
from ac-nrepl.
I can confirm this. Once in a while autocomplete will completely freeze Emacs, requiring force quit.
I am running GNU Emacs 24.1.1 (x86_64-apple-darwin, NS apple-appkit-1038.36).
from ac-nrepl.
Somewhat frustratingly (for you guys more than me!), I cannot currently reproduce this at all with the latest nrepl.el
and ac-nrepl.el
. Neither @samaaron's scenario nor @dchelimsky's (in overtone/emacs-live#19) lead to errors for me; I get reasonable popups and completions. Granted, I'm using nrepl-jack-in
to fire up the nrepl backend, rather than running lein2 repl
in the background.
It is a known issue that completion does not work when the namespace of the current .clj file does not yet exist, but a minibuffer message to that effect is displayed by the nrepl completion function, for which the main ac-nrepl
function is now a thin wrapper.
And when completing a symbol like clojure.set/
, a ClassNotFoundException
may get thrown by the backend; this is due to a problem with the core.complete
lib currently bundled with nrepl.
I guess at this point I'm also wondering what auto-complete config you are all using; Is there an easy way I can fire up emacs-live
and reproduce this?
FWIW, the relevant parts of my config are (more or less) the following:
(require 'auto-complete)
(require 'auto-complete-config)
(global-auto-complete-mode t)
(setq ac-auto-start nil)
(setq ac-dwim nil)
(add-to-list 'ac-modes 'clojure-mode)
(setq tab-always-indent 'complete)
(add-to-list 'completion-styles 'initials t)
;; hook AC into completion-at-point
(defun set-auto-complete-as-completion-at-point-function ()
(setq completion-at-point-functions '(auto-complete)))
(add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
(add-hook 'nrepl-mode-hook 'ac-nrepl-setup)
(add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup)
(eval-after-load "auto-complete"
'(add-to-list 'ac-modes 'nrepl-mode))
(add-hook 'nrepl-mode-hook 'set-auto-complete-as-completion-at-point-function)
(add-hook 'nrepl-interaction-mode-hook 'set-auto-complete-as-completion-at-point-function)
from ac-nrepl.
Hey Steve,
Yep, it should be easy to fire up emacs-live to reproduce this. Just temporarily move aside your current ~/.emacs.d
directory, then run the following brogrammer script:
bash <(curl -fksSL https://raw.github.com/overtone/emacs-live/master/installer/install-emacs-live.sh)
(You can say no when it asks you if you want to install your own user pack)
from ac-nrepl.
Also, the freeze behaviour that this has been reported happens much less frequently than the crashing behaviour for me.
from ac-nrepl.
Ah, see, the completion in Emacs Live is wired up completely differently to mine. There, TAB
calls yas/expand
, which then presumably delegates to AC. So perhaps there's a nasty interaction there.
These days I'm wary of binding TAB to anything other than indent-for-tab-command
, because the new Emacs 24 machinery behind that command is excellent -- first it tries to indent the line using the mode's indentation function, and then if the indentation didn't change, completion is attempted using completion-at-point-functions
.
I used to use smart-tab
to achieve the same effect, but there were no end of niggly problems.The code I posted above shows how to nominate auto-complete
as a completion-at-point function.
I think it's possible to just add a snippets source to AC, then let it be in control, but I'm not 100% sure because it's a long time since I tried yasnippet.
-Steve
from ac-nrepl.
I'm not entirely convinced the issue is related to binding tab as the crash doesn't require hitting tab. It's just triggered.after AC automatically pops up on a timer trigger. However I'll temporarily remove the yas stuff and see if it modifies things.
from ac-nrepl.
Agreed -- yasnippet may be a red herring. And the automatic pop-up behaviour is another difference in our configs: note my (setq ac-auto-start nil)
above.
from ac-nrepl.
To be fair, I couldn't provoke a crash with Emacs Live either, so my observations above may be entirely irrelevant. :-)
from ac-nrepl.
This all seems to be caused by the nrepl-send-request-sync function (line 1169 of my nrepl.el). It works by making an async request to the nrepl server and then looping, waiting until the response is non-nil. Unfortunately the response seems to arrive in chunks, and the default implementation aborts as soon as it sees the first chunk, leaving the plist data structure incomplete. This seems to crash @samaaron's emacs, and cause mine to display incomplete docstrings.
I replaced the function by evaluating the following:
(defun nrepl-send-request-sync (request)
"Send a request to the backend synchronously (discouraged).
The result is a plist with keys :value, :stderr and :stdout."
(with-current-buffer "*nrepl-connection*"
(setq nrepl-sync-response nil)
(nrepl-send-request request (nrepl-sync-request-handler (current-buffer)))
(while (or (null nrepl-sync-response)
(null (plist-get nrepl-sync-response :done)))
(accept-process-output nil 0.005))
nrepl-sync-response))
which forces the loop to wait until the response has fully arrived before returning.
I suppose this is really an nrepl issue rather than ac-nrepl. The documentation for nrepl-send-request-sync does say that its use is discouraged, but in any case I guess it should at least work.
Hope that helps.
Cheers,
Ian
from ac-nrepl.
@iandavies1985 Well, I'm to blame for nrepl-send-request-sync
in the first place, since I contributed it to nrepl
in order for add-ons like ac-nrepl
to work.
Thanks for tracking it down! No wonder it was tricky to reproduce. I'll test this out and get it patched in nrepl
core, then post back here.
from ac-nrepl.
@purcell am I correct that this morning's 0.1.4 release of nrepl.el does not include this patch or similar?
from ac-nrepl.
@purcell actually I can see that it didn't: https://github.com/kingtim/nrepl.el/blob/b75c78fb492858c6e5de112084db37e8acd64dbf/nrepl.el#L1198-1199
Unfortunate timing :(
from ac-nrepl.
Yep, it missed the release.
This isn't a great time in nrepl's evolution to be using the stable packages, IMO. I personally use the Melpa packages.
from ac-nrepl.
I'll go ahead and close this issue now that it's basically fixed in nrepl
master.
from ac-nrepl.
Unfortunately, Emacs still seems to crash for me when attempting to display an auto-completed docstring...
from ac-nrepl.
@samaaron That sucks. I'm at a bit of a loss, since I can't reproduce it locally.
from ac-nrepl.
I'm in the process of recompiling Emacs to see if I just happened to have a dodgy binary...
from ac-nrepl.
Try a vanilla build from emacsformacosx.com.
from ac-nrepl.
I just did, and didn't observe any crashes :-) I'm now recompiling my non-gui Emacs to see if that fixes matters there. All weird though.
from ac-nrepl.
Oooh, the recompile seems to be pretty stable too. Fingers crossed it stays that way!
from ac-nrepl.
That's good news!
from ac-nrepl.
It is! Especially as I'm doing a big talk tomorrow and wouldn't want Emacs to crash on me live in front of an audience...
from ac-nrepl.
Yes, that would be frustrating. You can keep a special working Emacs for those special occasions. :-)
from ac-nrepl.
Hahaha :-) Every occasion should be special then!
from ac-nrepl.
Related Issues (20)
- Long docstrings in ac-nrepl-popup-doc get cut off HOT 3
- nrepl.el needs huge amounts of time to do autocompletion HOT 7
- nrepl.el needs huge amounts of time to do autocompletion HOT 1
- Support company-mode? HOT 44
- Is it possible to use ac-nrepl with ritz? HOT 5
- Intermittent error HOT 16
- ac-source-nrepl-vars conflict with yasnippet? HOT 3
- ac-nrepl displays nothing, java hogs cpu HOT 2
- ac-nrepl-popop-doc causes "Wrong type argument"
- ac-nrepl perceptibly slow. Any way to speed up? HOT 5
- Namespace hint gets expanded into the code HOT 12
- No completion for unsourced namespace HOT 3
- references to nrepl-current-ns break when used with cider HOT 1
- Documentation pop-up only in repl, not in file buffers HOT 12
- ac-nrepl makes auto-complete very slow HOT 1
- Solved: ac-nrepl installed via package.el doesn't work because `cider-0.1' is unavailable HOT 2
- Remove eval'd clojure code in favor of cider's cider-dispatch-complete-symbol HOT 9
- ac-fuzzy-complete not works HOT 5
- .emacs slowdown HOT 5
- No pop up document is showing HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ac-nrepl.