Liking cljdoc? Tell your friends :D

Emacs

If you are an emacs + cider user and would like tighter integration with portal, the following section may be of interest to you.

;; Leverage an existing cider nrepl connection to evaluate portal.api functions
;; and map them to convenient key bindings.

;; def portal to the dev namespace to allow dereferencing via @dev/portal
(defun portal.api/open ()
  (interactive)
  (cider-nrepl-sync-request:eval
    "(do (ns dev) (def portal ((requiring-resolve 'portal.api/open))) (add-tap (requiring-resolve 'portal.api/submit)))"))

(defun portal.api/clear ()
  (interactive)
  (cider-nrepl-sync-request:eval "(portal.api/clear)"))

(defun portal.api/close ()
  (interactive)
  (cider-nrepl-sync-request:eval "(portal.api/close)"))

;; Example key mappings for doom emacs
(map! :map clojure-mode-map
      ;; cmd  + o
      :n "s-o" #'portal.api/open
      ;; ctrl + l
      :n "C-l" #'portal.api/clear)

;; NOTE: You do need to have portal on the class path and the easiest way I know
;; how is via a clj user or project alias.
(setq cider-clojure-cli-global-options "-A:portal")

xwidget-webkit embed

Screen Shot 2022-10-15 at 2 45 29 PM

If you would like to run the Portal UI in emacs itself, you can do so with the following code.

Note You need a build of emacs with Embedded-WebKit-Widgets

(portal.api/open {:launcher :emacs})

Warning I haven't tested this extensively so you might run into some weird issues

Can you improve this documentation? These fine people already did:
Chris Badahdah & Mark Schmele
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close