[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#2414: 23.0.90; use dired-guess-default too for minibuffer-default-ad

From: Drew Adams
Subject: bug#2414: 23.0.90; use dired-guess-default too for minibuffer-default-add-shell-commands
Date: Sun, 22 Feb 2009 15:04:53 -0800

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

`dired-guess-shell-alist-user' is the user-defined list;
`dired-guess-shell-alist-default' is not user-defined. But a user-defined list
lets users override and supplement a default list of rules.

Why would this necessarily have anything to do with MIME types? The Dired-X
style rules provide an orthogonal way to provide guesses of shell commands for
given file types.

If you want to *also* do something similar for MIME types (a user-defined
MIME-association list, to override default MIME-association behavior), that's
another story. That is a separate suggestion from the one I am making.

What is wrong with having a default set of Dired-X style rules, such as
`dired-guess-shell-alist-default' - but outside of Dired(-X), and likewise let
users provide a set of custom rules to override these default rules (like
`dired-guess-shell-alist-user' - but outside of Dired(-X))?

Why couple such rules with MIME-type overrides? MIME-type associations are a
different kind of file-type association from the simple Dired-X style rules.

And we could go beyond this, to include MS Windows file-type associations (which
I believe are in the Registry). On Windows, Emacs could employ also those
associations when trying to suggest appropriate programs (shell commands) for a
given set of file types.

FWIW, (except for including MS Windows associations), I do this in Icicles. For
example, for a PDF file marked in Dired, the MIME-type association comes up with
commands `gv -safer' and `pdftotext ? -', and the Dired-X rules come up with
command `xpdf' (with my Cygwin bash shell and default MIME types). There's no
reason not to provide all three commands to the user.

And there's no reason to try to shoehorn everything into the form of MIME-type
associations, so that MIME alone is made to come up with all three guesses.
Improving MIME associations is possible, but it is a separate question.

Not everything need be done in the context of MIME types. The Dired-X style
rules are handy and orthogonal, as are MS Windows file-type associations.

Come to think of it, there might be a reason for Dired to keep its own set of
such rules, in *addition* to creating a global set. That might be handy for use
by code and hooks etc. Dunno.

But the main thing is to move these two alists out of Dired-X and make their
associations available generally, in the same way as the MIME associations are
available generally.

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

Yes, you're right about that - I misspoke.

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]