emacs

Consider also joining #cider, #lsp and #inf-clojure, where most of the tool-specific discussions are happening.
2021-03-12T19:06:34.050600Z

Here's a puzzler for someone. I need to change this

[datomic.api ...][wrapper.datomic.api ...]
to this
[datomic.api ...]
            [wrapper.datomic.api ...]
in 217 different files. I tried helm-ag-edit, but it didn't let me create newlines. Is there an easy way to do this in emacs?

dotemacs 2021-03-15T09:15:22.062400Z

Don’t know about that package, but if you’re entering a newline try C-q C-j, it should enter a newline. But you can also do this, if you’re just replacing a ][ with ]\n[: M-x replace-regexp RET ][ RET ] C-q C-j[ RET

2021-03-16T19:39:10.006500Z

Nice, that would have been great for adding the newline. I ended up using sed and then manually indenting each file. Thanks for the suggestion!

mpenet 2021-03-12T19:11:10.051900Z

consult-git-grep + embark occur, then wgrep on the occur buffer

lukasz 2021-03-12T19:11:13.052Z

sed? :-)

2021-03-12T19:14:32.052100Z

Yeah, something like this is my fallback. I was just hoping I wouldn't have to write code for it. I have to learn sed over from scratch every time I use it. 🙂

2021-03-12T19:15:46.052300Z

I've never heard of these. I'll look into them. Thanks!

2021-03-12T19:18:16.052500Z

At least some ways of doing string search and replace in Emacs let you type Ctrl-Q Ctrl-J in the middle of a replacement string to mean a newline

2021-03-12T19:18:33.052700Z

well, anywhere in the replacement string I mean, not just the middle.

2021-03-12T19:19:20.052900Z

Ctrl-Q being an Emacs 'escape' character prefix kind of thing, and Ctrl-J being the ASCII code for a newline

1
lukasz 2021-03-12T19:23:43.053100Z

I had to write a post-it note with the C-q C-j thing as I never remembered it. @bmaddy other (I'd say preferable) approach is to get the cljstyle binary and run it against the whole codebase.

2021-03-12T19:31:54.053300Z

I just tried the c-q c-j thing in helm-ag-edit. Sadly, the newline it adds doesn't make it to the actual edit, so the line just gets truncated. Good idea though and I'm really happy to have found that key combo! I've been trying to figure that out for years. 😂