Function: vc-cvs-append-to-ignore
vc-cvs-append-to-ignore is a byte-compiled function defined in
vc-cvs.el.gz.
Signature
(vc-cvs-append-to-ignore DIR STR &optional OLD-DIR SORT)
Documentation
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. If SORT is non-nil, sort the lines of the ignore file.
Aliases
cvs-append-to-ignore (obsolete since 24.4)
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc-cvs.el.gz
(defun vc-cvs-append-to-ignore (dir str &optional old-dir sort)
"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. If SORT is non-nil, sort the lines of the
ignore file."
(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-min))
(save-match-data
(unless (re-search-forward (concat "^" (regexp-quote str) "$") nil 'move)
(unless (bolp) (insert "\n"))
(insert str (if old-dir "/\n" "\n"))
(if sort (sort-lines nil (point-min) (point-max)))
(save-buffer)))))