Make insert-directory-program a defcustom; use "gls" on *BSD

* lisp/files.el (insert-directory-program): Change into defcustom.
Default to "gls" on *BSD and macOS.  (Bug#64791)
This commit is contained in:
Stefan Kangas 2023-09-25 11:36:14 +02:00
parent df5a9a78b5
commit 9f91a1c3eb
2 changed files with 28 additions and 2 deletions

View file

@ -144,6 +144,14 @@ can use this to distinguish between buffers visiting files with the
same base name that belong to different projects by using the provided
transform function 'project-uniquify-dirname-transform'.
** 'insert-directory-program' is now a defcustom.
** 'insert-directory-program' prefers "gls" on *BSD and macOS.
On *BSD and macOS systems, this user option now defaults to the "gls"
executable, if it exists. This should remove the need to change its
value when installing GNU coreutils using something like ports or
Homebrew.
** cl-print
*** You can expand the "..." truncation everywhere.

View file

@ -7727,10 +7727,28 @@ need to be passed verbatim to shell commands."
pattern))))
(defvar insert-directory-program (purecopy "ls")
(defcustom insert-directory-program
(if (and (memq system-type '(berkeley-unix darwin))
(executable-find "gls"))
(purecopy "gls")
(purecopy "ls"))
"Absolute or relative name of the `ls'-like program.
This is used by `insert-directory' and `dired-insert-directory'
\(thus, also by `dired').")
(thus, also by `dired'). For Dired, this should ideally point to
GNU ls, or another version of ls that supports the \"--dired\"
flag. See `dired-use-ls-dired'.
On GNU/Linux and other capable systems, the default is \"ls\".
On *BSD and macOS systems, the default \"ls\" does not support
the \"--dired\" flag. Therefore, the default is to use the
\"gls\" executable on such machines, if it exists. This means
that there should normally be no need to customize this when
installing GNU coreutils using something like ports or Homebrew."
:group 'dired
:type 'string
:initialize #'custom-initialize-delay
:version "30.1")
(defcustom directory-free-space-program (purecopy "df")
"Program to get the amount of free space on a file system.