unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Juri Linkov'" <juri@jurta.org>
Cc: 2414@emacsbugs.donarmstrong.com
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	[thread overview]
Message-ID: <001b01c99541$f91510d0$0200a8c0@us.oracle.com> (raw)
In-Reply-To: <87r61qf8ph.fsf@jurta.org>

> > 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	other threads:[~2009-02-22 23:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20 20:01 bug#2414: 23.0.90; use dired-guess-default too for minibuffer-default-add-shell-commands Drew Adams
2009-02-22 21:54 ` Juri Linkov
2009-02-22 23:04   ` Drew Adams [this message]
2009-02-22 23:37     ` Juri Linkov
2009-02-23  0:25       ` Drew Adams
2021-12-04 21:27 ` Lars Ingebrigtsen
2021-12-05  9:25   ` Juri Linkov

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='001b01c99541$f91510d0$0200a8c0@us.oracle.com' \
    --to=drew.adams@oracle.com \
    --cc=2414@emacsbugs.donarmstrong.com \
    --cc=juri@jurta.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).