Yeah, great to see that it's getting a bit more traction :simple_smile:
It also bypassed my sublimetext version in the first day
Haha nice.
sublime just isn’t as extensible as atom or emacs, so that isn’t too surprising
though performance is a big factor. Sublime still smokes atom in startup and rendering time
^^ true
that's why I cut the nuclide stuff again because it made atom soooo slooooow
Yeah, that’s true. I’ve got friends inside facebook who have an internal (to fb) build of nuclide and they say they don’t see any performance hit
That’d be nice
I read that too. I think it might be something with the babel compilation. afaik atom live compiles babel when you install the plugin
do you btw also have the problem that ctrl+j/k is not working anymore?
Let me check, I haven’t been using them...
Looks like they are killing lines
Well ctrl-j doesn’t do anything, ctrl-k cuts the line below
that's odd, something must have gone wrong with the keymap
Oh I have a theory, I think because we don't deep-merge keymaps yet
ah but keymaps are a vector so it shouldn't matter
I think that one of my PRs did apply deep-merge to keymaps
But yeah, as a vector it shouldn’t matter (I think)
also on installation it doesn't automatically reload the packages
usually after a installation it made sure that new packages are usable right away
something is weird
yeah the keymaps are not loaded
Weird, what could have broken?
yeah the deep merge on the layer map broke it
Shoot. Sorry
not sure why it was a merge in the first place, I think I messed this one up. It's a vector of maps so it should have been concatinated
now to check why packages don't get loaded right away
I’ve actually been seeing a bunch of packages ending up in disabledPackages
of my ~/.atom/config.cson
You might want to check there
that could be it! The logic for disabling packages changed recently
hmm no, it's getting removed after installation so why is it not loaded
OT: Should we consider having proton (atom) update packages at startup?
I think not without the user specifying it. Imagine you wanna edit something and suddenly the editor loads for 5 minutes
(defn disable-package [package-name]
(if (is-activated? package-name)
(do
(println (str "disabling package " package-name))
(.disablePackage packages package-name))))
Good call. Maybe just add some command proton-update-pacakges
and make a keymap spc _ U
or something like that
if you wanna implement it, sure, go for it! 👍
@sglyon: ok fixed both of them. Do you have something fast you want to do otherwise I'm issuing a hotfix to atom packages
Sorry, I don’t understand the question
I mean
I wanna push a release to atom packages
do you have anything you want to get included
Ahh I see. Nope, let’s ship it. I’m skimming the atom API docs trying to figure out how to programmatically update packages
That might take a few minutes
it's not possible as far as I know
ahh
try to interop with apm
on the shell and see if that can do it
that's how I install and remove packages too
Yeah apm
works smoother for me most of the time also
https://github.com/dvcrn/proton/blob/master/src/cljs/proton/lib/package_manager.cljs#L57-L81
Ahh cool
Ok my first real bit of clojure code… (haha actually a copy/paste mashup of the function you linked to and the one below):
(defn update-package [package-name]
(println "Updating: " package-name)
(let [c (chan)]
(go
(if (not (is-installed? package-name))
(do
(>! c true)
(close! c))
(do
(.exec child-process (str (get-apm-path) " update " package-name " --no-colors")
(fn [err stdout stderr]
(if (nil? err)
(.setTimeout js/window #(do
(force-reload-package package-name)
(println (str "done: " package-name))
(go (>! c true))
(close! c))
1000)
; on error just close channel
(do
(go (>! c false))
(close! c))))))))
c))
Anything look horribly wrong there?
seems like the same as install
just with update
😛
Close… The first if
is different
seems good, though a challenge would be to find which packages need an update
apm outdated
oh lol
:simple_smile:
didn't know about that 😛
proton|master:zap: ⇒ apm outdated --json
[]
Now to see how I can deal with the STDOUT… that might take more work for me to figure out in clojure
I think you can grab that from stdout
(.exec child-process "apm outdated --json" (fn [err stdout stderr])
lol now I just need an outdated package so I can have a test case
create a dummy package like proton
and set the version to 0.0.1
atom will search it's repository for a higher version
Hmm, didn’t work.
huh? let me try
haha the real proton is killing it
Probably need to add it to my packages list
ah you have to of course put :proton inside your dotfile 😛
Yeah, not working for me still
hrrmm
I’ll just roll back to an old commit of one of my other packages
ah this works @sglyon :
go into ~/.atom/packages/<any-package>
change the version inside package.json
nice
/tmp/proton/plugin
λ apm outdated
Package Updates Available (1)
└── vim-mode 0.62.0 -> 0.63.0
Oh geez I don’t want anything to do with that json output though
maybe a regex match from ──
to a number or something
I mean the json isn’t so bad
it is an array of json objects, each of which has a name
field
I can skip the rest of it
Is there a way to turn this stdout
into a vector of maps?
(.parse js/JSON)
to get an object and js->clj
to convert it into a clojure map. Though david nolen mentioned before that it would be better to use goog libraries for dealing with js objects instead of converting them to clojure
I’m happy to leave it as json as long as I can ask the json what name
is for each object in the array
try js/JSON
then :simple_smile:
wait… can I access the proton ns/commands from the devtools?
That’d be killer
maybe from the REPL but from the devtools console, no
I’m seeing them now
(they tab complete)
proton.lib.package_manager.get_apm_path()
"/opt/homebrew-cask/Caskroom/atom/1.1.0/Atom.app/Contents/Resources/app/apm/bin/apm”
That came from the atom devtools console
oh lol
how did you compile it?
I’ve got a lein run -m build/dev-repl
process running right now
So all the stuff is already js (no more clojure), but I can still interact with it
maybe because it is not optimized? @thheller can answer that probably 😛
Didn't know that was possible
Not sure, but I’m pretty happy it is possible :simple_smile:
Nice
JSON.parse worked — gave me an array of json obejcts
anything useful in there?
Yeah
proton.lib.package_manager.child_process.exec(proton.lib.package_manager.get_apm_path().concat(" outdated --json"), function (error, stdout, stderr) {
var json_stdout = JSON.parse(stdout)
var names = json_stdout.map(function(x){return x.name;});
console.log(names)
});
> ChildProcess {domain: null, _events: Object, _eventsCount: 2, _maxListeners: undefined, _closesNeeded: 3…}
> ["vim-mode”]
Now I just need to figure out how to return that names
variable
Ahh is that what the channel is for in the install
and remove
package methods?
well there is also execSync, but I used a channel because otherwise each installation would block the entire editor
now it's async so it executes and we just pull the result of that execution back and display it
That’s very nice. I think I’m close
in theory just pipe it into the channel, close it and you should be good :simple_smile:
I'm going for lunch, will be back in 1h ish
quick question?
sure
I’ve got the array of json objects
now I want to do something like this:
(map #(.name %) (.parse js/JSON stdout))
where I was hoping the .name
would give me the name
field on that json object, but it didn't
How should I access that field?
to access properties, you have to use (.-name %)
.-
is the interop for that
http://www.spacjer.com/blog/2014/09/12/clojurescript-javascript-interop/
ok cool
success!
:simple_smile:
So can I shove the result of that map into the chan?
yep, or use the execSync version if it's fast enough for non async
Last question, how do I get it out of the chan?
(defn outdated-packages-chan []
(println "finding outdated packages")
(let [c (chan)]
(go
(.exec child-process "apm outdated --json"
(fn [err stdout stderr]
(if (nil? err)
(do
(println (str "The json is here: " (map #(.-name %) (.parse js/JSON stdout))))
(go (>! c (map #(.-name %) (.parse js/JSON stdout))))
(close! c))
(do
(go (>! c false))
(close! c))))))
c))
especially if you never used core.async it might be a bit tricky to understand 😛
Haha i’ve never used clojure...
(<! channel)
is for pulling out of a channel, put in cljs you can only use it inside a go block which is also a channel
so instead of that c
at the end should I just do (go (<! c))
to return the actual list of package names I want?
so you have to do something like
(go
(let [result (<! mychannel)]
(println result))
no, (go)
is also returning a channel
ahh
you can't really return a value out of a go block. If you work with async, just put it inside the channel that you return (`c` in that case) and let the receiving part just pull that value out of it
oooor use the execSync version 😛
haha — I’m determined to learn the async stuff
really fun stuff, but also not that easy to grasp
I also have a lot of problems with it
I’ve seen these concepts in go
But haven’t done a ton with them
what about returning (<!! c)
takes a val from port. Will return nil if closed. Will block
if nothing is available.
that's clojure. You can't use that in clojurescript
in cljs everything has to be inside a go
block
<!! is for real threads afaik which we don't really have in cljs :simple_smile:
ok
Oh I think I see what to do
return the channel
check out this talk - very cool! https://www.youtube.com/watch?v=enwIIGzhahw
Then have my update-packages
command just call the apm update
methods from within a go
block?
well if you copied my code then update-packages is also a async operation that uses channels. So calling update-package
will give you a channel back
but yeah that should work. But feel free to experiment a bit around with it
Ok thanks
what helps me understand is that everything inside a go
block is getting executed async
Pretty cool stuff
high recommendation for that talk up there. It's more clojure stuff but very cool
now going for lunch 🍞
But it’s about time for me to call it a night, so I might balk and just do execSync
sure!
This is a single call, so async doesn’t earn us anything (I think)
well I think atom is doing some requests to the repository though so it could take a while
I could rewrite it later on in async if you want :simple_smile:
if you get the sync version up
That’d be a good way to learn
No problem. There wasn't really an issue, @dvcrn was just helping me out with some basic stuff as I've never used clojurescript or clojure before.
Hi there.
@dvcrn what is the 'proton prompt'?
installed atom via .deb package from their site.
then
apm install proton-mode
as given on the github site.after startup proton does some stuff.
that should work
and it still doesn’t work? Open a file and hit space
I see.
Do you have any errors in your console?
nope.
I just tested the store listed version and don’t have problems hmm
works.
oh?
would it be possible to start opening a file with space?
like space f f
like in spacemacs?
so i open a file with ctrl-o.
you mean on initial start?
yes.
that’s on the list :simple_smile: We need to get atom somehow to accept our command chain without a editor context
definitely something that should come soon
ah, i see.
if you have a file open though you can do <spc> p f
to open the file searcher
so for now e.g. opening files is always with ctrl -o?
ok.
<spc> p r
for recents and <spc> b b
for buffers is also in
ok.
so does atom have a fuzzy file finder?
just asking, because maybe i can help a bit?
(though no expereience with clojure script)
<spc> f f would use the finder then, i guess?
p f
is already fuzzy but if you want something even fuzzier, you can open ~/.proton
and replace the OpenFileProvider
:normal with :nuclide, though I can only recommend it if you have a medium powerful machine because it does a lot of babel compiling first
always looking for help :simple_smile:
Here’s also a doc how to contribute layers to get started https://github.com/dvcrn/proton/blob/master/HOW-TO-LAYER.md
ah, ok.
it’s a fun project to get started with clojurescript
for sure :simple_smile:
<spc> _ d
opens your .proton file by the way
thanks.
just killed the only buffer, and
<spc>
menue at the bottom freezes/stays.hrm yeah we definitely should put more focus on getting it work on non buffers
just a couple of questions:
how can i get highlighted search?
I search with "/" and then start typing
input is at the bottom
how can i change themes? I see the line in the .proton file, is it always like ["core.themes" ["theme-ui", "theme-syntax"]]?
ok for the first part, this is a limitation on atoms site but I already have that working on my local machine. Gonna merge that back in and then incremental search and highlights will work
for themes
that is super cool!
add your theme package inside additional-packages
and change
["core.themes" ["atom-material-ui" "atom-material-syntax"]]
to reflect thatthe first part is the ui, the second part the syntax theme
ok.
by default we use material but to get the default atom one back for example, just change it to [“core.themes” [“one-dark-ui” “one-dark-syntax”]]
if you are not sure about the name, you can also use the package installer to browse themes, change it and open your atom config (in the settings menu) to see how it is called internally. Then just add that to your .proton file
proton will get rid of all the stuff you tested and don’t need on next start
ah, ok! thanks!