>> I think the only possible problem here is that lambda is invoked >> asynchronously. But we can sleep while waiting for it. > > Would it be possible to call dir-status-files synchronously? If asynchronousness is inevitable, we could rely on callbacks. Indeed this path leads to callback hell, but what are other options? This unfinished patch shows a possible development direction: vc-next-action executed in Dired will call vc-dired-deduce-fileset with a callback to continue with a prepared vc-fileset. vc-dired-deduce-fileset will call a more general vc-directory-deduce-fileset that will call a currently unimplemented function vc-dir-status-files whose implementation will be like in your diff-hl-dired-update. Also a new command vc-next-action-on-root will commit all modified files, ignoring any unregistered files. I miss such a command in VC-Dir: typing 'v' (vc-next-action) at the beginning of *vc-dir* buffer signals the error: "When applying VC operations to multiple files, the files are required to be in similar VC states. File in state 'edited' clashes with state 'unregistered'". Often I have a lot of unregistered files lying around for a long time, and it takes too much time manually marking only edited files for every commit, skipping each unregistered file. Also some parts of the previous patch should be reverted because I discovered that state changing VC operations in Dired even on marked files (as opposed to directories) is unreliable: when a file is modified, using vc-state doesn't return its real state when updated outside of Emacs. This part should be replaced with asynchronous dir-status-files that returns the most accurate state.