tool/dired: don't kill git process to abruptly

This would leave behind index.lock files. This may potentially fix #389.
This commit is contained in:
Henrik Lissner 2018-01-31 05:08:25 -05:00
parent d01deb5545
commit e16ec5ae94
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -47,6 +47,14 @@
(add-hook 'dired-initial-position-hook #'dired-k)
(add-hook 'dired-after-readin-hook #'dired-k-no-revert)
(defun +dired*interrupt-process (orig-fn &rest args)
"Fixes dired-k killing git processes too abruptly, leaving behind disruptive
.git/index.lock files."
(cl-letf (((symbol-function #'kill-process)
(symbol-function #'interrupt-process)))
(apply orig-fn args)))
(advice-add #'dired-k--start-git-status :around #'+dired*interrupt-process)
(defun +dired*dired-k-highlight (orig-fn &rest args)
"Butt out if the requested directory is remote (i.e. through tramp)."
(unless (file-remote-p default-directory)