Function: vc-dir--parent

vc-dir--parent is a byte-compiled function defined in vc-dir.el.gz.

Signature

(vc-dir--parent ARG &optional IF-MARKED)

Documentation

Return the parent node of ARG.

If IF-MARKED, return the nearest marked parent.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-dir.el.gz
(defun vc-dir--parent (arg &optional if-marked)
  "Return the parent node of ARG.
If IF-MARKED, return the nearest marked parent."
  (let* ((argdir (vc-dir-node-directory arg))
	 ;; (arglen (length argdir))
	 (crt arg)
	 (found nil))
    ;; Go through the predecessors, checking if any directory that is
    ;; a parent is marked.
    (while (and (null found)
		(setq crt (ewoc-prev vc-ewoc crt)))
      (let ((data (ewoc-data crt))
	    (dir (vc-dir-node-directory crt)))
	(and (vc-dir-fileinfo->directory data)
	     (string-prefix-p dir argdir)
	     (or (not if-marked) (vc-dir-fileinfo->marked data))
	     (setq found crt))))
    found))