From 43ff9396fdc6b5643a72fdb76eca10067762b334 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 6 Sep 2023 00:16:03 +0200 Subject: [PATCH] Make insert-directory-program a defcustom and use "gls" on *BSD * lisp/files.el (insert-directory-program): Change into defcustom. Default to using "gls" on *BSD and macOS. (Bug#64791) --- etc/NEWS | 8 ++++++++ lisp/files.el | 11 +++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index a68e67e0694..52648400261 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -128,6 +128,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, it now defaults to using 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. diff --git a/lisp/files.el b/lisp/files.el index 4188615e490..ef5c6a96b55 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7723,10 +7723,17 @@ shell-quote-wildcard-pattern 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')." + :group 'dired + :type 'string + :version "30.1") (defcustom directory-free-space-program (purecopy "df") "Program to get the amount of free space on a file system. -- 2.42.0