-
Notifications
You must be signed in to change notification settings - Fork 0
/
aph-vc.el
executable file
·56 lines (42 loc) · 2.04 KB
/
aph-vc.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
;;; aph-vc.el --- Extensions for `vc' -*- lexical-binding: t; -*-
;; Copyright (C) 2016 Aaron Harris
;; Author: Aaron Harris <[email protected]>
;; Keywords: vc tools
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Functions and commands extending those found in the `vc' module
;; built into Emacs.
;;; Code:
(require 'vc)
;;;###autoload
(defun aph/vc-delete-file (file)
"As `vc-delete-file', but delete unregistered files.
If the command `vc-delete-file' is invoked on a file which is not
under version control, an error is signaled. This command
instead deletes the file, requesting confirmation from the user.
In all other circumstances, it behaves as `vc-delete-file'."
(interactive (list (read-file-name "VC delete file: " nil
(when (vc-backend buffer-file-name)
buffer-file-name) t)))
(cond
((vc-backend (expand-file-name file)) (vc-delete-file file))
((y-or-n-p (format "Really delete file %s?" file)) (delete-file file))))
;;;###autoload
(defun aph/vc-dir-delete-file ()
"As `vc-dir-delete-file', but delete unregistered files.
See `aph/vc-delete-file' for more details; this is just a simple
wrapper around that function for use in the `vc-dir' buffer."
(interactive)
(mapc 'aph/vc-delete-file (or (vc-dir-marked-files)
(list (vc-dir-current-file)))))
(provide 'aph-vc)
;;; aph-vc.el ends here