When finding files with Ctrl-x Ctrl-f and then pressing Tab, to list the file completion names, is there a way to list these files in reverse order of their dates (when they were last edited)? Currently emacs lists them alphabetically. Is there a way of having the following two options: pressing Ctrl-x Ctrl-f Tab lists the files in alphabetical order, pressing Ctrl-x Ctrl-f space lists them in reverse order of dates?
Vanilla Emacs doesn't let you choose the sort order in this context.
You can of course define your own command to use instead of what
C-x C-f is bound to by default. But if you want to use
read-file-name in that command then, again, you won't have much control over the order of candidates shown. If you instead use
completing-read in the command, and you match file-name candidates only as strings, then you can order the set of candidates any way you like (and you can use relative or absolute file names). But in that case you lose the features of
read-file-name (e.g. navigating up and down the file-system hierarchy).