Function: viper-file-checked-in-p

viper-file-checked-in-p is a byte-compiled function defined in viper-util.el.gz.

Signature

(viper-file-checked-in-p FILE)

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/viper-util.el.gz
;; This is a simple-minded check for whether a file is under version control.
;; If file,v exists but file doesn't, this file is considered to be not checked
;; in and not checked out for the purpose of patching (since patch won't be
;; able to read such a file anyway).
;; FILE is a string representing file name
;;(defun viper-file-under-version-control (file)
;;  (let* ((filedir (file-name-directory file))
;;	 (file-nondir (file-name-nondirectory file))
;;	 (trial (concat file-nondir ",v"))
;;	 (full-trial (concat filedir trial))
;;	 (full-rcs-trial (concat filedir "RCS/" trial)))
;;    (and (stringp file)
;;	 (file-exists-p file)
;;	 (or
;;	  (and
;;	   (file-exists-p full-trial)
;;	   ;; in FAT FS, `file,v' and `file' may turn out to be the same!
;;	   ;; don't be fooled by this!
;;	   (not (equal (file-attributes file)
;;		       (file-attributes full-trial))))
;;	  ;; check if a version is in RCS/ directory
;;	  (file-exists-p full-rcs-trial)))
;;       ))


(defsubst viper-file-checked-in-p (file)
  (and (featurep 'vc-hooks)
       ;; CVS files are considered not checked in
       ;; FIXME: Should this deal with more than CVS?
       (not (memq (vc-backend file) '(nil CVS)))
       (if (fboundp 'vc-state)
	   (and
	     (not (memq (vc-state file) '(edited needs-merge)))
	     (not (stringp (vc-state file)))))))