Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs find-and-replace regex in multiple files (find-name-dired + Q), doesn't save my buffers?

Tags:

emacs

I can't figure out what's going on here. I've done a search and replace across a whole directory, using:

  1. M-x find-name-dired RET
  2. Select root of my project
  3. Enter *.rb as the filenames to match
  4. Press "t" to select all files found
  5. Press "Q" (shift Q) to start the search/replace
  6. Enter "transaction" as the query, then enter "invoice" as the replacement

Now I've cycled through all the buffers it opens for me, selectively press "y" or "n" depending on the replacement. When it finished, it just left me in the last buffer I had changed.

So, hitting C-z to background the emacs window and check what has changed, shows that none of the files are saved, which I expected.

So then I did M-x save-some-buffers RET, which tells me there are no files to be saved. So I start rotating through my buffers with C-x b and verify that, yes indeed, the buffers do have changes compared to what is on disk.

So I repeat the process, this time with a completely fresh emacs process (no open buffers at all when I start the process). At the end I have a bunch of buffers open, with changes (that I can see), yet again, emacs says there's nothing to save.

So I tried using C-x C-b to bring up IBuffer. Marked all the files I wanted to save, then hit "S" to save them, at which point it shows "Operation finished; saved 27 buffers". Awesome... except git is still telling me that emacs has in fact saved nothing.

What am I doing wrong? I want to replace "transaction" with "invoice" across my entire project, though I do need to do it interactively, since there are some places where that replacement should not be done.

Emacs 23.

like image 938
d11wtq Avatar asked Nov 30 '11 05:11

d11wtq


1 Answers

I've reproed the behaviour you describe. Sure smells like a bug to me. Please report it at [email protected].

The Emacs contributors are very responsive.

P.S. Love the details you put into your question.

like image 64
event_jr Avatar answered Nov 09 '22 17:11

event_jr