summaryrefslogtreecommitdiff
path: root/lisp/vc/vc-cvs.el
diff options
context:
space:
mode:
authorXue Fuqiao <xfq.free@gmail.com>2013-07-30 08:25:31 +0800
committerXue Fuqiao <xfq.free@gmail.com>2013-07-30 08:25:31 +0800
commit7aa7fff0c8860b72a2c7cdc7d4d0845245754d43 (patch)
tree10c4e901544080581b926622eb35d26ddda65791 /lisp/vc/vc-cvs.el
parent8121f08950ca36647a6dfa32d02be574b253d9df (diff)
downloademacs-7aa7fff0c8860b72a2c7cdc7d4d0845245754d43.tar.gz
Add vc-ignore.
* lisp/vc/vc.el (vc-ignore): New function. * lisp/vc/vc-svn.el (vc-svn-ignore): New function. * lisp/vc/vc-hg.el (vc-hg-ignore): New function. * lisp/vc/vc-git.el (vc-git-ignore): New function. * lisp/vc/vc-dir.el (vc-dir-mode-map): Add key binding for vc-dir-ignore (vc-dir-ignore): New function. * lisp/vc/vc-cvs.el (vc-cvs-ignore): New function. (cvs-append-to-ignore): Moved from pcvs.el. * lisp/vc/vc-bzr.el (vc-bzr-ignore): New function. * lisp/vc/pcvs.el (vc-cvs): Require 'vc-cvs.
Diffstat (limited to 'lisp/vc/vc-cvs.el')
-rw-r--r--lisp/vc/vc-cvs.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index 17b278d1ce4..3472673f46d 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -1226,6 +1226,28 @@ is non-nil."
table (lambda () (vc-cvs-revision-table (car files))))))
table))
+(defun vc-cvs-ignore (file)
+ "Ignore FILE under CVS."
+ (interactive)
+ (cvs-append-to-ignore (file-name-directory file) file))
+
+(defun cvs-append-to-ignore (dir str &optional old-dir)
+ "In DIR, add STR to the .cvsignore file.
+If OLD-DIR is non-nil, then this is a directory that we don't want
+to hear about anymore."
+ (with-current-buffer
+ (find-file-noselect (expand-file-name ".cvsignore" dir))
+ (when (ignore-errors
+ (and buffer-read-only
+ (eq 'CVS (vc-backend buffer-file-name))
+ (not (vc-editable-p buffer-file-name))))
+ ;; CVSREAD=on special case
+ (vc-checkout buffer-file-name t))
+ (goto-char (point-max))
+ (unless (bolp) (insert "\n"))
+ (insert str (if old-dir "/\n" "\n"))
+ (if cvs-sort-ignore-file (sort-lines nil (point-min) (point-max)))
+ (save-buffer)))
(provide 'vc-cvs)