I am working inside a git-repo. Here I want to apply my search operation based on the root directory of the git repo that current buffer is open.
Here I do: find-dired "~/my_project" ...
in order to replace all Python files.
(defun my-find-files ()
(interactive)
(message "press t to toggle mark for all files found && Press Q for Query-Replace in Files...")
(find-dired "~/my_project" "-name \\*.py ! -name flycheck_\\*.py ! -name __init__.py"))
(global-set-key (kbd "M-z") 'my-find-files)
Instead how can I set "~/my_project"
folder path dynamically based on the current buffer's root git repo.
git rev-parse --show-toplevel
returns the root of the git repository where the file lives. I was wondering would it be possible to pass its return value instead of "~/my_project"
?
Related: Using Emacs to recursively find and replace in text files not already open