Fork me on GitHub
#emacs
<
2019-05-10
>
manandearth07:05:27

Looking for a JS setup... I come to javascript from clojurescript and not the other way round, so I find it hard to give up on my emacs experience... pointers?

practicalli-john11:05:45

The Spacemacs layer should give you some ideas, for packages used and configuration. https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Blang/javascript

👍 4
tanners14:05:54

If at all possible, attempt to use typescript over javascript. The typescript tooling for emacs (specifically tide) is miles better than the js equivalent.

theeternalpulse17:05:00

I use JS at work with spacemacs, I've added RJSX package manually as it's great for react, though it has missing gaps/bugs.

theeternalpulse17:05:56

@U5DEC96P7 is it backwards compatible, as in, does it provide a lot of syntax functionality to just js or does it bug out at certain points in es6 syntax? Also does it support react?

tanners17:05:41

Typescript is a superset of javascript, so any valid es6 is valid typescript. And it does support react, I'm using it for a react project at work right now. The files simply change from js/jsx to ts/tsx

theeternalpulse17:05:23

ah, I have to trigger the modes manually when it detects import React at the top of a buffer.

theeternalpulse17:05:32

since at my job our react files are just .js

theeternalpulse17:05:07

I'll try it out. though

practicalli-john07:05:25

@UBGH0Q0H4 glad we could help. I don't use JavaScript myself, I use ClojureScript and reagent (react.js wrapper). I would be interested to hear if the JavaScript layer or others has helped you. Thanks.

manandearth07:05:41

I will let you know @U05254DQM, I was sent a link to download visual-studio and immediately turned pale.. 😱 So I will give it my best shot...

practicalli-john08:05:52

VSCode is quite a nice editor and a world appart from Visual Studio. So if you don't get what you need from Spacemacs in terms of JavaScript, it could be a good alternative. There is also a nice Clojure plugin called Calva.

practicalli-john08:05:57

I would like to see a nice Spacemacs experience for VSCode, maybe called Spacecode :)

🙂 4
felipebarros21:05:44

Sorry for the late response but you may find this Reddit thread of relevance: https://www.reddit.com/r/emacs/comments/8e24t9/writing_reactjsx_in_2018_what_addons_do_you_all/ I've been recently trying to build up a nice JavaScript experience on top of Spacemacs (coming from Clj/Cljs just like you) and this helped me a lot. RJSX with Tide, flycheck/eslint, prettier and flow. It's the best of VSCode on top of Emacs so it has been great so far. I only wish I could find work with CLJS forever and never touch a line of JS again though.

👍 4
michal08:05:17

hey, I started using orchestra along with clojure specs and looks like defn-spec macro fools clojure mode in a way that all docstrings are treated as strings (and displayed in different color). is there any way to instruct clojure mode (which I guess is responsible for syntax highlighting) to recognize a syntax of defn-spec, which looks more or less like this:

(defn-spec my-add integer?
  "Returns the sum of `a` and `b`."
  [a integer?, b integer?]
  (+ a b))

yuhan16:05:29

I think you have to put a property onto the elisp symbol defn-spec for that to happen

yuhan16:05:35

something like (put 'defn-spec 'clojure-doc-string-elt 3) where 3 is the index of the docstring in the sexp

theeternalpulse17:05:13

Any good tutorials on developing an emacs package? I've found a coupl that touch on it but nothing really comprehensive.

jeff.terrell18:05:23

@theeternalpulse - Not comprehensive, but maybe a start: the "Extending Emacs" series here: http://emacsrocks.com/

michal19:05:06

@qythium awesome! works perfectly. thanks.