Fix #1703: dired listing no files over tramp

...on systems that don't have GNU ls installed and don't support
--group-directories-first
This commit is contained in:
Henrik Lissner 2020-05-03 13:18:31 -04:00
parent a4b0fd2bf6
commit bd6405673e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

16
modules/emacs/dired/config.el Executable file → Normal file
View file

@ -31,20 +31,16 @@
(setq insert-directory-program gls) (setq insert-directory-program gls)
;; BSD ls doesn't support --group-directories-first ;; BSD ls doesn't support --group-directories-first
(setq args (delete "--group-directories-first" args)))) (setq args (delete "--group-directories-first" args))))
(setq dired-listing-switches (string-join args " "))) (setq dired-listing-switches (string-join args " "))
(add-hook! 'dired-mode-hook (add-hook! 'dired-mode-hook
(defun +dired-disable-gnu-ls-flags-in-tramp-buffers-h () (defun +dired-disable-gnu-ls-flags-in-tramp-buffers-h ()
"Fix #1703: dired over TRAMP displays a blank screen. "Fix #1703: dired over TRAMP displays a blank screen.
This is because there's no guarantee the remote system has GNU ls, which is the This is because there's no guarantee the remote system has GNU ls, which is the
only variant that supports --group-directories-first." only variant that supports --group-directories-first."
(when (file-remote-p default-directory) (when (file-remote-p default-directory)
(setq-local dired-listing-switches (setq-local dired-listing-switches (car args))))))
(string-join
(split-string dired-listing-switches
"--group-directories-first")
" ")))))
;; Don't complain about this command being disabled when we use it ;; Don't complain about this command being disabled when we use it
(put 'dired-find-alternate-file 'disabled nil) (put 'dired-find-alternate-file 'disabled nil)