Function: cider--translate-path

cider--translate-path is a byte-compiled function defined in cider-common.el.

Signature

(cider--translate-path PATH DIRECTION &optional RETURN-ALL)

Documentation

Attempt to translate the PATH in the given DIRECTION, optionally RETURN-ALL.

Looks at cider-path-translations for (container . host) alist of path prefixes and translates PATH from container to host or vice-versa depending on whether DIRECTION is from-nrepl or to-nrepl.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-common.el
(defun cider--translate-path (path direction &optional return-all)
  "Attempt to translate the PATH in the given DIRECTION, optionally RETURN-ALL.
Looks at `cider-path-translations' for (container . host) alist of path
prefixes and translates PATH from container to host or vice-versa depending on
whether DIRECTION is `from-nrepl' or `to-nrepl'."
  (seq-let [from-fn to-fn path-fn] (cond ((eq direction 'from-nrepl) '(car cdr identity))
                                         ((eq direction 'to-nrepl) '(cdr car expand-file-name)))
    (let ((f (lambda (translation)
               (let ((path (funcall path-fn path))
                     (prefix (file-name-as-directory (expand-file-name (funcall from-fn translation)))))
                 (when (string-prefix-p prefix path)
                   (replace-regexp-in-string (format "^%s" (regexp-quote prefix))
                                             (file-name-as-directory
                                              (expand-file-name (funcall to-fn translation)))
                                             path))))))
      (if return-all
          (seq-filter #'identity (mapcar f cider-path-translations))
        (seq-some f cider-path-translations)))))