-
-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Hi,
thanks for the nice packages.
I have encountered a strange behaviour: if I try to open more than 2 levels of the directory tree on a remote host, nothing happens.
Looking at the code I saw that dired-subtree-insert calls dired-subtree--dired-line-is-directory-or-link-p, which checks if something is a dir by matching the regex '..[dl]' at the beginning of the line. However, in my directory listings for the remote host, the second level has four whitespaces at the beginning of the line, instead of 2 as in viewing a local directory.
local:
dir
..inner-dir
remote:
dir
....inner-dir
This may very well be a tramp bug, I don't know.
In any case, I tried debugging it and believe the issue arises in dired-subtree--readin, where one can see the directory listing being inserted in the temp buffer while debugging. Already at that point there is a difference, i.e. in that buffer the remote listing is prepended by 2 whitespaces, while the local listing is not. I wasn't able to pinpoint it further, as it gets too involved for me. BTW I checked, that the output of the ls-call is the same in the local and remote shells.
I tried to monkey-patch it by
(defun my/rm-tramp-whitespaces (r)
(if r
(with-temp-buffer
(insert r)
(while (re-search-backward "^ " nil t)
(replace-match " "))
(buffer-string))
r))
(advice-add
'dired-subtree--readin
:filter-return #'my/rm-tramp-whitespaces)
(obviously, one would have to also check if one is remote), i.e. removing two spaces from the result if there are more than 3. This indeed fixed the remote 2-level subtree 'restriction', but then broke the indentation of the file names themselves. Maybe someone with deeper insights has a solution for this?