Function: file-name-unquote

file-name-unquote is a byte-compiled function defined in files.el.gz.

Signature

(file-name-unquote NAME &optional TOP)

Documentation

Remove quotation prefix "/:" from file NAME, if any.

If NAME is a remote file name and TOP is nil, the local part of NAME is unquoted.

Other relevant functions are documented in the file-name group.

View in manual

Probably introduced at or before Emacs version 26.1.

Shortdoc

;; file-name
(file-name-unquote "/:/tmp/foo")
    => "/tmp/foo"

Aliases

tramp-compat-file-name-unquote

Source Code

;; Defined in /usr/src/emacs/lisp/files.el.gz
(defsubst file-name-unquote (name &optional top)
  "Remove quotation prefix \"/:\" from file NAME, if any.
If NAME is a remote file name and TOP is nil, the local part of
NAME is unquoted."
  (let* ((file-name-handler-alist (unless top file-name-handler-alist))
         (localname (file-local-name name)))
    (when (file-name-quoted-p localname top)
      (setq
       localname (if (= (length localname) 2) "/" (substring localname 2))))
    (concat (file-remote-p name) localname)))