This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-06
Channels
- # announcements (14)
- # babashka (14)
- # beginners (22)
- # calva (56)
- # cider (20)
- # clerk (8)
- # clj-commons (10)
- # clj-kondo (18)
- # cljs-dev (11)
- # clojure (87)
- # clojure-conj (3)
- # clojure-europe (29)
- # clojure-nl (1)
- # clojure-poland (5)
- # clojure-portugal (1)
- # clojurescript (100)
- # data-science (3)
- # datahike (1)
- # datomic (13)
- # events (2)
- # fulcro (10)
- # funcool (2)
- # helix (19)
- # hoplon (6)
- # humbleui (2)
- # hyperfiddle (40)
- # leiningen (5)
- # lsp (22)
- # malli (26)
- # nrepl (2)
- # off-topic (19)
- # reagent (32)
- # releases (1)
- # shadow-cljs (266)
- # spacemacs (6)
- # tools-build (9)
- # vim (1)
Is there a way to send an eval output from a buffer to the osx clipboard easily? I can copy from the buffer with pbcopy but this crossed my mind as an alternative possibility.
Not exactly an emacs binding, but I do use this to have clojure use the java api to copy into the clipboard.
(defn to-clip [ s ]
(let [
string-selection (java.awt.datatransfer.StringSelection. s)
clipboard (.. (java.awt.Toolkit/getDefaultToolkit) (getSystemClipboard))
]
(.setContents clipboard string-selection nil)))
That’d work for me! I’ll give it a go. Thanks!
i just updated cider, and now when i press enter it adds a newline instead of evaluating code. this is also happening in the minibuffer with some cider commands, mainly undef symbol
anyone have this issue as well?
i think paredit changed some keybindings. Some details here: https://clojurians.slack.com/archives/C0617A8PQ/p1671790072091949
(I personally am a fan of newlines and control-j to send for eval but you can configure as you like)
my biggest problem is not being able to undef symbols, new lines are just a new thing that also happened around the same time i lost the ability to undef symbols
Yeah, that's coming from Paredit changes. Perhaps at some point I'll have CIDER override them, it's just kind of a bad practice for one library to change the defaults of another.
maybe I can disable paredit in the minibuffer. I haven't really configured that before, could paredit-everywhere-mode be a possible cause, or is there something else I should be looking at to fix this?
@U0LAJQLQ1 I’d say so. I just recently had to explicitly enable paredit for REPL, because I wanted the described behaviour. When paredit is disabled, enter evals..
(use-package paredit
:ensure t
:hook ((clojure-mode . paredit-mode)
(clojurec-mode . paredit-mode)
(clojurescript-mode . paredit-mode)
(cider-repl-mode . paredit-mode))
...
This is my config. Without cider-repl-mode-hook
it does what you want.thanks, my init.el already does what you suggested. my minibuffer is completely useless for many cider commands, and i don't think it's cider's fault. is there a way for me to see the minor-modes in the minibuffer? or is there some meta command i can use in the mini-buffer to get it to execute the commands i want? it is the case that only cider commands are breaking, and not all, mainly the undef command, but i assume that commands that require me to enter text will similarly break.
are there any examples of writing custom commands that wrap a defun or symbol in some extra stuff before evaluating?
e.g. if I wanted to bind a hotkey that evaled whatever symbol was under my cursor wrapped in (tap> ,,,)
Some examples of calling Portal Clojure commands from an Emacs interactive function using cider-nrepl-sync-request:eval
https://practical.li/clojure/data-inspector/portal/#editor-commands
Mine probably aren't as clean as John's, but I do have one where you can call it with C-u to bring up a list of viewers for the tapped thing to display as https://github.com/cwchriswilliams/emacs-2023/blob/main/post-init.org#portal-extensions (these are particularly if you're using Portal, I should add)
If you just want to tap>
there's already cider-tap-sexp-at-point
and cider-tap-last-sexp
in the latest cider release.
The https://github.com/clojure-emacs/cider/blob/68709bc29b81fdd0b9d2cb8089cdd43a429a685f/cider-eval.el#L1036-L1045 is also very simple in case you want to customise it a bit. E.g. I have https://github.com/dakra/dmacs/blob/6dce0b73318a3b6666afa1b1aea502083e576b48/init.org?plain=1#L5723-L5736 in my config to tap the last sexp to clerk for their vega-lite viewer.
Awesome. I didn't know that had been added. 👍
@UFAP0C8KU I was able to crib off of those built in functions to do what I wanted. Thanks!