Use aliases with cider in Emacs - emacs

I am experimenting with Chromex using lein fig and lein content aliases which runs smoothly in console but in cider's environment there is a direct call (figwheel-sidecar.repl-api/start-figwheel!) in script (not using an alias), which gives errors regarding cljsbuild.
My question is how to use alias in cider's environment (or there is other way around?).

Related

'cider-jack-in' run clojure instead leiningen without a clojure project

I tried to execute 'cider-jack-in' from emacs without a Clojure project that I simply want to run Clojure REPL. But I've found that cider is trying to run /usr/local/bin/clojure instead /usr/local/bin/lein which don't refer my profiles.clj for Leiningen settings. It's normally work with lein when I try with a Clojure project.
I'm wondering there is any reason for that even there's no problem when I tried lein repl without a Clojure project in terminal which I've expected Cider to do so, and a way for setting up to run Leiningen through Cider without a Clojure project.
I'll appreciate for any comments on this.
On CIDER 0.18 (the current stable version) you need to set cider-jack-in-default to a symbol, not a string (e.g. 'lein).
(define-obsolete-variable-alias 'cider-default-repl-command 'cider-jack-in-default)
(defcustom cider-jack-in-default (if (executable-find "clojure") 'clojure-cli 'lein)
"The default tool to use when doing `cider-jack-in' outside a project.
This value will only be consulted when no identifying file types, i.e.
project.clj for leiningen or build.boot for boot, could be found.
As the Clojure CLI is bundled with Clojure itself, it's the default.
In the absence of the Clojure CLI (e.g. on Windows), we fallback
to Leiningen."
:type '(choice (const 'lein)
(const 'boot)
(const 'clojure-cli)
(const 'shadow-cljs)
(const 'gradle))
:group 'cider
:safe #'symbolp
:package-version '(cider . "0.9.0"))
The old variable did take a string, that's true. Without seeing the complete stacktrace I can't be certain what's exactly going wrong for you. Generally it's best to bring up such problems on CIDER's issue tracker.
In case someone's wondering why now CIDER uses clojure-cli instead of lein for a projectless REPLs - our thinking was that the Clojure CLI is the only tool we can assume that every Clojure user would have, so it made for a safer default.
Try: (setq cider-jack-in-default 'lein)

Projectile Using Out of date version of svn

I'm using the projectile library. When I invoke projectile-find-file I get the following error:
[svn: E155021: This client is too old to work with the working copy at foo/bar` (format 31). You need to get a newer Subversion client. For more details, see http://subversion.apache.org/faq.html#working-copy-format-change
From the command line, everything is fine (I'm using version 1.8.13).
Is there anyway that emacs can be using an out of date version? Or even how do I find out what version it is using/how it is invoking svn?
Projectile uses whatever svn binary it finds in your path. Try running which svn from Emacs (e.g. via shell-command / M-!) and from your terminal and comparing the paths you get. A difference will indicate that Emacs and your terminal are using different path variables.
Since you are on OSX, and since your terminal uses the expected svn, something like exec-path-from-shell might be helpful:
Ever find that a command works in your shell, but not in Emacs?
This happens a lot on OS X, where an Emacs instance started from the GUI inherits a default set of environment variables.
This library works solves this problem by copying important environment variables from the user's shell: it works by asking your shell to print out the variables of interest, then copying them into the Emacs environment.
exec-path-from-shell is available on MELPA.

Clojure - start a REPL without a project.clj

I started using Clojure with leiningen (and now boot).
Now I sometimes want to get quickly to a Clojure{Script} CIDER REPL in Emacs to execute just a few instructions. I don't want to create a project.clj file for that, since I just want a throwaway REPL.
Is there a way to get a Clojure REPL, for instance in the *scratch* buffer ?
well, you can execute M-x cider-jack-in anywhere you want, even with no project.clj in path. This works for me.
You can just type lein repl in the friendly console / shell / terminal right next to you -- no project.clj required. This will start a REPL as expected, to which you can then connect from Emacs via M-x cider-connect (which in recent versions will handily suggest host and port to connect to).
M-x cider-jack-in basically does the same thing (i.e. lein repl) behind the scenes.
I'm not a boot user, but according to the boot wiki for leiningen users it should be possible to call boot repl -s.
Use M-x cider-jack-in, and if you don't want it to warn you that you're running cider-jack-in without a Clojure project, add the following to your emacs.d/init.el:
(setq cider-allow-jack-in-without-project t)

Emacs/CIDER Error

I'm trying to do some Clojure development using Emacs and cider, and following this tutorial. I've gotten to the point where I need to do M-x cider-jack-in, which is supposed to start a *cider-repl* buffer, but instead gives me the error
error in process filter: Symbol's function definition is void: clojure-mode-variables
I'm running emacs 24.3.1, cider-20150412.827 (out of melpa), Leiningen 2.3.4, and I get the error whether I specify [cider/cider-repl "0.7.0"] or [cider/cider-repl "0.8.2"]. I'm able to successfully run lein run on the project I'm trying to edit.
Any ideas what I'm doing wrong?
You're using an outdated version of clojure-mode. Update to a recent version (e.g. the latest) and everything should be fine. Btw, you should also use [cider/cider-nrepl "0.9.0-SNAPSHOT"] together with CIDER from MELPA.

How to automate loading leiningen repl from within Emacs?

I'm using Emacs, integrated with Leiningen's swank. Each time I need to start working with .clj file I have to:
Run emacs pack/my-ns.clj from console.
Type M-x lein-swank.
Compile buffer.
In Clojure REPL change namespace, i.e. type (in-ns 'pack.my-ns).
How can I automate this process to just run from console something like emacs-clj pack/my-ns.clj and get my environment ready to use?
I don't have an answer to the question you posed, but you should be able to replace your 4th step with C-c M-p while in your Clojure file and then emacs should prompt you as to what namespace you want to be in with the namespace of the file auto-detected so you can simply hit enter. C-c M-p maps to slime-repl-set-package.
Update:
Just stumbled across this. Should be able to take what is said in that answer and modify it so upon initial connection to swank files get compiled. Could also set it up to automatically switch to namespace and make the repl buffer active.
Swank should automatically load the namespace pointed to by :repl-init-script in project.clj when it starts, so if you want to set that to your starting namespace, that should get you started.