I can't initialize neither swank nor clojure-jack-in - emacs

I've a problem. I've installed clojure, slime, slime-repl and elein using marmalade. Now I open my project and call elein-swank. I get this:
Starting swank..
error in process filter: slime-presentation-init-keymaps: Symbol's function definition is void: slime-define-both-key-bindings
error in process filter: Symbol's function definition is void: slime-define-both-key-bindings
and If I try clojure-jack-in I get
Debugger entered--Lisp error: (error "Could not start swank server: That's not a task. Use \"lein help\" to list all tasks.
signal(error ("Could not start swank server: That's not a task. Use \"lein help\" to list all tasks.\n"))
error("Could not start swank server: %s" "That's not a task. Use \"lein help\" to list all tasks.\n")
clojure-jack-in-sentinel(#<process swank> "exited abnormally with code 1\n")
What can I do?

I'm not sure what elein is, but I think for clojure-jack-in you need to install the swank-clojure plugin:
lein plugin install swank-clojure 1.3.3

update: as of 2013, M-x nrepl-jack-in is preferred
The jack-in method is the preferred one, but you may also try the old favorite: run
$ lein swank
from the project's main dir, and then:
M-X slime-connect
from emacs. You still need swank-clojure:
$ lein plugin install swank-clojure 1.3.3

this happened to me when i cloned someone else's clojure project from an older version. their project.clj had:
:dev-dependencies [[lein-clojars "0.5.0"]
[swank-clojure "1.2.1"]]
which is incorrect, i think, if you're using M-x clojure-jack-in. removing these lines, running lein deps and jacking in worked for me.

If you're using lein 2, then try adding {:user {:plugins [[lein-swank "1.4.4"]] } } to ~/.lein/profiles.clj. see the Plugins section of https://github.com/technomancy/leiningen/wiki/Upgrading and https://github.com/technomancy/swank-clojure

Related

file-error "https://melpa.org/packages/archive-contents" "Bad Request" during emacs 25.2 startup with Prelude initialization

New job, new emacs setup. I've used emacs for years but never did much customization. Running CentOS Linux 7.7 and emacs 25.2. I wanted to try the Prelude "starter kit" so I installed it. On emacs starup the Prelude init.el file (~/.emacs.d/init.el) runs and I see: error: Package ‘ag-’ is unavailable.
When I start emacs with debug enabled I see the following back trace:
Debugger entered--Lisp error: (file-error "https://melpa.org/packages/archive-contents" "Bad Request")
signal(file-error ("https://melpa.org/packages/archive-contents" "Bad Request"))
package--download-one-archive(("melpa" . "https://melpa.org/packages/") "archive-contents" nil)
package--download-and-read-archives(nil)
package-refresh-contents()
prelude-install-packages()
require(prelude-packages)
.
.
I'd appreciate any suggestions on how to resolve this.
I just ran into similar issues on a new Debian install, it looks like there are some setup issues in the default init.el.
Check your init.el against the [https://melpa.org/#/getting-started][1], it currently gives the default melpa link as: "https://melpa.org/packages/" - in my case it was http rather than https.
Then check that M-x package-list-packages works, go through the M-x package-refresh-contents , update cycle. For some reason this took a couple of attempts to work for me.

lein ring server with nrepl doesn't honour cider-nrepl

When I start up my current project with lein ring server and try to connect to it from Emacs via cider, I get the following warning:
; CIDER 0.8.2 (Java 1.7.0_51, Clojure 1.6.0, nREPL 0.2.6)
WARNING: The following required nREPL ops are not supported:
apropos classpath complete eldoc info inspect-start inspect-refresh inspect-pop inspect-push inspect-reset macroexpand ns-list ns-vars resource stacktrace toggle-trace-var toggle-trace-ns undef
Please, install (or update) cider-nrepl 0.8.2 and restart CIDER
user>
However, I do have a dependency for [cider/cider-nrepl "0.8.2"] in my project.clj. This is working just fine when I run lein repl and to which I can then connect just fine from cider:
; CIDER 0.8.2 (Java 1.7.0_51, Clojure 1.6.0, nREPL 0.2.6)
swedishchef.handler>
I can see that I get two different messages from leiningen wrt. nREPL, depending on how I start:
[sugarcube->swedishchef]lein ring server
See https://github.com/technomancy/leiningen/wiki/Repeatability)
Started nREPL server on port 44231
This is the output with the working cider-nrepl connection:
[sugarcube->swedishchef]lein repl
See https://github.com/technomancy/leiningen/wiki/Repeatability)
nREPL server started on port 38024 on host 127.0.0.1 - nrepl://127.0.0.1:38024
REPL-y 0.3.5, nREPL 0.2.6
Looking at the output of lein deps :tree I don't see any problems. So, my first question is whether this supposed to work, i.e., if cider-nrepl should override lein rings behavior wrt. to nrepl startup? If so, could somebody give some advice for further troubleshooting?
Use latest lein-ring plugin version 0.9.2 and add :nrepl-middleware containing vector of nrepl-middlewares to :repl-options in your project.clj
For example, I create the project by lein new compojure-app my-app. Then, I tested it by creating a empty leiningen profile in ~/.lein/profiles.clj ex. {:yolo {}} and starting ring server by lein with-profile yolo,dev ring server.
(defproject my-app "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.6.0"]
[compojure "1.1.6"]
[hiccup "1.0.5"]
[ring-server "0.3.1"]
[cider/cider-nrepl "0.8.2"]]
:plugins [[lein-ring "0.9.2"]]
:ring {:handler my-app.handler/app
:init my-app.handler/init
:destroy my-app.handler/destroy
:nrepl {:start? true}}
:repl-options {:nrepl-middleware
[cider.nrepl.middleware.apropos/wrap-apropos
cider.nrepl.middleware.classpath/wrap-classpath
cider.nrepl.middleware.complete/wrap-complete
cider.nrepl.middleware.info/wrap-info
cider.nrepl.middleware.inspect/wrap-inspect
cider.nrepl.middleware.macroexpand/wrap-macroexpand
cider.nrepl.middleware.ns/wrap-ns
cider.nrepl.middleware.resource/wrap-resource
cider.nrepl.middleware.stacktrace/wrap-stacktrace
cider.nrepl.middleware.test/wrap-test
cider.nrepl.middleware.trace/wrap-trace
cider.nrepl.middleware.undef/wrap-undef]}
:profiles
{:uberjar {:aot :all}
:production
{:ring
{:open-browser? false, :stacktraces? false, :auto-reload? false}}
:dev
{:dependencies [[ring-mock "0.1.5"] [ring/ring-devel "1.3.1"]]}})

emacs24 semantic completion

I'm trying to get semantic completions working with emacs 24 and the version of cedet that comes with it. Completions work for classes I defined in my own source file, but completion isn't working for the standard library or STL stuff Here is my emacs config:
(require 'cedet)
(require 'semantic)
(require 'semantic/ia)
(require 'semantic/bovine/gcc)
(semantic-add-system-include "/usr/include/c++/4.6.3" 'c++-mode)
(setq semantic-default-submodes
'(global-semantic-idle-scheduler-mode
global-semanticdb-minor-mode
global-semantic-idle-summary-mode
global-semantic-idle-completions-mode
global-semantic-highlight-func-mode
global-semantic-decoration-mode
global-semantic-mru-bookmark-mode))
(setq semanticdb-default-save-directory "~/.semanticdb/"
semantic-complete-inline-analyzer-idle-displayor-class 'semantic-displayor-ghost)
(semantic-mode t)
In my ~/.semanticdb directory I only see "!usr!include!c++!4.6!x86_64-linux-gnu!bits!semantic.cache", which isn't even using the version I specified in the config.
When I try M-x semantic-analyze-possible-completions on a std::list, for example, I get an error saying: "Cannot find types for std::list"
Any suggestions for how to debug this or how to fix it?
I was installing today a fresh Ubuntu 13.04 on my new SSD,
and here are my steps to configure CEDET ( I checked that it gives completions for std::list).
Basic setup
Get a fresh emacs and build it from source.
It's as easy as
./configure && make && sudo make install
Add to .emacs
(semantic-mode 1)
That's the whole setup.
Testing
Run emacs without loading anything:
emacs -q test.cc
Enter the code
#include <list>
int main() {
std::list lst;
lst.$
return 0;
}
M-x semantic-mode
with point at $, M-x semantic-ia-show-variants
Troubleshooting
If stuff doesn't work, it's likely that the semanticdb is corrupt.
Just find where it is, for me it's semanticdb-default-save-directory="~/.emacs.d/semanticdb",
and remove everything from there.
Then, when visiting a source file, call semantic-force-refresh.

Error using Perforce within Emacs

I've obtained p4.el and put the following in my .emacs, running under cygwin:
(setq p4-executable "p4")
(load-library "p4")
p4.exe is the cygwin version.
On running M-x p4-info I get the following error:
/path/to/p4.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
Yet running M-! p4 info works fine. Probably I'm missing an env variable. Apologies if this is a basic question - I'm new to emacs.
Try adding (p4-set-p4-executable "/my/path/to/p4") to your .emacs.

How to compile CEDET 1.0pre7 compilation for Emacs 23.1.50 on Windows?

I'm trying to compile CEDET from CVS for Emacs 23.1.50 on Windows and I've got error on "Step 6: Turning on EDE...": "defvar: Symbol's value as variable is void: cedet-menu-map". Compilation of CEDET 1.0pre6 raises the same error.
CEDET has been integrated into Emacs after 23 was released. As such, you don't need to compile CEDET for your Emacs, you just need to turn it on. In such a version of Emacs, the only difference from the install instructions from CEDET is that you don't need to load cedet.el, and you do need to turn on (semantic-mode 1) to do what cedet.el used to do.