This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-05
Channels
- # announcements (8)
- # asami (70)
- # babashka (28)
- # beginners (163)
- # calva (7)
- # cider (15)
- # clj-kondo (47)
- # cljs-dev (45)
- # clojars (2)
- # clojure (56)
- # clojure-europe (24)
- # clojure-italy (1)
- # clojure-losangeles (2)
- # clojure-nl (4)
- # clojure-spec (2)
- # clojure-uk (53)
- # clojurescript (46)
- # data-oriented-programming (15)
- # data-science (10)
- # datahike (2)
- # defnpodcast (1)
- # depstar (27)
- # emacs (35)
- # figwheel-main (28)
- # fulcro (38)
- # girouette (1)
- # graphql (16)
- # jobs-discuss (3)
- # kaocha (9)
- # keechma (2)
- # leiningen (6)
- # lsp (87)
- # malli (19)
- # membrane (16)
- # pathom (4)
- # re-frame (11)
- # shadow-cljs (25)
- # spacemacs (2)
- # testing (12)
- # tools-deps (14)
- # tree-sitter (4)
- # xtdb (20)
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
: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
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.
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.
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.
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 >
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.@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
but if I understand it right, you're simply trying to have "occur" buffer with the files. Ivy-occur, or helm-occur.
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
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
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