all repos — nixfiles @ b22564bae8b4d7b62ff314456d55bbabfcdbed48

System and user configuration, managed by nix and home-manager

Emacs: delete-current-buffer-file should use vc-delete-file when appropriate
Alan Pearce alan@alanpearce.co.uk
Sat, 04 May 2013 09:14:04 +0100
commit

b22564bae8b4d7b62ff314456d55bbabfcdbed48

parent

7715d133347319dc8585601ac783faf2ee566f9d

1 files changed, 5 insertions(+), 3 deletions(-)

jump to
M emacs/init.elemacs/init.el
@@ -372,9 +372,11 @@ (name (buffer-name)))     (if (not (and filename (file-exists-p filename)))
         (ido-kill-buffer)
       (when (yes-or-no-p "Are you sure you want to remove this file? ")
-        (delete-file filename)
-        (kill-buffer buffer)
-        (message "File '%s' successfully removed" filename)))))
+        (if (vc-backend filename)
+            (vc-delete-file filename)
+          (delete-file filename)
+          (kill-buffer buffer)
+          (message "File '%s' successfully removed" filename))))))
 
 (use-package saveplace
   :defer t