This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-11
Channels
- # admin-announcements (26)
- # aws (1)
- # beginners (356)
- # boot (28)
- # cider (20)
- # clara (12)
- # cljs-dev (78)
- # cljsrn (22)
- # clojure (333)
- # clojure-brasil (1)
- # clojure-dev (15)
- # clojure-miami (1)
- # clojure-nl (3)
- # clojure-russia (61)
- # clojurecup (3)
- # clojurescript (137)
- # clojurex (4)
- # core-async (4)
- # data-science (3)
- # datavis (2)
- # datomic (31)
- # editors (1)
- # emacs (9)
- # hoplon (3)
- # juxt (8)
- # ldnclj (47)
- # leiningen (4)
- # luminus (4)
- # off-topic (20)
- # om (332)
- # onyx (1)
- # parinfer (23)
- # portland-or (4)
- # proton (161)
- # reagent (46)
- # ring-swagger (11)
- # specter (7)
- # yada (2)
/tmp/proton/plugin
λ apm outdated
Package Updates Available (1)
└── vim-mode 0.62.0 -> 0.63.0
(.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
proton.lib.package_manager.get_apm_path()
"/opt/homebrew-cask/Caskroom/atom/1.1.0/Atom.app/Contents/Resources/app/apm/bin/apm”
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”]
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
where I was hoping the .name
would give me the name
field on that json object, but it didn't
(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))
(<! 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?
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
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
what helps me understand is that everything inside a go
block is getting executed async
well I think atom is doing some requests to the repository though so it could take a while
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.
that’s on the list We need to get atom somehow to accept our command chain without a editor context
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
Here’s also a doc how to contribute layers to get started https://github.com/dvcrn/proton/blob/master/HOW-TO-LAYER.md
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
add your theme package inside additional-packages
and change
["core.themes" ["atom-material-ui" "atom-material-syntax"]]
to reflect thatby 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”]]