Subject: Re: bug#39853: 26.3; Sort on file-newer-than-file-p does not work outside home folder

From: Andreas Schwab <[email-masked]>
Date: Sun, 01 Mar 2020 14:14:06 +0100

On Mär 01 2020, dalanicolai wrote:

> Although I tried to send this mail from plain emacs and from spacemacs. I
> was not sure if it worked and did not find a way to check if it worked (At
> least I did not receive any confirmation e-mail). Although I created this
> bug report in spacemacs. I tested the behavior using emacs -Q
>
> 1. evaluate (sort (directory-files "~") 'file-newer-than-file-p)
> 2. evaluate previous sexp with a different path ~ inserted: e.g.
> .emacs.d folder as shown in the attachment
>
> The sexp with the home folder returns a date modified list while the
> sexp with a different folder does not. The attachment shows both folder
> contents of ordered on date modified in nautilus and the returned lists
> from evaluating the sexps. The order of the home folder list is
> consistent with that nautilus while that of the .emacs.d folder is not.

That's because most of the files from ~/.emacs.d don't exist in
default-directory, and nonexisting files are sorted last by
file-newer-than-file-p.  Either use (directory-files "~/.emacs.d" t), or
(let ((default-directory "~/.eamcs.d")) ...).

Andreas.

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."