I am using combination of following solutions in order to find-and-replace matched text in all Python files:
Using Emacs to recursively find and replace in text files not already open
How can I recursively find and replace in the current git repository
I observe that when I want to replace capital words like "HELLO_WORLD" , it also replaces hello_world string as well.
(setq case-fold-search nil) (defun find-and-replace () (interactive) (message "press t to toggle mark for all files found && Press Q for Query-Replace in Files...") (find-dired (vc-git-root (buffer-file-name)) "-name \\*.py -o ! -name flycheck_\\*.py ! -name __init__.py ! -name \".*\" ! -name build ! -path \\*/.eggs/\\*")) M-x find-and-replace ; then t to toggle marked/unmarked files (thus marking them all, since none were marked). Then I use Q to use query-replace on the marked files. And enter HELLO_WORLD to replace with WORLD_HELLO.
How can I fix find-and-replace to work in case-sensetive?
case-fold-searchtonil?(setq case-fold-search nil)in my init file(setq case-fold-search nil)is wrong in the init file. You must use(setq-default case-fold-search nil)sincecase-fold-searchis a buffer-local variable. The setting(setq case-fold-search nil)just affects the single buffer where the init file is evaluated.(setq-default case-fold-search nil)solved my probles, please feel free to make it and answer. In generat I always usesetqinstad ofsetq-defaultlike(setq message-log-max t)in my init file. Should I usesetq-defaultinstead ?