emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9f91a1c3ebe: Make insert-directory-program a defcustom; use "gls"


From: Stefan Kangas
Subject: master 9f91a1c3ebe: Make insert-directory-program a defcustom; use "gls" on *BSD
Date: Mon, 25 Sep 2023 05:37:42 -0400 (EDT)

branch: master
commit 9f91a1c3ebef4034d5e96741023abc4f3d02d730
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    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)
---
 etc/NEWS      |  8 ++++++++
 lisp/files.el | 22 ++++++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 53c8451dc19..290111a213f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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.
diff --git a/lisp/files.el b/lisp/files.el
index 9d766683d26..ddae097f1d1 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]