* bug#2414: 23.0.90; use dired-guess-default too for minibuffer-default-add-shell-commands
@ 2009-02-20 20:01 Drew Adams
2009-02-22 21:54 ` Juri Linkov
2021-12-04 21:27 ` Lars Ingebrigtsen
0 siblings, 2 replies; 7+ messages in thread
From: Drew Adams @ 2009-02-20 20:01 UTC (permalink / raw)
To: emacs-pretest-bug
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.
It is true that the default value of `dired-guess-shell-alist-default'
is computed using some variables, such as `dired-guess-shell-gnutar',
that are defined in dired-x.el. However, those parts of the value
could be picked up dynamically and conditionally instead. Or, if they
too are not Dired-related, they could be moved elsewhere and made
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'!
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'.
The idea behind this enhancement request is that there is no reason
that `minibuffer-default-add-shell-commands' should not benefit also
from the candidate commands defined by these alists.
In GNU Emacs 23.0.90.1 (i386-mingw-nt5.1.2600)
of 2009-02-01 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2414: 23.0.90; use dired-guess-default too for minibuffer-default-add-shell-commands
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
2021-12-04 21:27 ` Lars Ingebrigtsen
1 sibling, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2009-02-22 21:54 UTC (permalink / raw)
To: Drew Adams; +Cc: 2414
> 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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2414: 23.0.90; use dired-guess-default too for minibuffer-default-add-shell-commands
2009-02-22 21:54 ` Juri Linkov
@ 2009-02-22 23:04 ` Drew Adams
2009-02-22 23:37 ` Juri Linkov
0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2009-02-22 23:04 UTC (permalink / raw)
To: 'Juri Linkov'; +Cc: 2414
> > 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!
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2414: 23.0.90; use dired-guess-default too for minibuffer-default-add-shell-commands
2009-02-22 23:04 ` Drew Adams
@ 2009-02-22 23:37 ` Juri Linkov
2009-02-23 0:25 ` Drew Adams
0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2009-02-22 23:37 UTC (permalink / raw)
To: Drew Adams; +Cc: 2414
> 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.
I mostly agree but such a general task is for after the release.
However, now I fixed an omission in dired-x.el to use exactly
the same functions as were implemented for dired-aux.el
(using read-shell-command instead of read-from-minibuffer and
correctly setting minibuffer-default-add-dired-shell-commands
in dired-read-shell-command). This causes MIME commands to be
automatically added after guess-shell commands. So currently
Dired-x users can be more happy because they have both command sets.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2414: 23.0.90; use dired-guess-default too for minibuffer-default-add-shell-commands
2009-02-22 23:37 ` Juri Linkov
@ 2009-02-23 0:25 ` Drew Adams
0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2009-02-23 0:25 UTC (permalink / raw)
To: 'Juri Linkov'; +Cc: 2414
> > 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.
>
> I mostly agree but such a general task is for after the release.
Sure.
> However, now I fixed an omission in dired-x.el to use exactly
> the same functions as were implemented for dired-aux.el
> (using read-shell-command instead of read-from-minibuffer and
> correctly setting minibuffer-default-add-dired-shell-commands
> in dired-read-shell-command). This causes MIME commands to be
> automatically added after guess-shell commands. So currently
> Dired-x users can be more happy because they have both command sets.
Looks good.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2414: 23.0.90; use dired-guess-default too for minibuffer-default-add-shell-commands
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
@ 2021-12-04 21:27 ` Lars Ingebrigtsen
2021-12-05 9:25 ` Juri Linkov
1 sibling, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-04 21:27 UTC (permalink / raw)
To: Drew Adams; +Cc: 2414
"Drew Adams" <drew.adams@oracle.com> writes:
> `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.
Well... they are dired-specific, because they're only used in dired.
(And using them elsewhere would be pretty surprising.)
Emacs does have a problem in this area, though -- I'm guessing there's a
dozen different packages that define similar functionality (i.e.,
"what's in mailcap but with some extras"), and consolidating these would
be nice. But the problem is that there's different use cases -- the
things a person wants to do in Dired isn't necessarily what they'd want
to do in Gnus when receiving an attachment).
And so we're where we are.
So I don't want to make the minibuffer function depend on Dired, and I
don't want to make these things non-Dired-applicable (because that'd
annoy people who have customised their Dired experience), so there's
nothing actionable left here, and I'm closing this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2414: 23.0.90; use dired-guess-default too for minibuffer-default-add-shell-commands
2021-12-04 21:27 ` Lars Ingebrigtsen
@ 2021-12-05 9:25 ` Juri Linkov
0 siblings, 0 replies; 7+ messages in thread
From: Juri Linkov @ 2021-12-05 9:25 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 2414
> Emacs does have a problem in this area, though -- I'm guessing there's a
> dozen different packages that define similar functionality (i.e.,
> "what's in mailcap but with some extras"), and consolidating these would
> be nice. But the problem is that there's different use cases -- the
> things a person wants to do in Dired isn't necessarily what they'd want
> to do in Gnus when receiving an attachment).
Such consolidation was discussed recently in https://debbugs.gnu.org/18132#92
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-12-05 9:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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).