In short, how do I implement the solution in following question in emacs for use in dired? I cannot comment there, so I started this question.
How can I make “ls” show dotfiles first while staying case-insensitive?
The longer version: In emacs dired, I want to always list . and .. as the first two entries. Right now, I used following:
(setq dired-listing-switches "-aFl --group-directories-first -v ")
However, it puts the directory (1dir) at the very end. This is not what I want, as my GUI file manager puts them the first and this causes confusion. The solution in above question solved the issue for me under terminal as illustrated in following.
Is there a way to implement this solution in emacs dired?
> mkdir -p .dotdir dir \(1dir\)
> touch .dotfile file \(2file\)
> ls -lFa --group-directories-first
total 0
drwxr-xr-x 1 myusr myusr 4096 Dec 22 11:04 '(1dir)'/
drwxr-xr-x 1 myusr myusr 4096 Dec 22 11:05 ./
drwxrwxrwx 1 root root 4096 Dec 11 12:16 ../
drwxr-xr-x 1 myusr myusr 4096 Dec 22 11:04 .dotdir/
drwxr-xr-x 1 myusr myusr 4096 Dec 22 11:04 dir/
-rw-r--r-- 1 myusr myusr 0 Dec 22 11:05 '(2file)'
-rw-r--r-- 1 myusr myusr 0 Dec 22 11:05 .dotfile
-rw-r--r-- 1 myusr myusr 0 Dec 22 11:05 file
> LOCPATH=$HOME/.dotfiles/locales LANG=en_DOTFILE.UTF-8 ls -lFa --group-directories-first
total 0
drwxr-xr-x 1 myusr myusr 4096 Dec 22 11:05 ./
drwxrwxrwx 1 root root 4096 Dec 11 12:16 ../
drwxr-xr-x 1 myusr myusr 4096 Dec 22 11:04 .dotdir/
drwxr-xr-x 1 myusr myusr 4096 Dec 22 11:04 '(1dir)'/
drwxr-xr-x 1 myusr myusr 4096 Dec 22 11:04 dir/
-rw-r--r-- 1 myusr myusr 0 Dec 22 11:05 .dotfile
-rw-r--r-- 1 myusr myusr 0 Dec 22 11:05 '(2file)'
-rw-r--r-- 1 myusr myusr 0 Dec 22 11:05 file
(
sorts less than.
, so you could need to rename the(1dir)
to some{1dir}
. – James Risner Dec 24 '22 at 14:12