Fork me on GitHub

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!


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


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


: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.


> 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

👍 3

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


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?


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.

👍 3

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.

teodorlu16:03:48;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.

teodorlu16:03:54;cid=C099W16KZ I've been thinking something along these lines.

find . -iname '*.go' | orgcat > 
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.


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


@U3X7174KS 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

👍 6

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


I might have to read up on occur.


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


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

Phil Shapiro20:03:21

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.

Phil Shapiro21:03:23

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.


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


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


anyone have any ideas why that might have happened


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


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


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


I'm on cider 1.0.0


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


Try (hack-local-variables)


yeah, that sets it


how does that work?


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


hahaha that guy is from snatch