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

From: Tino Calancha <[email-masked]>
Date: Fri, 4 Aug 2017 14:12:32 +0900 (JST)

On Thu, 3 Aug 2017, Stefan Monnier wrote:

>> 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.
Maybe that's the reason why this feature didn't exit before: people found
it wasn't straight to implemented it for everything: local and remote
connections, external  or emulated 'ls'.
Now we have it, but you are very welcome to rewrite it so that it fits in
the original structure.  I am volunteer to be the patch tester!

>> @@ -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?
No cosmetic, i need it, otherwise i get an error if i eval the form:
(dired (expand-file-name "lisp/*.el" source-directory))

Debugger entered--Lisp error: (file-missing "Reading directory" "No such file or directory" "*.el/")
   access-file("*.el/" "Reading directory")
   insert-directory("*.el/" "--dired -al" t nil)
   dired-insert-directory("/home/calancha/soft/emacs-master/lisp/" "-al" ("*.el/") t t)
   dired-readin-insert()
   dired-readin()
   dired-internal-noselect("~/soft/emacs-master/lisp/*.el" nil)
   dired-noselect("/home/calancha/soft/emacs-master/lisp/*.el" nil)
   dired("/home/calancha/soft/emacs-master/lisp/*.el")
   eval((dired (expand-file-name "lisp/*.el" source-directory)) nil)
   elisp--eval-last-sexp(nil)
   eval-last-sexp(nil)
   funcall-interactively(eval-last-sexp nil)
   call-interactively(eval-last-sexp nil nil)
   command-execute(eval-last-sexp)