Subject: Re: bug#2414: 23.0.90; use dired-guess-default too for minibuffer-default-add-shell-commands

From: Juri Linkov <[email-masked]>
Date: Sun, 22 Feb 2009 23:54:10 +0200

> Enhancement request:
>
> `minibuffer-default-add-shell-commands' should add to the minibuffer
> defaults list not only the commands determined by MIME type (which it
> does now, using `mailcap-file-default-commands'), but also the
> commands determined by `dired-guess-default'.
>
> `dired-guess-default' is defined in dired-x.el, but it has nothing to
> do with Dired, AFAICT, so there is no reason that it should not be
> available (and used) generally.
>
> And variables `dired-guess-shell-alist-user' and
> `dired-guess-shell-alist-default' should also be factored out of
> dired-x.el. They too are not Dired-related, AFAICT.

Instead of generalizing `dired-guess-shell-alist-default',
I'd rather create a similar user-defined list of commands
to override default MIME commands in `mailcap-mime-data'
(using something like `mailcap-add').

> Note, BTW, that dired-x.el already uses `minibuffer-default-add-shell-commands'
> in `dired-smart-shell-command' (in dired-x.el). It makes no
> sense that only the MIME types be used to come up with defaults, and
> not also `dired-guess-default', in the very library that defines
> `dired-guess-default'!

Thanks for the pointer.  After moving code with
`minibuffer-default-add-shell-commands' from `shell-command'
to `read-shell-command' on 2008-07-31 I forgot to change
`dired-smart-shell-command' the same way.  Fixed now.

> My guess is that someone just updated `dired-smart-shell-command' for
> Emacs 23 mechanically, without thinking about the commands provided
> by `dired-guess-default'. IOW, it was a mechanical substitution of
> the same diff that was used to update `read-shell-command'.

`dired-smart-shell-command' is unrelated to `dired-guess-default'
with its alists.  `dired-smart-shell-command' is bound to `M-!'
and according to its docstring it should work like `shell-command'.

Moreover, currently `M-!' is the only way to use MIME commands from
`mailcap-file-default-commands' when dired-x is loaded!

-- 
Juri Linkov
http://www.jurta.org/emacs/