--- ../emacs/lisp/ls-lisp.el 2021-06-06 23:11:38.317648694 +0200 +++ ./ls-lisp.el 2021-07-19 22:07:19.977128780 +0200 @@ -284,13 +284,19 @@ (let ((handler (find-file-name-handler (expand-file-name file) 'insert-directory)) (orig-file file) - wildcard-regexp) + wildcard-regexp + (ls-lisp-dirs-first (or ls-lisp-dirs-first + (string-match "--group-directories-first" switches)))) (if handler (funcall handler 'insert-directory file switches wildcard full-directory-p) ;; Remove --dired switch (if (string-match "--dired " switches) (setq switches (replace-match "" nil nil switches))) + (if (string-match "--group-directories-first" switches) + ;; if ls-lisp-dirs-first is nil, dirs are grouped but come out in + ;; reverse order, so add -U flag to fix that + (setq switches (concat "-U " (replace-match "" nil nil switches)))) ;; Convert SWITCHES to a list of characters. (setq switches (delete ?\ (delete ?- (append switches nil)))) ;; Sometimes we get ".../foo*/" as FILE. While the shell and