Problems getting Emacs 24 to run SLIME and Clojure Debug Toolkit (CDT) - emacs

I'm trying to get Slime working with CDT and emacs 24, to no avail, and would appreciate suggestions.
1) I did get clojure-jack-in to run, but only when I loaded swank-clojure 1.3.3 as a lein plugin, as described in the github swank-clojure page, https://github.com/technomancy/swank-clojure.
2) I tried to get swank-clojure 1.4.0-SNAPSHOT loaded as described by George Jahad in http://georgejahad.com/clojure/swank-cdt.html (using Clojure 1.2.1), but I couldn't clojure-jack-in to run. I got the same error as described in 3), below.
3) Most recently, I tried duplicating the results of the short proof-of-concept video on the technomancy.us site, on the "in which radical simplification ensues," http://technomancy.us/149. In this method, I loaded swank-clojure 1.4.0-SNAPSHOT as a lein plugin and confirmed it was loaded to ~/.lein/plugins/swank-clojure-1.4.0-SNAPSHOT.jar. When I created a new lein project, did lein deps on it, opened the project's core.clj file in emacs, and then executed M-x clojure-jack-in, instead of getting a REPL, I got the following error in the emacs minibuffer:
error in process filter: Search failed: "(run-hooks 'slime-load-hook) ;
on port"
Note that the end of the error string does not include a port number. Unless that's an arbitrary truncation of a longer error string, the lack of a port number makes me uneasy.
The *swank* buffer is long, beginning with:
;;; Bootstrapping bundled version of SLIME; please wait...
and ending with:
(provide 'slime-repl)
;;; slime-repl.el ends here
(run-hooks 'slime-load-hook)
;;; proceed to jack in
which is consistent with the error message.
I've spent about six hours on this, including a lot of web searches, and no luck. Thanks for any help you can provide.
ADDENDUM: I've continued experimenting, and now the *swank* buffer ends like before (dying at the same place), but with additional lines at the end. FYI, here it is:
(provide 'slime-repl)
;;; slime-repl.el ends here
(run-hooks 'slime-load-hook)
[WARNING] Overriding profile: 'null' (source: pom) with new instance from source: pom
[WARNING] Overriding profile: 'null' (source: pom) with new instance from source: pom
[WARNING] Overriding profile: 'null' (source: pom) with new instance from source: pom
Downloading: org/clojure/clojure/1.+/clojure-1.+.pom from repository clojars at http://clojars.org/repo/
Unable to locate resource in repository
[INFO] Unable to find resource 'org.clojure:clojure:pom:1.+' in repository clojars (http://clojars.org/repo/)
Downloading: org/clojure/clojure/1.+/clojure-1.+.pom from repository stuartsierra-releases at http://stuartsierra.com/maven2
Unable to locate resource in repository
[INFO] Unable to find resource 'org.clojure:clojure:pom:1.+' in repository stuartsierra-releases (http://stuartsierra.com/maven2)
Downloading: org/clojure/clojure/1.+/clojure-1.+.pom from repository clojure at http://build.clojure.org/releases
Unable to locate resource in repository
[INFO] Unable to find resource 'org.clojure:clojure:pom:1.+' in repository clojure (http://build.clojure.org/releases)
Downloading: org/clojure/clojure/1.+/clojure-1.+.pom from repository clojure-snapshots at http://build.clojure.org/snapshots
Unable to locate resource in repository
[INFO] Unable to find resource 'org.clojure:clojure:pom:1.+' in repository clojure-snapshots (http://build.clojure.org/snapshots)
Downloading: org/clojure/clojure/1.+/clojure-1.+.pom from repository central at http://repo1.maven.org/maven2
Unable to locate resource in repository
[INFO] Unable to find resource 'org.clojure:clojure:pom:1.+' in repository central (http://repo1.maven.org/maven2)
Copying 9 files to /Users/gw/tech/clojurestuff/cljprojects/infwb/lib
Copying 1 file to /Users/gw/tech/clojurestuff/cljprojects/infwb/lib/dev
Listening for transport dt_socket at address: 61012
;;; proceed to jack in
(end of addendum)
ADDENDUM 2 (Dec. 12, 2011) Thanks to all who offered help, especially #ivant, to whom I'm awarding the "check mark." I'm going to consider this situation closed because I've given up trying to fix it. It was complicated by my use of a prepackaged initialization package that I'm sure is quite nice, but I couldn't understand what it was doing, nor whether it was contributing to the problem.
I restarted with a "clean" Emacs 24 and reverted to swank-clojure 1.3.3, and clojure-jack-in works just fine now. I'll try CDT later, once the bug logged to swank-clojure 1.4.0-SNAPSHOT is resolved.
I learned a few things from people's comments--thanks again.

N.B. I don't have neither emacs 24, nor CDT installed.
Looking at the code of clojure-jack-in, it looks like it chooses a port beforehand, and starts clojure using lein jack-in <port> (unless you redefined clojure-swank-command somewhere).
It then parses the output (which is visible in the *swank* buffer) looking for specific strings to trigger some actions. These are:
;;; Bootstrapping bundled version of SLIME
...
;;; Done bootstrapping.
or as a fallback:
;;; Bootstrapping bundled version of SLIME
...
(run-hooks 'slime-load-hook) ; on port
and it executes the emacs commands between these lines. The string "proceed to jack in" triggers the actual connect.
So check the source, check the values of some relevant variables (like clojure-swank-command) and check what's in the *swank* buffer for clues.
EDIT
You may want to run lein deps in your project, brfore trying M-x clojure-jack-in, otherwise output like
Downloading: org/clojure/clojure/1.+/clojure-1.+.pom from repository clojars at http://clojars.org/repo/
...
can end up in the *swank* buffer and can interfere with the starting process.
But this specific dependency looks quite suspicious to me. Can you post your project.clj file as well?

Upgrade to swank-clojure 1.4.0 (released yesterday) and everything will just work out of the box. lein plugin install swank-clojure 1.4.0
CDT installation and integration are now completely automated. Make sure to remove any old copies of swank-clojure, slime.el and slime-repl.el you have lying around. Just to be safe, also make sure you've got the latest clojure-mode.el installed.

I don't have an answer, although I've hit this same problem, but I can provide a work around.
Just run lein swank from the commandline and use slime-connect inside Emacs, and you'll at least have a working environment again.
This has also been filed on the swank-clojure bug list:
https://github.com/technomancy/swank-clojure/issues/87

Related

ASDF not finding package in custom directory

I'm new to Common Lisp, I'm using Emacs/SLIME on Windows 10, and I'm trying to wrap my head around how CL and ASDF/packaging works.
I have a custom package 'my-pack' in a directory 'D:\Dropbox\my-packages'.
I have created a .conf file in:
%LOCALAPPDATA%\config\common-lisp\source-registry.conf.d\
And added this line:
(:tree "D:\\Dropbox\\my-packages\\")
I opened Emacs, started SLIME and made the project via the REPL:
(cl-project:make-project #p"D:/Dropbox/my-packages/my-pack)
I verified that the project is in the directory and then loaded the system with asdf (version 3.3.1):
(asdf:load-system :my-pack)
And it worked fine.
But when I quit and restart Emacs, I get the following error when trying to the load the system:
Component :MY-PACK not found
[Condition of type ASDF/FIND-COMPONENT:MISSING-COMPONENT]
As far as I can tell I've followed the steps in the manual. Any help appreciated.
cl-project's make-project ends with this line:
(push dir asdf:*central-registry*)
it adds your new project's directory to this list that tells ASDF where to look for projects. What is its value when you restart CL?
2.
\config\common-lisp\
Shouldn't it be .config?
However, I don't encourage to use this conf file with :tree. The doc says:
tell ASDF to recursively scan all the subdirectories
So, imagine that just once, you try yourself at web development and you install, for example, JavaScript dependencies with npm or equivalent, you'll end up with a gigantic node_modules/ and your Lisp will now take a few seconds to start up.
I suggest to put your projects under ~/common-lisp/ or ~/quicklisp/local-projects, or to create symlinks, or to add yourself your projects in asdf:*central-registry* from your Lisp startup file:
;; .sbclrc
(pushnew "/home/me/projects/ciel/" asdf:*central-registry* :test #'equal)

Pharo on RaspberryPi: Module not found at startup

I am on a raspbian stretch system with the spur32 VM for ARM and a Pharo 7 image. At Startup I always get an exception: Error - Module not found.
It seems to have to do with lgitlibrary. I really cannot figure out what this error is about.
Any ideas?
Thanks,
Henrik
I see. If you check #unixModuleName
unixModuleName
| pluginDir |
pluginDir := Smalltalk vm binary parent.
#('libgit2.so' 'libgit2.so.0')
detect: [ :each | (pluginDir / each) exists ]
ifFound: [ :libName | ^ libName ].
self error: 'Module not found.'
Here you have your error message: self error: 'Module not found.'
You probably have libgit2.so or libgit2.so.0 missing (or dependencies). You may suffer with similar problem as me: Getting error when adding OSSubprocess to my Pharo 6.1 on Centos 7.4x.
You should check the dependencies with ldd (check my question for details).
Edit Adding information due to comment:
I have yet to use IceBerg (the Pharo's git integration). My guess, would be to "(re-)initialize it": (Smalltalk at: #LGitLibrary) initialize.
For more information, I recommend reading these: pharo's iceberg and some Pharo project that uses git like pharo-contributor and checking blog pharoweekly (for some information about the pharo-contributor) - https://pharoweekly.wordpress.com/2018/04/24/pharo-contributor-to-contribute-to-pharo.
You may want to use some guide "How to use git and github with Pharo". Which was done by Peter Uhnak (you can find him on SO).
I had the similar problem and I needed to build libgit2 library from source using this instructions. The basic build didn't work because Pharo wasn't able to initialize the library. I compiled it again with parameter -DSTDCALL=ON an it works.

How to distribute the asdf/quicklisp dependencies along with an app compiled with Embeddable Common Lisp?

I have tried this example ECL repository asdf example , it works fine but it doesn't have any asdf dependencies. If i add
:depends-on (#:inferior-shell)
to example.asd then running the compiled standalone executable gives this error:
Condition of type: SIMPLE-PACKAGE-ERROR
There exists no package with name "ASDF/DRIVER"
No restarts available.
What causes this error, and what is the idiomatic way of dealing with asdf dependencies on ECL ?
EDIT: this problem is fixed for ECL newer than 16.1.3 (fixed in develop branch), so no `require' trick should be needed in the upcoming release.
In general path you have taken is correct.
Make sure, that you have required the ASDF:
(require 'asdf)
(find-package "ASDF/DRIVER")
Then "ASDF/DRIVER" package is defined. On the other hand inferior-shell requires a few other libraries (alexandria for instance), so you have to put the path to them in the ASDF central registry or use the Quicklisp bundles.
More detailed info about building with ECL is available in its Documentation.
// EDIT
After investigation it appears that ASDF has to be manually required at the program start. It is probably a bug. As a workaround add
:prologue-code '(require 'asdf)
to the (asdf:make-build …) for standalone executable. Everything works fine then.

On Using clojure.tools.namespace

In emacs cider repl, now I know how to use clojure.tools.namespace in a leiningen project. However, when I use it on a single clj file which doesn't belong to any project, it seems clojure.tools.namespace doesn't work on the file:
=> #<FileNotFoundException java.io.FileNotFoundException: Could not locate com/foo__init.class or com/foo.clj on classpath: >
I have declared clojure.tools.namespace in .lein/profile.clj and require it in the clj file. How should I make clojure.tools.namespace work on a single clj file?
My profile.clj
{:user
{:repl-options {:timeout 128000}
:plugins [;; REPL
[cider/cider-nrepl "0.9.0-SNAPSHOT"]
[refactor-nrepl "0.2.2"]
;; Application server
[lein-immutant "2.0.0-SNAPSHOT"]
;; Automated testing
[lein-cloverage "1.0.2"]
[lein-test-out "0.3.1"]
;; Package management
[lein-ancient "0.6.2"]
[lein-clojars "0.9.1"]
;; Documentation
[codox "0.6.8"]
[lein-clojuredocs "1.0.2"]
;; Static analysis
[lein-typed "0.3.4"]
;; [jonase/eastwood "0.1.2"]
[lein-bikeshed "0.1.6"]
[lein-kibit "0.0.8"]]
:jvm-opts ["-Dapple.awt.UIElement=true"]
:dependencies [[org.clojars.gjahad/debug-repl "0.3.3"]
[difform "1.1.2"]
[spyscope "0.1.4"]
[org.clojure/tools.trace "0.7.8"]
[org.clojure/tools.namespace "0.2.9"]
[im.chit/vinyasa "0.2.0"]
[slamhound "1.5.5"]
[criterium "0.4.3"]]
:injections [(require 'spyscope.core)
(require 'alex-and-georges.debug-repl)
(require 'com.georgejahad.difform)
(require '[vinyasa.inject :as inj])
(inj/inject 'clojure.core '>
'[[clojure.repl apropos dir doc find-doc pst source]
[clojure.tools.trace trace trace-forms trace-ns trace-vars
untrace-ns untrace-vars]
[clojure.test run-tests run-all-tests]
[clojure.pprint pprint pp]
[com.georgejahad.difform difform]
[alex-and-georges.debug-repl debug-repl]
[vinyasa.pull pull]])]}}
While this doesn't answer your specific question, it might provide some ideas on
alternative workflows which may help.
lein-exec This is a lein plugin that
lets you write clojure scripts or evaluate clojure expressions on the command line
in a similar way to what can be done with shells, python, ruby, perl etc. Of
course, startup time is a bit high, but this plugin will help you deal with
dependencies etc inside your single clj script file. (there are other possible
solutions to improve the startup speed). See this blog post for some examples
http://charsequence.blogspot.in/2012/04/scripting-clojure-with-leiningen-2.html
A scratch project. I have a fairly generic project called scratch. It just allows
me to create a new file within the src directory of the project which I can use for
experiments or demonstrations. For example, I have a file called stackoverflow.clj
within this scratch project which I use when working out the answer to a clojure
question on stack overflow. In fact, I have a lot of individual clj files in this
directory, each just representing a simple idea, test, experiment etc. It isn't
really a project i.e. I couldn't do a lein run at the root of the project and
expect anything meaningful. However, I can go to the source directory in emacs,
open a file and then run cider.

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

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