Function: consult--fast-abbreviate-file-name

consult--fast-abbreviate-file-name is a byte-compiled function defined in consult.el.

Signature

(consult--fast-abbreviate-file-name NAME)

Documentation

Return abbreviate file NAME.

This function is a pure variant of abbreviate-file-name, which does not access the file system. This is important if we require that the operation is fast, even for remote paths or paths on network file systems.

Source Code

;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
(defun consult--fast-abbreviate-file-name (name)
  "Return abbreviate file NAME.
This function is a pure variant of `abbreviate-file-name', which
does not access the file system.  This is important if we require
that the operation is fast, even for remote paths or paths on
network file systems."
  (save-match-data
    (let (case-fold-search) ;; Assume that file system is case sensitive.
      (setq name (directory-abbrev-apply name))
      (if (string-match (with-memoization consult--fast-abbreviate-file-name
                          (directory-abbrev-make-regexp (expand-file-name "~")))
                        name)
          (concat "~" (substring name (match-beginning 1)))
        name))))