Make delete-file-and-buffer vc aware

This commit is contained in:
Bozhidar Batsov 2013-04-03 12:53:37 +03:00
parent 7ba3dc16dd
commit 89876777f9
2 changed files with 7 additions and 3 deletions

View file

@ -197,9 +197,12 @@ there's a region, all lines that region covers will be duplicated."
(interactive) (interactive)
(let ((filename (buffer-file-name))) (let ((filename (buffer-file-name)))
(when filename (when filename
(if (vc-backend filename)
(vc-delete-file filename)
(progn
(delete-file filename) (delete-file filename)
(message "Deleted file %s" filename))) (message "Deleted file %s" filename)
(kill-buffer)) (kill-buffer))))))
(defun prelude-view-url () (defun prelude-view-url ()
"Open a new buffer containing the contents of URL." "Open a new buffer containing the contents of URL."

View file

@ -51,6 +51,7 @@
(define-key map (kbd "C-c u") 'prelude-view-url) (define-key map (kbd "C-c u") 'prelude-view-url)
(define-key map (kbd "C-c e") 'prelude-eval-and-replace) (define-key map (kbd "C-c e") 'prelude-eval-and-replace)
(define-key map (kbd "C-c s") 'prelude-swap-windows) (define-key map (kbd "C-c s") 'prelude-swap-windows)
(define-key map (kbd "C-c D") 'prelude-delete-file-and-buffer)
(define-key map (kbd "C-c d") 'prelude-duplicate-current-line-or-region) (define-key map (kbd "C-c d") 'prelude-duplicate-current-line-or-region)
(define-key map (kbd "C-c r") 'prelude-rename-file-and-buffer) (define-key map (kbd "C-c r") 'prelude-rename-file-and-buffer)
(define-key map (kbd "C-c t") 'prelude-visit-term-buffer) (define-key map (kbd "C-c t") 'prelude-visit-term-buffer)