diff --git a/src/elisp/treemacs-compatibility.el b/src/elisp/treemacs-compatibility.el index e45c73fe..049bd575 100644 --- a/src/elisp/treemacs-compatibility.el +++ b/src/elisp/treemacs-compatibility.el @@ -28,6 +28,7 @@ (require 'treemacs-scope) (require 'treemacs-core-utils) (require 'treemacs-interface) +(require 'treemacs-persistence) (eval-when-compile (require 'treemacs-macros)) @@ -38,10 +39,13 @@ (push '(treemacs-workspace . :never) frameset-filter-alist)) (with-eval-after-load 'tramp - (setf treemacs--file-name-handler-alist - (with-no-warnings - (list - (cons tramp-file-name-regexp #'tramp-file-name-handler))))) + (setf + treemacs--no-abbr-on-persist-prefixes + (--map (format "/%s:" (car it)) (with-no-warnings tramp-methods)) + treemacs--file-name-handler-alist + (with-no-warnings + (list + (cons tramp-file-name-regexp #'tramp-file-name-handler))))) (with-eval-after-load 'recentf (with-no-warnings diff --git a/src/elisp/treemacs-persistence.el b/src/elisp/treemacs-persistence.el index e75c8280..8e3f6602 100644 --- a/src/elisp/treemacs-persistence.el +++ b/src/elisp/treemacs-persistence.el @@ -62,6 +62,10 @@ (:constructor treemacs-iter->create!)) list) +(defvar treemacs--no-abbr-on-persist-prefixes nil + "Prefixes for paths that should be saved as is, without `abbreviate-file-name'. +Set the all the `tramp-methods', after it has been loaded.'") + (define-inline treemacs-iter->next! (self) "Get the next element of iterator SELF. @@ -201,7 +205,7 @@ ITER: Treemacs-Iter Struct" (push (format " - path :: %s\n" (-let [path (treemacs-project->path pr)] - (if (string-prefix-p "/ssh:" path) + (if (--any? (string-prefix-p it path) treemacs--no-abbr-on-persist-prefixes) path (abbreviate-file-name path)))) txt)))