From e16ec5ae94595a186c531c5579a12f9b148b750e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 31 Jan 2018 05:08:25 -0500 Subject: [PATCH] tool/dired: don't kill git process to abruptly This would leave behind index.lock files. This may potentially fix #389. --- modules/tools/dired/config.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/tools/dired/config.el b/modules/tools/dired/config.el index 452d5c925..4bccd2932 100644 --- a/modules/tools/dired/config.el +++ b/modules/tools/dired/config.el @@ -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)