Subject: Re: bug#27631: dired a/*/b

From: Stefan Monnier <[email-masked]>
Date: Thu, 03 Aug 2017 11:48:54 -0400

> Part of the complexity of the original patch is to provide this new
> feature in _tramp_ connections as well;  your patch does the thing
> well (see patch below) in the local machine but it fails in remote ones.

I didn't adjust the Tramp code accordingly, indeed.  My patch probably
also fails for ls-lisp (aka Windows).  Both of those will need
corresponding adjustments.

My point is that it seems like we can get the same end-result without
changing the structure.

> @@ -1100,7 +1100,7 @@ dired-readin-insert
>        (while (not (file-directory-p dir))
>          (setq dir (directory-file-name dir))
>          (let ((n (file-name-nondirectory dir)))
> -          (setq file-list (mapcar (lambda (f) (concat n "/" f)) file-list)))
> +          (setq file-list (mapcar (lambda (f) (concat n (and (not (string= "" f)) "/") f)) file-list)))
>          (setq dir (file-name-directory dir)))
>        (setq default-directory dir))
>      (if (and (equal "" (file-name-nondirectory dir))

`n` represents a directory name, so isn't it OK to have "<n>/" rather
than "<n>"?  Or is the above tweak purely cosmetic?

> @@ -1335,9 +1337,7 @@ dired-insert-directory
>  	  (setq content-point (point)))
>  	(when wildcard
>  	  ;; Insert "wildcard" line where "total" line would be for a full dir.
> -	  (insert "  wildcard " (or (cdr-safe (insert-directory-wildcard-in-dir-p dir))
> -                                    (file-name-nondirectory dir))
> -                  "\n")))
> +	  (insert "  wildcard " (car-safe file-list) "\n")))
>        (dired-insert-set-properties content-point (point)))))

Yes, my patch needs a bunch more cleanups: it was a quick hack job, just
to confirm my intuition.

        Stefan