Subject: bug#13152: 24.2.90; [REGRESSION] dired-get-marked-files changed

From: Juri Linkov <[email-masked]>
Date: Sat, 15 Dec 2012 12:59:00 +0200

> But FUNCTION "should not manipulate files, just read input
> \(an argument or confirmation)." so I don't see why this matters.

I agree it shouldn't matter in which buffer FUNCTION is called.
The problem is caused by the flawed design of dired-x where
`dired-guess-default' doesn't propagate the value of `files'
to the evaluated expressions in `dired-guess-shell-alist-default'.
Also note how `dired-guess-shell-alist-default' is forced to use the
dynamically bound variable `file'.

The proper fix would be to redesign `dired-guess-shell-alist-default'
to funcall lambdas with one arg `files' instead of using `eval'.

So instead of

  (setq dired-guess-shell-alist-user
        '(("." (let ((files (dired-get-marked-files t current-prefix-arg)))
                 (let (dired-guess-shell-alist-user)
                   (dired-guess-default files))))))

Leo would be able to use

  (setq dired-guess-shell-alist-user
        '(("." (lambda (files)
                 (let (dired-guess-shell-alist-user)
                   (dired-guess-default files))))))

This could help to move useful features from dired-x.el to dired-aux.el.