This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-16
Channels
- # adventofcode (1)
- # announcements (16)
- # babashka (7)
- # beginners (77)
- # calva (31)
- # cider (18)
- # clj-commons (16)
- # cljfx (5)
- # clojars (5)
- # clojure (33)
- # clojure-europe (15)
- # clojure-nl (1)
- # clojure-norway (15)
- # clojure-uk (4)
- # clojurescript (1)
- # conjure (1)
- # core-logic (7)
- # cursive (16)
- # data-science (4)
- # datalevin (6)
- # emacs (20)
- # events (5)
- # fulcro (15)
- # holy-lambda (1)
- # introduce-yourself (1)
- # jobs (2)
- # lsp (30)
- # luminus (3)
- # malli (3)
- # membrane-term (19)
- # missionary (62)
- # off-topic (39)
- # pathom (24)
- # polylith (5)
- # portal (9)
- # practicalli (3)
- # re-frame (16)
- # reagent (5)
- # remote-jobs (1)
- # reveal (21)
- # rewrite-clj (8)
- # shadow-cljs (13)
- # spacemacs (23)
- # sql (12)
- # timbre (2)
- # tools-deps (1)
- # xtdb (4)
Not really a Clojure article, but some of you here might find it interesting https://batsov.com/articles/2021/11/16/why-emacs-redux/
Nice retrospective! My two cents: Emacs is the ultimate user interface to your computer, because every interaction with the computer should have all the editing capabilities of a powerful editor.
Since cider-eval-last-sexpr
is async, not sure how to get the result to then create some custom elisp code
while there's an elisp approach, you could also wrap the evaled code with clojure code that performed the clipboarding 'server-side' https://github.com/exupero/clipboard has worked just fine for me
yeah, it should work, although I'd like a more elisp way, even so thank you for the suggestion :)
simpleclip
also worked for me for elisp stuff, for a long time. can't offer help myself with cider handlers unfortunately (I use an odd stack).
digging into their source shouldn't be too hard
sure there's cider-nrepl-sync-request:eval
, you'll have to study a bit how to call it. it's not too hard iirc
I just found a easier way that IMO could go to cider code :)
(defun cider-eval-clipboard-handler ()
(nrepl-make-response-handler
(current-buffer)
(lambda (buffer value)
(with-current-buffer buffer
(with-temp-buffer
(insert value)
(clipboard-kill-region (point-min) (point-max)))))
(lambda (_buffer out)
(cider-emit-interactive-eval-output out))
(lambda (_buffer err)
(cider-emit-interactive-eval-err-output err))
'()))
(defun cider-eval-last-sexpr-and-copy-to-clipboard ()
(interactive)
(cider-interactive-eval nil
(cider-eval-clipboard-handler)
(cider-last-sexp 'bounds)
(cider--nrepl-pr-request-map)))
it needs some improvements, like copy to clipboard and print as well, but it works
Just keep in mind that the this gets called once for each chunk of the response, so for a bigger result you might end up with only part of the response in the clipboard.
Probably not a big deal in the most cases, but it might surprise you in certain situations.