Function: cider--abbreviate-file-protocol

cider--abbreviate-file-protocol is a byte-compiled function defined in cider-doc.el.

Signature

(cider--abbreviate-file-protocol FILE-WITH-PROTOCOL)

Documentation

Abbreviate the file-path in file:/path/to/file of FILE-WITH-PROTOCOL.

Same for jar:file:...!/ segments.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-doc.el
        (cider-docview-wrap-text buffer))))) ; ignores code, table blocks

(defun cider--abbreviate-file-protocol (file-with-protocol)
  "Abbreviate the file-path in `file:/path/to/file' of FILE-WITH-PROTOCOL.

Same for `jar:file:...!/' segments."
  (let ((result (if (string-match "^\\(jar\\|zip\\):\\(file:.+\\)!/\\(.+\\)" file-with-protocol)
                    (match-string 3 file-with-protocol)
                  file-with-protocol)))
    (if (string-match "\\`file:\\(.*\\)" result)
        (let ((file (match-string 1 result))
              (proj-dir (clojure-project-dir)))
          (if (and proj-dir
                   (file-in-directory-p file proj-dir))
              (file-relative-name file proj-dir)
            file))
      result)))