emacs

Consider also joining #cider, #lsp and #inf-clojure, where most of the tool-specific discussions are happening.
teodorlu 2021-03-05T10:17:30.002500Z

Quick question. I find that using find . -iname '*.go' | xargs bat (or use cat instead of bat, if you don't care about syntax highlighting) is an excellent way to quickly read a bunch of files. There's one caveat: I can't treat it as an Emacs buffer. Are anyone else doing something similar to what I'm doing to "collect a bunch of files to read linearly"? Suggestions on how to "Emacsify" the workflow? Thanks!

teodorlu 2021-03-06T16:30:48.010200Z

https://clojurians.slack.com/archives/C099W16KZ/p1614955438005200?thread_ts=1614939450.002500&cid=C099W16KZ Would that leave me a complete listing of a subset of files? Running M-x grep left me an option to grep, but I'm not sure how this helps me read a bunch of files linearly in a project.

teodorlu 2021-03-06T16:33:54.010800Z

https://clojurians.slack.com/archives/C099W16KZ/p1614955531005800?thread_ts=1614939450.002500&cid=C099W16KZ I've been thinking something along these lines.

find . -iname '*.go' | orgcat &gt; <http://summary.org|summary.org>
Where orgcat is an Emacs Lisp script that reads file contents, and creates an org-mode file with approperiate #BEGIN_SRC lang blocks for the files.

teodorlu 2021-03-06T16:34:13.011100Z

(I haven't made any attempts to write orgcat yet)

ag 2021-03-06T20:47:21.014800Z

@teodorlu if you need the output of a command in a buffer, one way could be running shell-command-on-region in a buffer with a prefix basically, create an empty buffer in the project, and run C-u M-| then type your command find . -iname '*.go' | xargs bat the output of the command will be yanked into the buffer

👍 2
ag 2021-03-06T20:50:08.015100Z

but if I understand it right, you're simply trying to have "occur" buffer with the files. Ivy-occur, or helm-occur.

1
teodorlu 2021-03-06T20:53:10.015400Z

I might have to read up on occur.

ag 2021-03-06T20:53:15.015600Z

depending of what you use, helm-rg or counsel-rg - they both can be called with a prefix

ag 2021-03-06T20:53:50.015800Z

that way you can pass any arbitrary command line params to rg (cmd utility)

Phil Shapiro 2021-03-06T20:59:21.017900Z

Eshell is a shell for emacs that lets you do a lot of interesting things, including redirect the output of a shell command to a buffer. https://www.gnu.org/software/emacs/manual/html_mono/eshell.html

Phil Shapiro 2021-03-06T21:02:23.020400Z

But if you want to process the output of a command like grep, using compile mode might be best. M-x compile RET and replace the default compile command with the thing you want it run.

1
ag 2021-03-06T21:06:19.020600Z

ivy, and helm are the best for the output of grep, rg, ag, etc. Once you have the occurrences, you can call occur-mode command, i.e. C-c C-o in ivy/counsel buffer

ag 2021-03-06T21:10:12.020800Z

👍 1
vemv 2021-03-05T11:04:48.002600Z

from a quick googling, it looks like emacs can't make a buffer out of stdin directly So maybe I'd persist find . -iname '*.go' | xargs bat to a tmp file and open that

teodorlu 2021-03-05T11:33:59.002800Z

Good point. I suppose I'd loose syntax highlighting then?

teodorlu 2021-03-05T11:34:54.003Z

:thinking_face: It might not be too hard to write a script that takes a list of filenames as input, and produces an org-mode file with those files listed.

vemv 2021-03-05T11:52:48.003200Z

> Good point. I suppose I'd loose syntax highlighting then? You can always M-x clojure-mode (or w/e mode it is) to activate it

👍 1
teodorlu 2021-03-05T12:01:22.003500Z

Good point. Or save the temp file with the right extension. :thinking_face:

danielneal 2021-03-05T12:26:31.004300Z

For some reason my .dir-locals.el with my cider-clojure-cli-global-options have stopped being picked up

danielneal 2021-03-05T12:26:40.004600Z

anyone have any ideas why that might have happened

danielneal 2021-03-05T12:27:06.005100Z

atm I'm doing C-u M-x cider-jack-in and typing in the options manually like a caveman

2021-03-05T14:43:58.005200Z

Does M-x grep using the -r recursive option to grep do what you need? Or does it include files that you want to leave out?

1
2021-03-05T14:44:37.005400Z

I have heard that Emacs packages like projectile and a few others might be able to help you create sets of files to operate upon that might be useful here, but I haven't tried it myself.

👍 1
2021-03-05T14:45:31.005800Z

If you take the output of the find ... xargs grep command you mentioned, and put it into an Emacs buffer, and then change its mode to whatever the minor/major mode is used for M-x grep output, (maybe compilation-mode? I forget), then it might let you step forward and backward to found lines quickly.

1
dpsutton 2021-03-05T15:24:44.007Z

@danieleneal there was a version of cider that removed them and then later they were re added. What is the contents of them?

danielneal 2021-03-05T15:33:00.007200Z

((clojure-mode . ((cider-clojure-cli-global-options . "-A:dev:test"))))

danielneal 2021-03-05T15:33:08.007400Z

I'm on cider 1.0.0

danielneal 2021-03-05T15:33:57.007700Z

but if I do describe-variable cider-clojure-cli-global-options its nil

dpsutton 2021-03-05T15:50:07.007800Z

Try (hack-local-variables)

danielneal 2021-03-05T16:00:57.008Z

yeah, that sets it

danielneal 2021-03-05T16:01:05.008400Z

how does that work?

dpsutton 2021-03-05T16:05:17.009100Z

that just kinda refreshes the dir locals stuff. it's a way to slap the top of emacs like you would slap an appliance to make it work

danielneal 2021-03-05T16:51:15.009300Z

😂 😂

danielneal 2021-03-05T16:56:50.009500Z

https://www.youtube.com/watch?v=tAGlUUAmjxk

😂 3
grazfather 2021-03-05T17:05:33.009900Z

hahaha that guy is from snatch