summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorXue Fuqiao <xfq.free@gmail.com>2013-12-26 06:57:00 +0800
committerXue Fuqiao <xfq.free@gmail.com>2013-12-26 06:57:00 +0800
commited78d16c6eabaa6c23c9964cc925541349c6088c (patch)
tree58548f8fde9e93b2d5eec9f11ebfa407791678ed /lisp
parent55db967faea930cc1539190e09b348cab735bc7d (diff)
parent77bbf3713d459c45492e6daed68437edcf863a0c (diff)
downloademacs-ed78d16c6eabaa6c23c9964cc925541349c6088c.tar.gz
Some fixes for vc-ignore (Bug#15754).
Inspired by Andreas Politz and Dmitry Gutov.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/vc/vc.el40
2 files changed, 30 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a994cf21db6..18f0a9f22fe 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-25 Xue Fuqiao <xfq.free@gmail.com>
+
+ * vc/vc.el (vc-ignore): Use `vc-responsible-backend'.
+ Fix interactive spec. Doc fix. (Bug#15754)
+
2013-12-25 Katsumi Yamaoka <yamaoka@jpl.org>
* emacs-lisp/byte-run.el (eval-when-compile):
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 0ef13bfc61d..93778babaaa 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1343,23 +1343,33 @@ first backend that could register the file is used."
(let ((vc-handled-backends (list backend)))
(call-interactively 'vc-register)))
-(defun vc-ignore (file &optional directory)
- "Ignore FILE under the VCS of DIRECTORY (default is `default-directory').
-FILE is a file wildcard.
-When called interactively and with a prefix argument, remove FILE
-from ignored files.
-When called from Lisp code, if DIRECTORY is non-nil, the
-repository to use will be deduced by DIRECTORY."
+(defun vc-ignore (file &optional directory remove)
+ "Ignore FILE under the VCS of DIRECTORY.
+
+Normally, FILE is a wildcard specification that matches the files
+to be ignored. When REMOVE is non-nil, remove FILE from the list
+of ignored files.
+
+DIRECTORY defaults to `default-directory' and is used to
+determine the responsible VC backend.
+
+When called interactively, prompt for a FILE to ignore, unless a
+prefix argument is given, in which case prompt for a file FILE to
+remove from the list of ignored files."
(interactive
- (list (read-file-name "The file to ignore: ")
- (completing-read
- "The file to remove: "
- (vc-call-backend
- (vc-backend default-directory)
- 'ignore-completion-table default-directory))))
+ (list
+ (if (not current-prefix-arg)
+ (read-file-name "File to ignore: ")
+ (completing-read
+ "File to remove: "
+ (vc-call-backend
+ (or (vc-responsible-backend default-directory)
+ (error "Unknown backend"))
+ 'ignore-completion-table default-directory)))
+ nil current-prefix-arg))
(let* ((directory (or directory default-directory))
- (backend (vc-backend default-directory))
- (remove current-prefix-arg))
+ (backend (or (vc-responsible-backend default-directory)
+ (error "Unknown backend"))))
(vc-call-backend backend 'ignore file directory remove)))
(defun vc-default-ignore (backend file &optional directory remove)