unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo Liu <sdl.web@gmail.com>
To: 63744@debbugs.gnu.org
Subject: bug#63744: 28.2; fix dired-guess-default
Date: Sat, 27 May 2023 12:10:15 +0800	[thread overview]
Message-ID: <m1h6ry2z4o.fsf@gmail.com> (raw)

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


             reply	other threads:[~2023-05-27  4:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-27  4:10 Leo Liu [this message]
2023-05-27  6:49 ` bug#63744: 28.2; fix dired-guess-default 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

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=m1h6ry2z4o.fsf@gmail.com \
    --to=sdl.web@gmail.com \
    --cc=63744@debbugs.gnu.org \
    /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).