Function: f-common-parent
f-common-parent is a byte-compiled function defined in f.el.
Signature
(f-common-parent PATHS)
Documentation
Return the deepest common parent directory of PATHS.
Source Code
;; Defined in ~/.emacs.d/elpa/f-20241003.1131/f.el
(defun f-common-parent (paths)
"Return the deepest common parent directory of PATHS."
(cond
((not paths) nil)
((not (cdr paths)) (f-parent (car paths)))
(:otherwise
(let* ((paths (-map 'f-split paths))
(common (caar paths))
(re nil))
(while (and (not (null (car paths))) (--all? (equal (car it) common) paths))
(setq paths (-map 'cdr paths))
(push common re)
(setq common (caar paths)))
(cond
((null re) "")
((and (= (length re) 1) (f-root-p (car re)))
(f-root))
(:otherwise
(concat (apply 'f-join (nreverse re)) "/")))))))