Function: cvs-mode-find-file

cvs-mode-find-file is an interactive and byte-compiled function defined in pcvs.el.gz.

Signature

(cvs-mode-find-file E &optional OTHER VIEW)

Documentation

Select a buffer containing the file.

With a prefix, opens the buffer in an OTHER window.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/pcvs.el.gz
(defun cvs-mode-find-file (e &optional other view)
  "Select a buffer containing the file.
With a prefix, opens the buffer in an OTHER window."
  (interactive (list last-input-event current-prefix-arg))
  ;; If the event moves point, check that it moves it to a valid location.
  (when (and (/= (point) (progn (posn-set-point (event-end e)) (point)))
	     (not (memq (get-text-property (1- (line-end-position))
                                           'font-lock-face)
                        '(cvs-header cvs-filename))))
    (error "Not a file name"))
  (cvs-mode!
   (lambda (&optional rev)
     (interactive (list (cvs-prefix-get 'cvs-branch-prefix)))
     (let* ((cvs-buf (current-buffer))
	    (fi (cvs-mode-marked nil nil :one t)))
       (if (eq (cvs-fileinfo->type fi) 'DIRCHANGE)
	   (let ((odir default-directory))
	     (setq default-directory
		   (cvs-expand-dir-name (cvs-fileinfo->dir fi)))
	     (cond ((eq other 'dont-select)
		    (display-buffer (find-file-noselect default-directory)))
		   (other (dired-other-window default-directory))
		   (t (dired default-directory)))
	     (set-buffer cvs-buf)
	     (setq default-directory odir))
	 (let ((buf (if rev (cvs-retrieve-revision fi rev)
		      (find-file-noselect (cvs-fileinfo->full-name fi)))))
	   (funcall (cond ((eq other 'dont-select) 'display-buffer)
			  (other
			   (if view 'view-buffer-other-window
			     'switch-to-buffer-other-window))
			  (t (if view 'view-buffer 'switch-to-buffer)))
		    buf)
	   (when (and cvs-find-file-and-jump (cvs-applicable-p fi 'diff-base))
	     (save-restriction
	       (widen)
	       (goto-char (point-min))
	       (forward-line (1- (cvs-find-modif fi)))))
	   buf))))))