[Top][All Lists]

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


From: Reinhard Kotucha
Subject: dired-view-command-alist
Date: Mon, 27 Sep 2004 04:00:32 +0200

I recently installed a CVS version of emacs.  There is obviously a new
feature: if you press "v" in dired mode then a program is launched
according to the entries in dired-view-command-alist.

The idea is not bad, but I think the user interface is.

1.  It is IMO wrong to execute a program depending on the file name
    extension without asking the user.  In most cases you want to run
    Perl on .pl files but you certainly do not want to do this if the
    .pl file is a TeX font property list.

2.  It makes the features of the view mode unavailable for files that
    appear in dired-view-command-alist.  The alternative is to use the
    function find-file-read-only but this very inconvenient as
    compared to view-mode.

Some years ago, when emacs-20 was released, I wrote a small function
which provides a similar feature but does not make other features

I just copied the function dired-do-shell-command to an other file,
changed it's name, added some code and then bound it to the key "!".

It behaves like this:

1.  If you press "!" and there is no entry in shell-command-alist for
    the particular file, it behaves as usual.

2.  If you have marked more than one file it behaves as usual.

3.  If you have marked one or no file (in the latter case the position
    of the cursor is relevant), it adds something like 
    (default: gv -antialias) to the minibuffer.

    Instead of
        "! on example.ps:"
    you get
        "! on example.ps (default: gv -antialias):"
    in the minibuffer.

4.  If you just press the return key the default program (from
    shell-command-alist) is executed.  But if you enter a program
    name before pressing the return key, this program is executed.
    The command history is still available.

This has some advantages:

1.  view-mode always works.

2.  You can execute any program you want.  The patch just provides a
    default, you can make use of it if you want or enter another
    program name or make use of the command history.

I think that view-mode is quite useful and should behave as it behaved
all the years, I don't want to miss it.  So as a quick fix I added
(setq dired-view-command-alist nil) to my ~/.emacs.

But dired-do-shell-command can be improved.  It does not have command
completion, maybe this can be added in the future.  But it is a great
help to have an alist which provides some defaults.  I think that
something like dired-view-command-alist should better be integrated in

And it should not execute any program without asking the user.

It would be nice if you consider to change the user interface as


Reinhard Kotucha                                      Phone: +49-511-4592165
Marschnerstr. 25
D-30167 Hannover                              mailto:address@hidden
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.

reply via email to

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