dired-hacks icon indicating copy to clipboard operation
dired-hacks copied to clipboard

dired-subtree-insert doesn't work when cursor on '.' or '..' (with fix)

Open notuntoward opened this issue 6 years ago • 2 comments

On line 489 of dired-subtree.el, the code:

(let* ((dir-name (dired-get-filename nil))

should be:

(let* ((dir-name (dired-get-filename nil t))

If 't' is included in the arguments of dired-get-filename then dired-subtree-insert works when the cursor is on '.' or '..'. Without the 't', it errors out.

The call to dired-get-filename is correct elsewhere.

notuntoward avatar Nov 21 '19 02:11 notuntoward

Is that a desirable behaviour? Maybe testing if a nil wasn't returned would be better. Is there a practical use-case for inserting a subtree for .? If you think there is I don't object much, but to me I don't see it.

I actually use a filter to hide . and .. in dired, never used them in the last 5 or so years I wrote dired-filter.

Fuco1 avatar Nov 21 '19 22:11 Fuco1

Thanks for the response. Actually, I'm may not need this code change, but making the change anyway wouldn't hurt anything, and would avoid the risk more issue reports from people like me.

My original idea was to use dired-subtree-toggle to toggle .. , which doesn't work with the current version of dired-subtree-insert. However, after I changed dired-subtree-insert to make this possible, and then used my .. displaying dired for a couple days, I decided that I didn't love it.

Also, I'll have a look at dired-filter.

notuntoward avatar Nov 22 '19 17:11 notuntoward