Fork me on GitHub
#portal
<
2021-11-16
>
Ben Sless13:11:59

Managed to embed portal in emacs!

(require '[portal.runtime.shell :as shell]
         '[portal.api :as portal]
         '[portal.runtime.browser :as browser])

(defmethod browser/-open :emacs/xwidget [{:keys [portal options server]}]
  (let [url (pr-str (str "http://" (:host server) ":" (:port server) "?" (:session-id portal)))]
    (shell/sh "emacsclient" "-e" (str "(xwidget-webkit-browse-url" url ")"))))


(portal/open {:launcher :emacs/xwidget})

🎉 4
🙌 2
djblue16:11:18

This is awesome! I do get *ERROR*: Your Emacs was not compiled with xwidgets support when I try this launcher. I wonder if brew has a build of emacs with xwidgets :thinking_face:

djblue16:11:09

I'm still happy to add this directly to portal if you want to submit a PR :thumbsup:

Ben Sless17:11:23

While it does work, the user experience around it is meh/10, so I wouldn't add it until that was figured out, unless you'd like me to PR it as an experimental extension

djblue17:11:49

I'll see if I can get it working. If the meh experience is due to performance, that might be able to improve. And improving perf would make it better in all other browsers.

Ben Sless18:11:53

I don't think it's performance, you'll probably try it yourself later today and see

Ben Sless13:11:10

Flickers a bit

djblue18:11:50

If anyone has ideas on how portal interactions could be used to generate code and would like to share, please comment on this https://github.com/djblue/portal/issues/77.