I thought I saw an error here when list-directory with a directory (not file) glob (ex: ~/Project/emacs/*/) is followed by another list-directory, but I think the actual issue is that the default directory in the first case is set to something that doesn't exist, which messes up call-process in the second invocation of list-directory. The error I saw was:
Debugger entered--Lisp error: (file-missing "Setting current directory" "No such file or directory" "/home/chadpbrown/Project/emacs/*/")
call-process("ls" nil t nil "-CF" "--" "/home/chadpbrown/Project/emacs/src/")
insert-directory("/home/chadpbrown/Project/emacs/src/" "-CF" nil t)
list-directory("~/Project/emacs/src/" nil)
funcall-interactively(list-directory "~/Project/emacs/src/" nil)
call-interactively(list-directory nil nil)
command-execute(list-directory)
I'm not sure it's worth the overhead to fix this. I'm testing a small change that replaced default-directory in list-directory (lisp/files.el:7387) with
(if (file-exists-p default-directory)
default-directory
user-emacs-directory)
..but it feels like a hack?
~Chad