unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#63744: 28.2; fix dired-guess-default
@ 2023-05-27  4:10 Leo Liu
  2023-05-27  6:49 ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Leo Liu @ 2023-05-27  4:10 UTC (permalink / raw)
  To: 63744

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

I have this customisation

(setq dired-guess-shell-alist-user '(("." EXP)))

where EXP evaluates to a list of strings. It has been working for ~10
years until Emacs 28.

After some digging it turns out there is a rewrite of
`dired-guess-default' which is not compatible. Previously returning a
list of strings from EXP accidentally worked.

  (eval (car cmds) `((file . ,file)))  ; single command

but if it evaluates to a list of strings it is perfectly fine as per the
documentation of dired-guess-default. I propose the following patch for
remedy.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-dired-guess-default.patch --]
[-- Type: text/x-patch, Size: 1714 bytes --]

From 16fbf6eb7e054d715326801647af579715f2911f Mon Sep 17 00:00:00 2001
From: Leo Liu <sdl.web@gmail.com>
Date: Sat, 27 May 2023 12:03:08 +0800
Subject: [PATCH] Fix dired-guess-default

* lisp/dired-x.el (dired-guess-shell-alist-user): Document COMMAND can
also return a list of strings.
(dired-guess-default): Handle list of strings from eval COMMAND.
---
 lisp/dired-x.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index bc85da2c..0420a86c 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -950,9 +950,9 @@ If several files are to be processed, REGEXP has to match all the
 files.
 
 Each COMMAND can either be a string or a Lisp expression that evaluates
-to a string.  If this expression needs to consult the name of the file for
-which the shell commands are being requested, it can access that file name
-as the variable `file'.
+to a string or list of strings.  If this expression needs to consult
+the name of the file for which the shell commands are being requested,
+it can access that file name as the variable `file'.
 
 If several COMMANDs are given, the first one will be the default
 and the rest will be added temporarily to the history and can be retrieved
@@ -975,9 +975,9 @@ See `dired-guess-shell-alist-user'."
   (let* ((case-fold-search dired-guess-shell-case-fold-search)
          (programs
           (delete-dups
-           (mapcar
+           (mapcan
             (lambda (command)
-              (eval command `((file . ,(car files)))))
+              (ensure-list (eval command `((file . ,(car files))))))
             (seq-reduce
              #'append
              (mapcar #'cdr
-- 
2.32.0 (Apple Git-132)


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-06-02  4:28 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-27  4:10 bug#63744: 28.2; fix dired-guess-default Leo Liu
2023-05-27  6:49 ` Eli Zaretskii
2023-05-28  2:40   ` Leo Liu
2023-05-28  6:27     ` Eli Zaretskii
2023-05-29  1:23       ` Michael Heerdegen
2023-05-29  3:49         ` Leo Liu
2023-05-29 12:38           ` Eli Zaretskii
2023-05-30  0:04             ` Michael Heerdegen
2023-05-29 12:07         ` Eli Zaretskii
2023-05-29 18:20           ` Leo Liu
2023-05-29 18:27             ` Eli Zaretskii
2023-05-30  0:24               ` Michael Heerdegen
2023-05-30  2:36                 ` Eli Zaretskii
2023-06-02  0:14       ` Michael Heerdegen
2023-06-02  4:28         ` Leo Liu

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).