Rewrite dired-subtree--readin to fix several bugs
#179
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I found multiple issues with
dired-subtree--readin, this fixes them:Breaks when
--diredis included indired-listing-switches. You'llsee that the nested directory is indented by 4 spaces instead of 2,
which also makes inserting a nested subdirectory fail (since it checks
that the line starts with exactly two spaces followed by a
d).The problem is that the listing will already have the double-space
prefix. See
dired-insert-directorywhich just useslooking-attodetermine if it needs to add spaces or not. I used the same code to
add the indentation with
indent-rigidly.When
-Fis used in the switches, the./..entries are notremoved, leading to failures.
This is because they get a suffix of
/. Use a/?$-terminatedregexp to find these lines.
Also, if there are file names that precede
./.., the previous codewould fail since it assumes that they must be first.
Use a regexp loop that looks for these in the whole buffer rather than
the first two lines.
Also includes a slightly better version of dired-subtree: Respect the value of dired-actual-switches #143, to avoid the conflict
that would result from this PR.