Subject: Re: bug#50630: [PATCH] Add tests for insert-directory

From: John Cummings <[email-masked]>
Date: Sat, 25 Sep 2021 18:01:26 +0000

> With your recipe, indeed the free space is not always correct. But
> why is that use case interesting? insert-directory is not a normally
> a user-visible function.

If being a user-visible function is necessary to consider it interesting,
then I reported this as a bug in the verbose `list-directory' output,
which is documented in the manual.

But I don't think it needs to be normally user-visible to be interesting.
Would programmers be welcome to use insert-directory in their code? It would
also be good to fix this so that any future Emacs functionality that used
insert-directory would have the correct output.

The help for that function says:

 insert-directory is a compiled Lisp function in
 ‘/media/ubuntu/turkey/freshemacs/emacs/lisp/files.el’.

 (insert-directory FILE SWITCHES &optional WILDCARD FULL-DIRECTORY-P)

 Insert directory listing for FILE, formatted according to SWITCHES.

I truncated that, but it doesn't say anything about depending on the
current default-directory. If the function performs a listing for FILE,
it shouldn't be possible for it to insert free space that is not correct
for FILE. If it's OK for insert-directory to rely on the current
default-directory, then the FILE argument itself seems unnecessary.