How to invoke a function on all files in the git working tree, while opening the ones which have had no opened buffers beforehand?
A potential use case: Check and fix spelling in all project files with flyspell.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
This should work for some definition of "all files":
(defun my-mapc-tracked-files (fn) (magit-with-toplevel (mapc (lambda (file) (with-current-buffer (find-file-noselect file) (save-excursion (goto-char (point-min)) (funcall fn)))) (magit-list-files))))
You will have to pass a function to this function, like for