This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-15
Channels
- # announcements (8)
- # architecture (9)
- # autochrome-github (1)
- # babashka (48)
- # beginners (55)
- # calva (36)
- # cider (16)
- # clj-commons (1)
- # clj-kondo (38)
- # cljs-dev (44)
- # cljsrn (1)
- # clojure (164)
- # clojure-europe (35)
- # clojure-nl (2)
- # clojure-norway (10)
- # clojure-uk (23)
- # clojurescript (50)
- # conjure (24)
- # core-async (1)
- # cryogen (2)
- # cursive (38)
- # datalevin (11)
- # datascript (2)
- # datomic (13)
- # duct (1)
- # emacs (16)
- # events (12)
- # exercism (3)
- # figwheel-main (7)
- # fulcro (26)
- # honeysql (5)
- # integrant (1)
- # jobs (3)
- # kaocha (6)
- # lsp (72)
- # malli (22)
- # nextjournal (35)
- # nrepl (1)
- # off-topic (34)
- # pathom (5)
- # polylith (8)
- # portal (40)
- # re-frame (14)
- # reagent (42)
- # reitit (1)
- # releases (1)
- # remote-jobs (1)
- # reveal (9)
- # sci (2)
- # shadow-cljs (13)
- # sql (3)
- # tools-deps (33)
- # vim (25)
hey, I'm finally ready to try portal, and I have two questions:
1. I usually start my workflow by doing cider-jack-in-clj
in a deps.edn
project. The way I should use portal is including it in deps.edn
and then use the API to open one, right? (I ask because the readme gives instructions to fire up a standalone repl, but maybe I should use the cider one?
2. Is there a way of changing the keybindings for some of the It doesn't seems so for now.portal
UI shortcuts?
If you have portal in deps.edn you can either start the repl from cider or externally. If you don't want to add portal to every project, you can also create an alias containing portal in your ~/.clojure/deps.edn
file and set cider-clojure-cli-global-options
to "-M:your-alias"
and in that case you need to start the repl from cider (or remember to add the alias when firing the standalone repl).
Is there a way to call the portal.ui.commands
commands from emacs itself? That way I wouldn't need more shortcuts because I can just script the behavior via emacs (and that would allow me to never move focus)
user=> (require '[portal.ui.commands :as ui])
Execution error (FileNotFoundException) at user/eval2242 (REPL:1).
Could not locate portal/ui/commands__init.class, portal/ui/commands.clj or portal/ui/commands.cljc on classpath.
edit: maybe I wasn't clear, sorry, I'll rephrase; we can already do something like:
(defun portal.api/open ()
(interactive)
(cider-nrepl-sync-request:eval
"(require 'portal.api) (portal.api/tap) (portal.api/open)"))
to open a portal window from emacs. It would be cool if I could just call, via cider-nrepl-sync-request:eval
, portal.ui.commands/select-next
(bound to a key in emacs) and see the portal UI change focus.Looks like you didn't have Portal on the classpath used when starting that REPL.
I see, I did start the repl with:
$ clj -Sdeps '{:deps {djblue/portal {:mvn/version "0.20.1"}}}'
and I though that gave me access to all of portal. What am I missing?Oh, I misread the require. Yeah, that part is in the ClojureScript frontend of Portal. There is a way to run commands... let me dig that up...
Ah, I think you can only do things exposed through portal.api
...
...and that's pretty limited, as I recall.
I have a key bound to evaluate (portal.api/clear)
for example but I don't think much of the navigation is exposed yet?
Oh, you can use (portal.api/eval-str "...")
to evaluate strings in the cljs UI -- that'll do what you need I think
what's wrong with:
(portal.api/eval-str "(do (require 'portal.ui.commands) (portal.ui.commands/select-parent))")
No idea. I've never tried eval-str
-- I think it was a recent addition? @djblue?
So eval-str is the correct path, however the main issue is I can't seem to access the the reagent atom via sci :thinking_face:
(portal.api/eval-str "(do (require 'portal.ui.commands) (portal.ui.commands/select-parent portal.ui.state/state))")
Is more like it. I'll look into why this doesn't want to work.@UA7E6DU04 I think the latest release https://github.com/djblue/portal/releases/tag/0.21.0 should allow you to control the Portal UI via emacs π
This is awesome @djblue! Your last command surely works for me the first time, but if I try to do it two times in a row, nothing happens and then I get Portal request timeout
Try:
(portal.api/eval-str "(portal.ui.commands/select-parent portal.ui.state/state)")
insteaduser=> (portal.api/eval-str "(portal.ui.commands/select-parent portal.ui.state/state)")
Execution error (ExceptionInfo) at portal.runtime.jvm.client/request (client.clj:53).
Portal request timeout
I'm on linux (nixOS) if this might helpI've been using my local dev version, but can reproduce when I switch to the production build :thumbsup:
@UA7E6DU04 I have another https://github.com/djblue/portal/runs/5225480116?check_suite_focus=true going out that should fix this
@UA7E6DU04 If it is alright with you, I would be very interested in seeing your emacs config. Sounds like you'd have a lot of the things configured that I've been wanting to do!
(And haven't yet justified the time to configure.) I'm pretty overdue for a "sharpening the axe" session with emacs.
Looking forward to it π
Ok, sorry for the delay, here we are ^: this is my newest config.el
(I use doom
emacs). I distilled it down from a more bloated config.el
which I was a bit unsatisfied about. Also this new is almost entirely clojure-related, so that's a plus
No idea. I've never tried eval-str
-- I think it was a recent addition? @djblue?