unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefankangas@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 64791@debbugs.gnu.org, manuel@ledu-giraud.fr
Subject: bug#64791: 30.0.50; [PATCH] Fix dired mismatch on some filenames
Date: Tue, 5 Sep 2023 15:27:48 -0700	[thread overview]
Message-ID: <CADwFkmnbwSX0ucAxGZ5wpgA=Aa7ooKR+rD87mL2UzP5-Jwg4EQ@mail.gmail.com> (raw)
In-Reply-To: <83edje5e0s.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 848 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

> Actually, I take this back: this defvar will be computed when files.el
> is loaded, which is at dump time.  So this is not TRT, since the
> conditions and the environment at dump time could be very different
> from those at run time.  It could be even on another machine.

Yes, right.  That's no good.

> So I once again suggest to make this a defcustom.  This has two
> advantages:
>
>  . it will be evaluated at Emacs startup, not at dump time

Agreed.  Let's change it into a defcustom.

>  . it will allow users to customize the value and thus avoid costly
>    search  for the program and prevent finding the wrong version of
>    'ls'

Perhaps this part is okay though, given that the search should only
affect users on macOS and *BSD (who presumably will want this anyways)?

Proposed patch attached.

[-- Attachment #2: 0001-Make-insert-directory-program-a-defcustom-and-use-gl.patch --]
[-- Type: text/x-patch, Size: 1981 bytes --]

From 43ff9396fdc6b5643a72fdb76eca10067762b334 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
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


  reply	other threads:[~2023-09-05 22:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-22 13:22 bug#64791: 30.0.50; [PATCH] Fix dired mismatch on some filenames Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-22 13:50 ` Eli Zaretskii
2023-07-22 14:46   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-22 15:24     ` Eli Zaretskii
2023-09-03 11:34       ` Stefan Kangas
2023-09-03 11:44         ` Eli Zaretskii
2023-09-03 14:04         ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-03 18:18           ` Stefan Kangas
2023-09-03 18:24             ` Eli Zaretskii
2023-09-03 18:54               ` Stefan Kangas
2023-09-03 19:25                 ` Eli Zaretskii
2023-09-04  7:57                   ` Stefan Kangas
2023-09-04  8:05                   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04  8:22                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04  8:36                       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04 19:22                       ` Stefan Kangas
2023-09-05  0:20                         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-05 21:57                           ` Stefan Kangas
2023-09-04 12:17                   ` Eli Zaretskii
2023-09-05 22:27                     ` Stefan Kangas [this message]
2023-09-05 22:43                       ` Stefan Kangas
2023-09-06 11:28                         ` Eli Zaretskii
2023-09-24 12:34                           ` Stefan Kangas
2023-09-24 15:32                             ` Eli Zaretskii
2023-09-25  9:39                               ` Stefan Kangas
2023-09-24 15:41                             ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-24 15:56                               ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADwFkmnbwSX0ucAxGZ5wpgA=Aa7ooKR+rD87mL2UzP5-Jwg4EQ@mail.gmail.com' \
    --to=stefankangas@gmail.com \
    --cc=64791@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=manuel@ledu-giraud.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).