Just a quickie. I was browsing around in Aaron Hawley’s Giant Emacs Reference Sheet when I came across this little ditty:
C-x d *.c RET Q int RET long
It was described as “replace ‘long’ for ‘int’ in .c files.” I thought, “Boy, that’s really handy” and then I realized that it’s just
- Enter
diredand list all the .c files - Do a query replace substituting
longforint
something that I’ve probably blogged about in the past.
Still, it does seem to gain power when you think of it as one command. And, if for only a moment, I thought I’d found something new and wonderful.
I like how
*.c REThas exactly the same effect from within dired as it does at theC-x dprompt, even though it’s for different reasons (filename globbing vs dired-mark-extension). I never really useC-x dto invoke dired, so I hadn’t noticed this nice piece of consistency before.My apologies, it’s not exactly the same effect. It is pleasingly similar, though!
And what a great way to make all your “printf” into “prlongf”.
Q does a query replace, so you’d have to actively work to make that happen. ;-)
The
*.cdidn’t work for me but I had not got dired-x loaded.M-x load-library RET dired-x RET