| ▲ | skydhash 7 days ago |
| I supposed you haven’t tried emacs grep mode or vim quickfix? If the change is mechanical, you create a macro and be done in seconds. If it’s not, you still got the high level overview and quick navigation. |
|
| ▲ | kfajdsl 7 days ago | parent | next [-] |
| Finding and jumping to all the places is usually easy, but non trivial changes often require some understanding of the code beyond just line based regex replace. I could probably spend some time recording a macro that handles all the edge cases, or use some kind of AST based search and replace, but cursor agent does it just fine in the background. |
| |
| ▲ | skydhash 7 days ago | parent [-] | | Code structure is simple. Semantics is where it get tough. So if you have a good understanding of the code (and even when you don't), the overview you get from one of those tools (and the added interactivity) is nice for confirming (understanding) the needed actions that needs to be done. > cursor agent does it just fine in the background That's for a very broad definition of fine. And you still need to review the diff and check the surrounding context of each chunk. I don't see the improvement in metrics like productivity and cognitive load. Especially if you need to do serveral rounds. | | |
| ▲ | kfajdsl 7 days ago | parent [-] | | You mentioned grep-mode, which to my knowledge is just bringing up a buffer with all the matches for a regex and easily jumping to each point (I use rg.el myself). For the record, this is basically the same thing as VSCode's search tool. Now, once you have that, to actually make edits, you have to record a macro to apply at each point or just manually do the edit yourself, no? I don't pretend LLMs are perfect, but I certainly think using one is a much better experience for this kind of refactoring than those two options. | | |
| ▲ | skydhash 7 days ago | parent [-] | | Maybe it's my personal workflow, but I either have sweeping changes (variable names, removing dependencies) which are easily macroable, or very targeted one (extracting functions, decoupling stuff,..,). For both, this navigation is a superpower and coupled with the other tools of emacs/vim, edit is very fast. That rely on a very good mental model of the code, but any question can be answered quickly with the above tools. For me, it's like having a moodboard with code listings. | | |
| ▲ | Karrot_Kream 7 days ago | parent [-] | | Yes I've done this kind of refactoring for ages using emacs macros and grep. Language Server and tree-sitter in emacs has made this faster (when I can get all the dependencies setup correctly that is.) Variable name edits and function extraction is pretty much table stakes in most modern editors like IntelliJ, VSCode, Zed, etc. IIRC Eclipse had this capability 15-20 years ago. I used to have more patience for doing it the grep/macro way in emacs. It used to feel a bit zen, like going through the code and changing all the call-sites to use my new refactor or something. But I've been coding for too long to feel this zen any longer, and my own expectations for output have gotten higher with tools like language-server and tree-sitter. The kind of refactorings I turn to an LLM for are different, like creating interfaces/traits out of structs or joining two different modules together. |
|
|
|
|
|
| ▲ | citizenpaul 7 days ago | parent | prev | next [-] |
| I'm decent at that kind of stuff. However thats not really what I'm talking about. For instance today I needed two logic flows. One for data flowing in one direction. Then a basically but not quite reversed version of the same logic for when the data comes back. I was able to write the first version then tell the LLM "Now duplicate this code but invert the logic for data flowing in the opposite direction." I'm simplifying this whole example obviously but that was the basic task I was working on. It was able to spit out in a few seconds what would have taken me probably more than an hour and at least one tedium headache break. I'm not aware of any pre LLM way to do something like that. Or a little while back I was implementing a basic login/auth for a website. I was experimenting with high output token LLM's (i'm not sure that's the technical term) and asked it to make a very comprehensive login handler. I had to stop it somewhere in the triple digits of cases and functions. Perhaps not a great "pro" example of LLM but even though it was a hilariously over complex setup it did give me some ideas I hadn't thought about. I didn't use any of the code though. Its far from the magic LLM sellers want us to believe but it can save time same as various emac/vim tricks can to devs that want to learn them. |
|
| ▲ | Karrot_Kream 7 days ago | parent | prev [-] |
| emacs macros aren't the same. You need to look at the file, observe a pattern, then start recording the macro and hope the pattern holds. An LLM can just do this. |
| |
| ▲ | skydhash 7 days ago | parent [-] | | And that's why I mentionned grep-mode, and such other tools. Here is some videos about what I'm talking about https://youtu.be/f2mQXNnChwc?t=2135 https://youtu.be/zxS3zXwV0PU And for Vim https://youtu.be/wOdL2T4hANk Standard search and replace in other tools pales in comparison. | | |
| ▲ | Karrot_Kream 7 days ago | parent [-] | | I am familiar with grep-mode and have used that and macro recording for years. I've been using emacs for 20 years. grep-mode (these days I use rg) just brings up all the matches which lets me use a macro that I recorded. That's not the same as telling Claude Code to just make the change. Macros aren't table stakes but find-replace across projects is table stakes in pretty much any post-emacs/vim code editor (and both emacs and vimlikes obviously have plenty of support for this.) |
|
|