Function: pcmpl-cvs-entries

pcmpl-cvs-entries is a byte-compiled function defined in pcmpl-cvs.el.gz.

Signature

(pcmpl-cvs-entries &optional OPERS)

Documentation

Return the Entries for the current directory.

If OPERS is a list of characters, return entries for which that operation character applies, as displayed by cvs -n update.

Source Code

;; Defined in /usr/src/emacs/lisp/pcmpl-cvs.el.gz
(defun pcmpl-cvs-entries (&optional opers)
  "Return the Entries for the current directory.
If OPERS is a list of characters, return entries for which that
operation character applies, as displayed by `cvs -n update'."
  (let* ((arg (pcomplete-arg))
	 (dir (file-name-as-directory
	       (or (file-name-directory arg) "")))
	 (nondir (or (file-name-nondirectory arg) ""))
	 entries)
    (if opers
	(with-temp-buffer
	  (and dir (cd dir))
	  (call-process pcmpl-cvs-binary nil t nil
			"-q" "-n" "-f" "update") ; "-l")
	  (goto-char (point-min))
	  (while (re-search-forward "^\\(.\\) \\(.+\\)$" nil t)
	    (if (memq (string-to-char (match-string 1)) opers)
		(setq entries (cons (match-string 2) entries)))))
      (when (file-exists-p (expand-file-name "CVS/Entries" dir))
        (with-temp-buffer
          (insert-file-contents (expand-file-name "CVS/Entries" dir))
          (goto-char (point-min))
          (while (not (eobp))
            ;; Normal file: /NAME   -> "" "NAME"
            ;; Directory  : D/NAME  -> "D" "NAME"
            (let* ((fields (split-string (buffer-substring
                                          (line-beginning-position)
                                          (line-end-position))
                                         "/"))
                   (text (nth 1 fields)))
              (when text
                (if (string= (nth 0 fields) "D")
                    (setq text (file-name-as-directory text)))
                (setq entries (cons text entries))))
            (forward-line)))))
    (setq pcomplete-stub nondir)
    (pcomplete-uniquify-list entries)))