emacs-devel
[Top][All Lists]
Advanced

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

Re: relation between `dired-guess-default' and `mailcap-file-default-com


From: Juri Linkov
Subject: Re: relation between `dired-guess-default' and `mailcap-file-default-commands'
Date: Sun, 25 Jan 2009 03:04:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu)

> After filing bug #2028 about `dired-guess-default', I came across similar uses
> of `mailcap-file-default-commands'. I'm a bit lost in the code, but it looks
> like these two functions might be doing double-duty to some extent. IIUC, each
> returns a list of shell commands that might be appropriate for a given set of
> target files.
>
> The former is used by `dired-guess-shell-command' (hence indirectly by
> `dired-read-shell-command' and `dired-man'). The latter is used by
> `minibuffer-default-add-shell-commands' and
> `minibuffer-default-add-dired-shell-commands' (hence indirectly by
> `dired-smart-shell-command', which is presumably something similar to 
> functions
> that employ `dired-guess-shell-command').
>
> The means by which `dired-guess-default' and `mailcap-file-default-commands'
> produce their lists of shell commands that target files seem to be quite
> different. Perhaps one of them is superior, or perhaps they should be 
> combined?

`mailcap-file-default-commands' is superior since it provides real
commands available on the system.  But it's not clear what to do with
`dired-guess-default': either combine its commands with commands
from `mailcap-file-default-commands' or remove completely.

> It's not clear to me, for instance, why `dired-read-shell-command' would guess
> shell commands based on file-type alists and `read-shell-command' would guess
> shell commands based on file MIME types.

Commands from MIME types are based on system information from mailcap files
whereas a built-in list in dired-guess-shell-alist-default is fixed.

> It also seems a bit odd that simple.el and dired-aux.el would look to GNUS 
> code
> for their utility functions. Seems like some code refactoring or cleanup might
> be in order here.

Refactoring is already done, so now dependency is minimal.
Please see http://thread.gmane.org/gmane.emacs.devel/80123/focus=80485

> If this code organization and seeming duplication or overlap is intentional,
> then I would like to understand the rationale (purpose), to better decide 
> which
> of these functions to use in my own code in different contexts. The Elisp 
> manual
> is no help here. If intentional, perhaps the doc strings or commentary could 
> be
> improved to better explain what each of these is for, that is, explain their
> difference in terms of purpose and applicability.
>
> Summary: Why are there two, and what is the difference in terms of intended 
> use?
> Should they be combined in some way?

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




reply via email to

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