This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-13
Channels
- # admin-announcements (1)
- # announcements (40)
- # aws (2)
- # babashka (46)
- # babashka-sci-dev (106)
- # beginners (31)
- # cider (5)
- # circleci (2)
- # clj-kondo (48)
- # clojure (118)
- # clojure-belgium (1)
- # clojure-chicago (3)
- # clojure-europe (19)
- # clojure-ireland (3)
- # clojure-losangeles (2)
- # clojure-nl (2)
- # clojure-spec (10)
- # clojure-uk (4)
- # clojurescript (18)
- # community-development (5)
- # core-async (159)
- # cursive (16)
- # datomic (16)
- # etaoin (1)
- # fulcro (21)
- # funcool (14)
- # graalvm (5)
- # gratitude (4)
- # holy-lambda (28)
- # jobs (1)
- # jobs-discuss (1)
- # kaocha (1)
- # lsp (12)
- # malli (21)
- # meander (12)
- # music (1)
- # off-topic (8)
- # portal (5)
- # react (18)
- # reitit (1)
- # releases (4)
- # remote-jobs (1)
- # shadow-cljs (56)
- # timbre (4)
Anyone here is using a lightweight syntax highlighting on emacs ? I want to try something else than the default setup that highlight too much in my opinion, maybe with a focus on data. Here for example everything is "highlighted" so it might as well not be. My setup is clojure-mode | cider | cojure-lsp and they all provide support for syntax highlighting, so I'm not sure how they integrate and if they can be tuned.
#cider channel might be another good place to ask.
You can customize the colors of things. font-lock-keyword-face font-lock-function-face font-lock-variable-name-face Those dictate the appearance of keywords, functions and variables respectively.
And the easiest you can do is just:
(setq cider-font-lock-dynamically nil)
That's going to disable dynamic font highlighting, so basically you get the same highlight as if you did not connect to a REPL
If you don't like blue color you may as well want to change your color scheme.
I use ample-zen
:
Ya, I was going to say, everything blue and a blue line highlight is a bit much, my theme (spacemacs-dark) looks like:
Also my theme looks like this (with similar code to your snippet):
@U028ART884X You either are not connected to a REPL or don't have full Cider dymamic font highlight, otherwise users should be the same orange color on both places
I have no special config for highlighting. I think it's the theme. But I may be wrong.
Also I'm on develop
branch.
And I am connected because I can evaluate the forms.
Ya, you need to add:
(with-eval-after-load "cider-mode"
;; Enable CIDER dynamic syntax highlighting so that custom fn and macro gets highlighted as such
(setq cider-font-lock-dynamically t))
And then it'll highlight all variables, functions and macros, not just clojure.core onesThe doc for it is here: https://docs.cider.mx/cider/config/syntax_highlighting.html
I believe both cider and clojure-lsp fiddle with highlighting, but how much and to what degree I don't know (never used clojure-lsp and haven't used cider in a long long time)
I think that's what they don't want haha. I think it's great, but if your font has very similar colors for functions, keywords and variables I can see their point
Can semantic tokens or maybe it's emacs be dialled down to, for ex, only highlight some token ?
And the easiest you can do is just:
(setq cider-font-lock-dynamically nil)
That's going to disable dynamic font highlighting, so basically you get the same highlight as if you did not connect to a REPL
A little bit lost on the -X
part of invoking a function in the command line:
clojure [clj-opts] -X[aliases] my/fn? [kpath v ...] kv-map?
Can someone give me an example covering the [kpath v …] kv-map? partDoes https://clojure.org/reference/deps_and_cli#_keys_and_key_paths help?
it's mostly like invoking a kwargs function (other than using vectors as a key path)
The notation is the one part that confuses me
clojure [clj-opts] -X[aliases] my/fn? [kpath v ...] kv-map?
For example, the ? in fn? does it mean my/fn? is optional in the command line?? means it is optional (can be supplied in :exec-fn in alias)
I don't know what "the two part existing together" means, sorry
The example says
# Override the arguments to my-fn
clj -X:a-tool my-fn :val 789 '{:val 123}'
you could, but just trying to demonstrate syntax
but when I get a chance I'll try to improve that
If you were going to build a desktop app for your own personal use these days, what would you use? I’ve tried cljfx, but I can’t quite wrap my head around it for anything more complex than “Hello, world.” I’ve done electron apps years ago, but I’m not sure where that project has gone lately. What’s good these days?
Ah, haven’t heard of that one before, thanks!
It's kind of raw but with my zero experience in building ui I managed to build something in less than a day
I’m currently looking for solutions to this, and have stumbled upon https://tauri.studio/en/, which is in beta, but I successfully wrapped a webapp of mine in less than an hour (mainly spent watching cargo download and compile rust dependencies)
also, but using F#, https://fsprojects.github.io/Fabulous/ seems interesting
I'd be happy to answer any questions about membrane. If you're already familiar with web technologies, then electron is still a good choice.
Cool, maybe I'll have another look at electron, but membrane is certainly intriguing. What I'd really like is a tree widget, but a quick look thru the docs didn't turn one up. Is there a way to call JavaFX stuff without too much ceremony? (Just looking for a high-level yes/no here, until I get a chance to really sit down with the docs).
short answer is not currently. You can embed membrane in a JavaFX UI, but it's not documented. For example, I've used membrane to build reveal widgets.
Ok, no biggie, the first project I'd like to work on would be porting a web app that builds a "tree widget" out of <div>s, so I expect I can do the same with membrane as-is.
https://github.com/HumbleUI/HumbleUI There's is also very raw but already useful framework build with skija bindings
Does anybody have any advice on testing with the cognitect/aws-api library? I don't want to have my tests actually call out to aws, and I'd like to be able to see the data I'm sending, as well as mock a response
i’d suggest just spinning up a localstack
container and “mocking” our aws instead
we use localstack too here in the aws pod for babashka: https://github.com/into-docker/unixsocket-http/issues/17 its using the aws-api lib too
given how accessible almost all services are nowadays with docker containers, community supported tools, etc, i generally think mocking out a 3rd party service (i.e. a database, kafka, aws, etc) is a fools-errand for testing
you’re more likely to waste more time mocking out and simulating those services than your are spinning them up in a container
Each invoke call should be passed in as a function taking the request and returning a response. This way, you've made the function pure and easily testable.
I am resurrecting a clojure project. When I try to run the uberjar it gives me class not found for main. It did work in the past. There is a genclass in the clj defining -main and a :main entry in project.clj. The uberjar manifest has a main class entry and that class defines a main function (per javap). My current theory is java having been updated in the interim. Is this plausible? What are the other possibilities? A search on Stack Overflow for main not found came up empty.
I usually don't generate a class for main, instead I use java -cp my-uber.jar clojure.main -m my.ns
to run the jar, relying on clojure's precompiled main
that said, if your main class is missing and that's actually a problem, then you need to use the :aot
config in lein, or :gen-class
to generate that main class - nothing creates it implicitly
The main class is there, I am just getting the error. I just looked at the Leiningen docs and they are still recommending Java 8. My default is Java 11. Is this the problem?
• (deleted erroneous message)
this has nothing to do with your java version
Relevant project.clj lines: > :main ^:skip-aot voting-server.core > :aot [voting-server.core]
^:skip-aot
is your problem
also you don't need the :aot
entry - it's implicit with :main
OK, when I sliced that out lein run failed is there a magic incantation for both?
that's a good question for #leiningen - I don't use lein run
so I'd have to do some research to answer
(and not using aot skips a lot of the worst parts of lein)
Still fails, same error
Also lein spit some warnings.
about not using AOT
I'm starting to think the thing that broke is that your project.clj doesn't work properly with newer lein
you can use lein upgrade <version>
to switch to the version of lein that was current when your project worked
(this is easy to undo via lein upgrade
which gives you the latest again)
OK, I will need to figure out what that version is. Are there notable changes in this area?
if it's feasible to change your process startup so it uses java -cp uber.jar clojure.main -m your.ns
that's an easy long term fix for all this nonsense
every lein release should have a version listed here: https://mvnrepository.com/artifact/leiningen/leiningen and they are all timestamped
This is a web server that should run as a systemd service. I'm not sure that is a feasible fix. What's the start point if you do that?
start point is clojure.main
if you need lifecycle support, I made a small java jsvc app that loads your clojure code based on a system property setting: https://github.com/noisesmith/clj-jsvc-adapter - may or may not be useful, my use case was wanting system level log management of stdio, start / stop / restart via normal system controls, without using aot in my clojure code (it's so small that a full rewrite for your own needs would likely take less than an hour)
Egg egg egg. It was leaving out the -jar to java
that would do it
I should have posted in beginners, I seem to be back there.
and I should have asked to see the exact command line you ran and the error message
While we are here. What is the issue with aot?
it violates the normal load / run / reload / run expectations of a repl based workflow
leads to "it worked on my machine, fails in ci" errors very frequently
makes the mental model needed to understand when things are evaluated more complex, leading to surprises
So, not an issue if you don't use repl?
if you don't use a repl I'm surprised there's any appeal to clojure - but it's more than that, it leads to a more complex evaluation model- I think that's the case even if you don't use a repl
but regardless, there's nothing in clojure that gets simpler when you aot, and many things that become more complex
(except maybe the need to use -cp
rather than -jar
on the command line, and explicitly stating the main class and entrypoint ns)
OK, thanks. This might not be hugely relevant in the future. I have fallen in love with Maybe types so I am not sure how much I will be doing with Clojure.
The warning suggested putting the aot in an uberjar profile. Which makes sense.
In any event, thanks very much.
i’ve been super pumped for iteration
since i learned it was going to be a thing, thanks for writing it! i’ve been copying the latest patch whenever i need the functionality :)
i agree with you that docstring is pretty chunky. it was one of the biggest blockers when i was introducing it to my coworkers. is there a reason you went with :kf
and :vf
instead of (something like) :next-key-fn
and :value-fn
which are akin to what data.json
offers?
@U02EA2T7FEH I think both Rich and I generally prefer succinct names
gotcha, figured it was something like that (though i’d still lobby for more expressive names 😄). thanks for the response!
(step! k) returns a "ret" -- could be anything (some? ret) = is there something here in this ret? (vf ret) = if so, extract that something -- useful when the ret is an "envelope" and you want the contents (kf ret) = get the k for next step! call ... call (step! k) again, repeat
@U4YGF4NGM oftentimes the call for fetching the first of a series of things (like consuming a paginated API) differs from fetching subsequent things
"opaque continuation data". At the beginning of the process, you don't have a k, therefore it is nil
by default (although you can override that with the :initk arg)
(defn list-log-groups
"list _all_ CloudWatch Log Groups, given an AWS client"
[client]
(->> (iteration
(fn [token]
(aws/invoke client (cond-> {:op :DescribeLogGroups}
token (merge {:request {:nextToken token}}))))
:kf :nextToken)
(mapcat :logGroups)))
I see. at first I thought it was a literal continuation i.e. a function that ought to be called when some async thing was done
https://github.com/clojure/clojure/commit/4a4a6e7717d411679820c4a3ce735a77aef45cc3 https://github.com/clojure/clojure/commit/c01f10bd8c68bd16c657fe352b206573f9306168 and https://github.com/clojure/clojure/commit/f5e5a4a7b8e0785436f0bbb9b91b6de9f754aa33 are the only ones that didn't make me want to see the diff
maybe if Maven central would stop sucking I could release a new alpha 🙁
Are there any tools for deps.edn that handle downloading/etc javadocs and sources jars for dependencies?
if you tap into a suitably low level of tools.deps, it is possible to request those things programmatically but the Clojure CLI doesn't have anything to do so
the https://github.com/clojure-emacs/enrich-classpath project has been doing some stuff with this lately
Yes it's working nicely, as bundled with CIDER. deps.edn compat is drafted in a PR, initially I was hoping to get a PR from anyone using deps.edn regularly (I use deps.edn through Lein). The PR itself works but it's 'MVP quality' - use at your own risk :) Finally it looks like I'll take said PR into my own hands, any day of these. cc/ @U3JH98J4R