--- ../emacs/lisp/ls-lisp.el 2021-06-06 23:11:38.317648694 +0200 +++ ./ls-lisp.el 2021-07-16 15:00:29.000632720 +0200 @@ -253,6 +253,9 @@ "Format to display float file sizes.") (defvar ls-lisp-filesize-b-fmt " %.0f" "Format to display file sizes in blocks (for the -s switch).") +(defvar ls-lisp--really-dirs-first nil + "`t' if either ls-lisp-dirs-first is set to `t' or GNU ls flag + \"--group-directory-first\" is passed in switches to ls-lisp.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -291,6 +294,9 @@ ;; Remove --dired switch (if (string-match "--dired " switches) (setq switches (replace-match "" nil nil switches))) + (setq ls-lisp--really-dirs-first + (or ls-lisp-dirs-first + (string-match "--group-directories-first" 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 @@ -682,7 +688,7 @@ (ding) (sit-for 2)))) ; to show user the message! (if (memq ?F switches) ; classify switch (setq file-alist (mapcar 'ls-lisp-classify file-alist))) - (if ls-lisp-dirs-first + (if ls-lisp--really-dirs-first ;; Re-sort directories first, without otherwise changing the ;; ordering, and reverse whole list. cadr of each element of ;; `file-alist' is t for directory, string (name linked to) for