emacs/dired: drop non-standard switches on Windows
On Windows (or systems that don't support ls), ls-lisp-use-insert-directory-program will be nil. In these cases, strip out non-standard switches so they don't throw an error and make dired unusuable. Fixes #3939
This commit is contained in:
parent
0683861f3f
commit
33af1f98b4
1 changed files with 7 additions and 5 deletions
|
@ -36,12 +36,14 @@
|
||||||
(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-maybe-h ()
|
||||||
"Fix #1703: dired over TRAMP displays a blank screen.
|
"Remove extraneous switches from `dired-actual-switches' when it's
|
||||||
|
uncertain that they are supported (e.g. over TRAMP or on Windows).
|
||||||
|
|
||||||
This is because there's no guarantee the remote system has GNU ls, which is the
|
Fixes #1703: dired over TRAMP displays a blank screen.
|
||||||
only variant that supports --group-directories-first."
|
Fixes #3939: unsortable dired entries on Windows."
|
||||||
(when (file-remote-p default-directory)
|
(when (or (file-remote-p default-directory)
|
||||||
|
(not (bound-and-true-p ls-lisp-use-insert-directory-program)))
|
||||||
(setq-local dired-actual-switches (car args))))))
|
(setq-local dired-actual-switches (car args))))))
|
||||||
|
|
||||||
;; Don't complain about this command being disabled when we use it
|
;; Don't complain about this command being disabled when we use it
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue