Refactor doom--recentf-file-truename-fn

This commit is contained in:
Henrik Lissner 2021-05-09 00:20:52 -04:00
parent 62d2f27510
commit 7332a6f798

View file

@ -286,14 +286,10 @@ or file path may exist now."
recentf-max-saved-items 200) ; default is 20
(defun doom--recentf-file-truename-fn (file)
(if (file-remote-p file)
(if-let* ((tfile (and (bound-and-true-p tramp-mode)
(tramp-tramp-file-p file)
(tramp-dissect-file-name file)))
((string= (tramp-file-name-method tfile) "sudo")))
(if (or (not (file-remote-p file))
(equal "sudo" (file-remote-p file 'method)))
(abbreviate-file-name (file-truename (tramp-file-name-localname tfile)))
file)
(abbreviate-file-name (file-truename file))))
file))
;; Resolve symlinks, strip out the /sudo:X@ prefix in local tramp paths, and
;; abbreviate $HOME -> ~ in filepaths (more portable, more readable, & saves