Closed cannyboy closed 11 years ago
Hey there, could you take a look at the following page and beef up your issue appropriately?
http://overtone.github.com/emacs-live/doc-reporting-issues.html
I started compiling some detail about my issue (see below), but I've just noticed that I do get the grey documentation thing on the first screen (the Emacs Live logo), but when I open 'project.clj' or 'core.clj' etc in a lein 2 project, then it goes back to no documentation, just the pink list. So its working for Lisp, but not Clojure..?
The opening screen has this at the bottom: (Lisp Interaction Undo-Tree yas VHl ElDoc AC Paredit SliNav -1-)
while other files have this at the bottom: (Clojure Undo-Tree yas VHl AC Paredit -1-)
I'm using Emacs 24.2.1 (x86_64-apple-darwin12.2.0), installed using homebrew. (i also have homebrew installed versions of leiningen, repl, clojure, git). All are the latest versions. I'm on Mac OS 10.8.2.
I installed Eamcs Live via git, and have just pulled the latest emacs-live from github into ~/.emacs.d
I made sure there was no pre-compiled funny business with:
rm -rf ~/.emacs.d/**/*.elc
I start the emacs daemon using the 'es' alias, and then open a project.clj in a project I've created with 'lein new foo'. Moving to the end of the file I enter something like:
(defm
..and I'll get the list of things which start with defm with a letter on the right
defm a < this one highlighted in pink
defmm a
defmacro d
defmulti d
defmethod d
I can cursor up/down, select with return, or tab to complete. However, I can't see any documentation.
The suggested 'emacs --live-safe-mode' does not work, maybe because I've put the emacs='/usr/local/bin/emacsclient -ct' alias in.
I try '/usr/local/bin/emacs --live-safe-mode' and it runs, with the same issue as above.
Hi, thanks for the information - this is very useful indeed.
Two questions:
*scratch*
buffer and type ma
does it autocomplete to max
, map
, man
etc and does elisp documentation pop up?Yes, it auto-completes to map, max, man, mark, mapl etc. With documentation. I'm guessing this is elisp documentation? When i go into a Clojure file, the documentation is not there, but the list of words is.
lein --version
Leiningen 2.0.0 on Java 1.6.0_37 Java HotSpot(TM) 64-Bit Server VM
This issue happens across the three machines where I've installed Emacs Live.
I think the only thing I did differently in the install process is for obtaining leiningen: http://overtone.github.com/emacs-live/doc-clojure-connection.html
I used homebrew ('brew install leiningen'), since the default is now version 2.0.
I tried uninstalling emacs and leiningen via homebrew and starting again, with same issue.
[~]> brew list
git node p7zip rbenv rlwrap ruby-build
[~]> brew install leiningen emacs
[~]> sudo rm -R ~/.emacs.d
[~]> git clone git://github.com/overtone/emacs-live.git ~/.emacs.d
[~]> echo $PATH
/Users/cannyboy/.rbenv/shims:/usr/local/bin:/usr/bin:/usr/local/sbin:~/bin:/usr/local/opt/ruby/bin:/usr/local/share/npm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
[~]> emstart
(starts emacs daemon)
[~]> lein new emacstest
[~]> cd emacstest
[emacstest]> emacs project.clj
(opens, but with same no documentation issue)
any joy with this issue?
To be honest, I have absolutely no idea why it's not working for you. It's clearly not an autocomplete issue, but an issue with nrepl-autocomplete
. Typically issues like this arise when someone is using an older version of Leiningen which might ship with an older nREPL. However, in your situation this appears not to be the case.
What does running M-x live-version
report?
M-x live-version
gives me This is Emacs Live 1.0beta20
I re-cloned the Emacs Live repo
git clone git://github.com/overtone/emacs-live.git ~/.emacs.d
(this still gives me This is Emacs Live 1.0beta20
)
Tried the autocomplete again, and same issue.
I get a few warnings when starting the emacs daemon:
Warning: ad-Orig-kill-region called with 3 arguments, but accepts only 2
Warning: reference to free variable `multiple-cursors-mode'
Warning: reference to free variable `mc--read-char'
Warning: assignment to free variable `mc--read-char'
Warning: reference to free variable `multiple-cursors-mode'
Warning: reference to free variable `mc--read-quoted-char'
Warning: assignment to free variable `mc--read-quoted-char'
Warning: reference to free variable `rectangular-region-mode'
Warning: reference to free variable `rectangular-region-mode'
Doubt if they are significant.
Just in case I'm doing something obviously wrong, here's how I usually get things started with Emacs Live and Clojure:
/usr/local/bin/emacs --daemon
lein new foo
created project: emacs core.clj
C-x 2
M-x nrepl-jack-in
C-x C-e
I'll try a mac at work which hasn't got homebrew tomorrow to see if I can replicate the problem.
Another thing to try is to not use nrepl-jack-in
but to start a lein process manually via lein repl
and then connect to it manually from Emacs with M-x nrepl
and supplying the hostname and port (the port should be printed as part of the reply start up gumpf).
Just tried that. Same issue. Both in the repl and in a .clj file.
I uninstalled the home-brew version of clojure in case it was conflicting somehow, to no effect.
Are you able to evaluate forms via nrepl.el
. For example with an nREPL connection, can you do:
(+ 1 2)|
(where |
denotes the cursor) and type the key combo C-x C-e
and see 3
appear in the minibuffer?
yes, thats works fine, as long as i have evaluated (ns foo.core)
at the top of the file.
lein repl
emacs core.clj
(ns foo.core) - C-x C-e at end of line - produces nil in minibuffer
(+ 1 2) - C-x C-e at end of line - produces 3 in minibuffer
I'm about to install on a diff mac. I'll try the brogrammer script instead of git cloning, to see if it makes a difference.
OK, so that demonstrates that at least the standard nrepl.el
stuff is working. I really wonder what's going on here...
On another mac, which I've not touched before. OS X 10.8.2. Xcode 4.5 with command line tools. Freshly installed homebrew.
As you can see from below, I tried the brogrammer script, but it tripped up with two of the mv
commands in the script. So I used the git cloning method instead. The $PATH on this mac is /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin
Unfortunately, the same thing happened with the pop-up documentation.
Has something changed with lein, now that 2.0 is official?
> brew doctor
Your system is raring to brew.
> brew install emacs
Downloading http://ftpmirror.gnu.org/emacs/emacs-24.2.tar.bz2
... blah blah
/usr/local/Cellar/emacs/24.2: 3784 files, 98M, built in 99 seconds
> brew install leiningen
Downloading http://github.com/technomancy/leiningen/tarball/2.0.0
... blah blah
/usr/local/Cellar/leiningen/2.0.0: 5 files, 80K, built in 18 seconds
> bash <(curl -fksSL https://raw.github.com/overtone/emacs-live/master/installer/install-emacs-live.sh)
.... messages
Are you sure you would like to continue? (y/N) y
... messages, including
mv: rename /Users/steve/.emacs-live-installer-tmp/overtone-emacs-live/. to /Users/steve/.emacs.d/.: Invalid argument
mv: rename /Users/steve/.emacs-live-installer-tmp/overtone-emacs-live/.. to /Users/steve/.emacs.d/..: Invalid argument
Would you like to create a personal pack? (Y/n) y
... messages
M-x start-hacking
> lein repl
nREPL server started on port 49709
(open new terminal)
> /usr/local/bin/emacs --daemon
... messages, including these warnings
Warning: ad-Orig-kill-region called with 3 arguments, but accepts only 2
Warning: reference to free variable `multiple-cursors-mode'
Warning: reference to free variable `mc--read-char'
Warning: assignment to free variable `mc--read-char'
Warning: reference to free variable `multiple-cursors-mode'
Warning: reference to free variable `mc--read-quoted-char'
Warning: assignment to free variable `mc--read-quoted-char'
Warning: reference to free variable `rectangular-region-mode'
Warning: reference to free variable `rectangular-region-mode'
...
Starting Emacs daemon.
> lein new foo
> cd foo/src/foo
> emacs core.clj
OPENS EMACS WITHOUT EMACS LIVE
> cd ~
> sudo rm -R .live-packs
> sudo rm -R .emacs.d
> sudo rm -R .emacs-live.el
> git clone git://github.com/overtone/emacs-live.git ~/.emacs.d
(quit and restart repl)
> emacs core.clj
M-x repl
(same issue!)
I'm also not getting Clojure documentation next to my auto-completion on Ubuntu 12.04. My situation seems to be identical to @cannyboy, in that:
This was true for me with the pre-release versions of lein 2 as well as with the final release.
I'm pretty new to emacs, but if there is anything I can do to help track this down, let me know.
I've done a bit of investigation in to this. A clean emacs live has this problem for me, but if I replace the nrepl & ac-nrepl packages with clean ones from elpa/marmalade then it starts working. (Notably you do have to have evaluated the ns sexp to get it to work). When I have time I will dig a little deeper to see what the differences are between nrepl / ac-nrepl in emacs live and the one that works for me.
@samaaron do you know of any reason why I'm seeing this discrepancy? Also, do let me know if there is anything I can do to help track down this issue.
A bit more digging and it'd appear that the issue is in ac-nrepl not nrepl. In particular it looks like version 0.17 works fine, but the DEV version doesn't. Diffing those two it appears that there was a change to a fn called ac-nrepl-documentation (in ac-nrepl.el) which sounds rather suspicious!
Hope this is useful.
Interesting...
what's the diff?
diff --git a/packs/live/clojure-pack/lib/ac-nrepl/README.md b/packs/live/clojure-pack/lib/ac-nrepl/README.md
deleted file mode 100644
- - - 8< - - -
diff --git a/packs/live/clojure-pack/lib/ac-nrepl/ac-nrepl.el b/packs/live/clojure-pack/lib/ac-nrepl/ac-nrepl.el
index ce11fc7..4cbde31 100644
--- a/packs/live/clojure-pack/lib/ac-nrepl/ac-nrepl.el
+++ b/packs/live/clojure-pack/lib/ac-nrepl/ac-nrepl.el
@@ -1,3 +1,4 @@
+
;;; ac-nrepl.el --- auto-complete sources for Clojure using nrepl completions
;; Copyright (C) 2012 Steve Purcell <steve@sanityinc.com>
@@ -6,7 +7,7 @@
;; Sam Aaron <samaaron@gmail.com>
;; URL: https://github.com/purcell/ac-nrepl
;; Keywords: languages, clojure, nrepl
-;; Version: DEV
+;; Version: 0.17
;; Package-Requires: ((nrepl "0.1") (auto-complete "1.4"))
;; This program is free software; you can redistribute it and/or
@@ -140,7 +141,7 @@ Result is a plist, as returned from `nrepl-send-string-sync'."
(message ""))
;;;###autoload
-(add-hook 'nrepl-connected-hook 'ac-nrepl-refresh-class-cache)
+(add-hook 'nrepl-connected-hook 'ac-nrepl-refresh-class-cache t)
(defun ac-nrepl-candidates-all-classes ()
"Return java method candidates."
@@ -170,24 +171,20 @@ Result is a plist, as returned from `nrepl-send-string-sync'."
(catch java.lang.ClassNotFoundException e nil))]
(complete.core/static-members class)))))) ")))
-(defun ac-nrepl-trim (s)
- "Trim leading and trailing whitespace from string S."
- (if (string-match "\\`[ \t\r\n]*\\(.*)[ \t\r\n]*\\'" s)
- (match-string 1)
- s))
-
(defun ac-nrepl-documentation (symbol)
"Return documentation for the given SYMBOL, if available."
- (substring-no-properties
- (ac-nrepl-trim
- (replace-regexp-in-string
- "\r" ""
- (replace-regexp-in-string
- "^\\( \\|-------------------------\r?\n\\)" ""
- (plist-get (ac-nrepl-sync-eval
- (format "(try (eval '(clojure.repl/doc %s))
+ (let ((doc
+ (substring-no-properties
+ (replace-regexp-in-string
+ "\r" ""
+ (replace-regexp-in-string
+ "^\\( \\|-------------------------\r?\n\\)" ""
+ (plist-get (ac-nrepl-sync-eval
+ (format "(try (eval '(clojure.repl/doc %s))
(catch Exception e (println \"\")))" symbol))
- :stdout))))))
+ :stdout))))))
+ (unless (string-match "\\`[ \t\n]*\\'" doc)
+ doc)))
(defun ac-nrepl-symbol-start-pos ()
"Find the starting position of the symbol at point, unless inside a string."
The latest dependency update appears to have resolved the issue for me, so i'm guessing @thisismatt was barking up the right tree.
Awesome - this is good news. Can we close this issue now then?
Works for me too now. Thanks guys.
OK, closing. Feel free to open up if the problem persists for you.
I'm trying to get Emacs Live up and running, and most things are going well. I'll be using it to learn Clojure.
One thing that I can't get to work is the documentation part of the autocompletion. I can see the list of possible words, but I can't figure out how to get the documentation showing. I get the pink list, but not the grey box in this screenshot.
Someone here has the same problem: http://stackoverflow.com/questions/13137883/how-to-use-emacs-auto-complete-snippets