This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-19
Channels
- # beginners (7)
- # boot (48)
- # clojure (50)
- # clojure-portugal (1)
- # clojure-russia (10)
- # clojure-spec (29)
- # clojure-uk (9)
- # clojurescript (116)
- # core-logic (1)
- # cursive (12)
- # datascript (2)
- # datomic (7)
- # defnpodcast (8)
- # dirac (80)
- # emacs (486)
- # hoplon (5)
- # instaparse (3)
- # keechma (1)
- # luminus (3)
- # lumo (35)
- # off-topic (65)
- # om (6)
- # onyx (6)
- # perun (42)
- # re-frame (5)
- # reagent (5)
- # rum (2)
- # untangled (170)
- # vim (13)
Hello Emacs Clojurians! I am quite new to programming, Clojure, and Emacs. So I have some embarrassing questions and problems. So here goes my first issue: When I execute cider on emacs it starts a REPL, but it doesn't generate a buffer for me to access the REPL, anyone has experienced this problem and maybe knows how to solve it? Feel free to suggest the simplest answers since, as I mentioned before, I'm incredibly new to this. Thank you all in advance!
For sure! thank you for taking the time. Maybe I'm doing a step wrong but it used to work for me.. So the steps I'm taking are:
'ad-handle-definition: ‘ido-completing-read’ got redefined For information about GNU Emacs and the GNU system, type C-h C-a. Are you sure you want to run `cider-jack-in' without a Clojure project? (y or n) y Starting nREPL server via /usr/local/bin/lein update-in :dependencies conj \[org.clojure/tools.nrepl\ \"0.2.12\"\ \:exclusions\ \[org.clojure/clojure\]\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.14.0\"\] -- repl :headless... nREPL server started on 51408 [nREPL] Establishing direct connection to localhost:51408 ... [nREPL] Direct connection established Connected. One chord is fine. Two chords is pushing it. Three chords and you’re into jazz. -Lou Reed Quit Loading /Users/juan/.emacs.d/recentf...done Cleaning up the recentf list...done (0 removed)'
1) Are you using boot or leingein? 2) Can you (1) run the repl outside of emacs, and run "M-x cider connect"? <-- this is to binary search "can the repl start" from "can cider connect"
1) type in "lein new foobar" // reates new project, should give you project.clj 2) in foobar/ , type in "lein repl" 3) open up foobar/project.clj in emacs, type in M-x cider connect 4) see if cider connects this way
I have the clj project open, run the cider jack in after having run the lein repl in foobar and all
can you kill your emacs, open it up again fresh, and do the jack in from the project, and show us the messages buffer output?
this is way overkill; but do you know how to use https://www.liveedu.tv/ ? if you could live stream, we could probably debug this in like 5 mins
I did initially, then I realised it was all screwed up so I installed the latest through brew, and it was working fine for a while
no no, I did initially, and then a friend who is a clojure developer helped me set it up properly, but i must have screwed it up at some point
it's pegged to CIDER version 0.8 and includes the compiled bytecode as well as the el files
I'm in a helpful mood -- a number of people spent who knows how much time helpine mget dirac setup; if you can manage to stream your setup, we can probably help you fix it
this is weird, it says "connected, Happy ahcking" at the bottom, but no buffer for cider?
this is absolutely insane, butwould you mind
1) moving /.emacs.d to /old-emacs
2) running a new emacs, and typing in M-x package-install <RET> cider
3) and trying this in the new emacs?
I'm suspecting there's something wrong with the cider install.
I still think we should consider moving /.emacs.d to /old-emacs, staritng from scratch, and just doing M-x package-install <RET> cider 🙂
"by kill existing emacs" I mean "kill -9 any running emacs process which might e using old ~/.emacs.d"
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(require 'package)
(add-to-list 'package-archives '("melpa" . " ") t)
(package-initialize)
1) put the above in ~/.emacs.d/init.el 2) run M-x eval-buffer 3) run M-x package-install <RET> cider
1) open up that project.clj file (this sets the directory to the correct place) 2) type in M-x cider-jack-in
if the above fails, reformat the OS and do a clean install form a iso blesed with holy water
(setenv "PATH" (concat "/usr/local/bin/:" (getenv "PATH"))
(setq exec-path (cons "/usr/local/bin/" exec-path))
^^ add those two lines do you ~/.emacs.d/init.el, and then do "M-x eval-buffer" again1) M-x eval buffer seems to ahve succeeded 2) siwtch back to project.clj 3) run M-x cider-jack-in
see the big red "WARNING ... ." -- so we are connected ot the lein repl, but cider isn't properly loaded yet
@dpsutton: actually, I think the issue is just we don't ahve cider middleware -- it says: we need 0.15.0 -- we have (nil)
@juanmp: what precisely are you trying to do? perhaps we can point you at the right template on github you can clone
@dpsutton: you're saying that emacs/cider has the ability to tell lein to install the correct version of cider-middleware?
@dpsutton: unless juanmp has lein configs we want to save; could we just do "rm -rf ~/.lein" and rerun everthing? this should remove all the "old config" ?
so that's why the frontend says, "I'm 15 and i don't recognize who's on teh back end. things will probably break"
and after we show that CIDER works and you had a faulty init previously, I want to recommend a good init for ya
@dpsutton: this is amazing, how did you infer that ~/.lein was the problem? I would have never guessed that
but yeah, when i see a middleware mismatch and i've heard brave i have a good idea of where the problem is
but @qqq and @dpsutton you both rule, thank you so much for your time and patience. And now you know you have free beers in Stockholm!
I'm using lispy, evil, and evil-lispy. Anyone have good recommendations for: (1) "rainbow () [] {}'s" and (2) not sure what this is called -- but when I move the cursor over a )]}, I want it to show me the corresponding {[(
(i.e. what I used to use in paredit seemed a bit more "subtle" compared to show-paren-mode, which seems very glaring)
Short Question: How do I do "find and insert sexp?" Longer Question: I have a number of *.cljs files. In some of these files, I have lines that look like:
(def-foo :student
[:age :gender :name])
(def-foo :dog:
[:favorite-toy :age :gender])
now, if I just wanted to jump to the definition of (def-foo :student ... or (def-foo :dog, I could do this via etags
however, that's not what I wnat
what I want is:
(1) find me the def and (2) grab+insert the entire sexp of the def
what is the ideal way to achieve this ?so if you were in code writing (foo :dog)
, you could eval and replace and it would replace that sexp with its value
so my cursor is over 🐶 and at this point, I want to insert the entire sexp (def-foo :dog [....]) inplace
i'm not sure how any generic package could know that :dog
in your case referred to the code
so for example, one can imagine that I have a helm-projectile setup, which has all of def-foo indezed
so when my cursor is over
:dog
, I hit some key combo, and this helm thingy pops up, with only (def-foo from my current projectthen, I bind the action to "grab entire sexp and insert it here" instead of "jump to definition"
actually I think elisp is good enough to "parse sexp" for cljs, i.e. as long as I'm only using () [] {} , elisp should grab the sexp correctly
they all do, as I'm writing the code 🙂 no, not in the same file, but in the same helm-pojectile project
literally the function I need so the remaining part is "how to change action from "go to loc" to "extract and insert sexp""
Helm projectile does also replacement
Just 'r' instead of 's' as the last key of the command
Otherwise cljr also has that but not for Clojurescript
@andrea.crotti : I think what you said is important
C-c p r
I think
Just check the helm projectile functions
There is one for replacing
it's just projectile-replace
the command anyway
or cljr-rename-symbol
which would be even smarter, but only works with .clj files
@andrea.crotti: I appreciate your effort to help me. I'm not sure we're solving the same problem. Can you briefly, in 2-3 sentences, tell me what problem you're solving?
ah right I thought you needed simple symbol replacement @qqq
I think then maybe you should look at the smartparens functions
no, this is not what I want. So I have my own sorta-spec thing, where I define a number of "specs" with:
(def-spec :student ... )
(def-spec :dog ...)
(def-spec :car ...)
then, when I'm writing code, I want to be able to put my cursor over
:student
hit some key, then have it find the (def-spec student ... ) entire sexp -- and insert the entire sexp in place
(this helps me write out the data with the spec in hand)yes ok
so if we had:
(def-spec :student [:name :age :gender])
and I had a cursor over
:student
I want to hit some key, and have
(def-spec :student [:name :age :gender])
inserted inline, which I'll then fill in the parameters for.you could also otherwise generate a yasnippet snippet on the fly
the part I'm missing is changing the helm action from "jump to file/line" to (1) grab the entire sexp (2) insert the sexp
and then just use that
so the spec is not necessairly on one line, so I need a way to grab the entire symbolic expression
generaing yasnippet on the fly seems weird --= since "if I get the full expression for wriing the yasnippet, why not just insert it in place instead"
well it makes it much easier to fill it in
and I think as mentioned above you could use the smartparens functions I guess
to get the sexp, it does all the parsing you need for you
@qqq smartparens h 20170209… installed 669 Automatic insertion, wrapping and paredit-like navigation with user defined pairs.
(defvar sp-smartparens-bindings '(
("C-M-f" . sp-forward-sexp)
("C-M-b" . sp-backward-sexp)
("C-M-d" . sp-down-sexp)
("C-M-a" . sp-backward-down-sexp)
("C-S-d" . sp-beginning-of-sexp)
("C-S-a" . sp-end-of-sexp)
("C-M-e" . sp-up-sexp)
("C-M-u" . sp-backward-up-sexp)
("C-M-n" . sp-next-sexp)
("C-M-p" . sp-previous-sexp)
("C-M-k" . sp-kill-sexp)
("C-M-w" . sp-copy-sexp)
("M-<delete>" . sp-unwrap-sexp)
("M-<backspace>" . sp-backward-unwrap-sexp)
("C-<right>" . sp-forward-slurp-sexp)
("C-<left>" . sp-forward-barf-sexp)
("C-M-<left>" . sp-backward-slurp-sexp)
("C-M-<right>" . sp-backward-barf-sexp)
("M-D" . sp-splice-sexp)
("C-M-<delete>" . sp-splice-sexp-killing-forward)
("C-M-<backspace>" . sp-splice-sexp-killing-backward)
("C-S-<backspace>" . sp-splice-sexp-killing-around)
("C-]" . sp-select-next-thing-exchange)
("C-M-]" . sp-select-next-thing)
("C-M-SPC" . sp-mark-sexp)
("M-F" . sp-forward-symbol)
("M-B" . sp-backward-symbol)
)
"Alist containing the default smartparens bindings.")
one of those should help surely
yeah same thing
one thing that I like about evil-paredit more than evil-lispy -- is that evil-paredit when yanking/deleting, kept things balanced, evil-lispy doesn't seem to achieve this by default for me
Check out lispyville qqq
It does exactly that
@pesterhazy: trying again now, do you perchance have a lispyvile binding which makes [ insert [] ?
I'm actually using it only for the balancing-parentheses behavior
I don't even enable lispy-mode
balancing parentheses when using dd
is such an essential feature I'm surprised it's not a default
never happened to me?
evil-paredit is an interesting pointer
it's such a crowded space
afaik structural editing tools have two jobs
1st is to keep parens balanced by rebinding constructive (like (
) and destructive (like dd
) actions
2nd is to provide additional keybinds (or as with lispy rebind existing ones) to operate on s-exps
now even pure emacs allows you to navigate and manipulate sexps to a certain extend
there's mark-sexp and kill-sexp for example
but to have 1 and 2 you need an additional package
the main structural editing packages are paredit, smartparens and lispy
unfortunately, using evil-mode makes things more complicated still
because evil supports different editing primitives (like dd
) and because it has vastly different keybindings
does that sound like a correct summary?
I just try to get into emacs and clojure, but stuck at using java classes. When I import e.g. java.awt and load the file in cider, a classNotFoundException is thrown. When I open the project in intellij, the classes are found. What do I have to do, that emacs or leiningen knows the classes location?
does that happen with other classes @danielgrosse ?
I seem to remember that AWT is not shipped with (some packages of) the openjdk