[Top][All Lists]

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

Re: Dired-do-shell-command does not pass `pwd'

From: Tassilo Horn
Subject: Re: Dired-do-shell-command does not pass `pwd'
Date: Wed, 11 Nov 2009 18:01:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Sébastien Vauban <>

Hi Sébastien,

>>> I often want to type `X' in dired in order to run `soffice' (for example) 
>>> on a
>>> `.doc' file, for example: /home/sva/Desktop/xyz.doc'.
>>>                                    ^^^^^^^^^
>>> Though, when opens, it fails to read the file, stating it 
>>> can't
>>> find the file `/home/sva/xyz.doc'.
>>>                         ^
>>> Any idea how to make `dired-do-shell-command' aware of the current
>>> directory the file is in?
>> Normally, it should be aware of that.  For me it works.
> Just to ensure we talk of the same function, hitting `!' in my Emacs
> (when on a dired buffer) calls the following function:
> ! runs the command dired-do-shell-command, which is an interactive compiled
>   Lisp function.
> It is bound to X, !, <menu-bar> <operate> <command>.
> (dired-do-shell-command command &optional arg file-list)
> Run a shell command command on the marked files. [...]

Yes, exactly that command.  But here the parameters are all written
UPPERCASE (describe-function does that formatting), so at least we use
different emacs versions.  Here it is the GNU one in version 23.1.50 and
a very recent checkout.

,----[ C-h f dired-do-shell-command RET ]
| dired-do-shell-command is an interactive compiled Lisp function in
| `dired-aux.el'.
| (dired-do-shell-command COMMAND &optional ARG FILE-LIST)
| Run a shell command COMMAND on the marked files.
| [...]

>> What does
>>   C-h v dired-directory RET
>> in that dired buffer say?
> dired-directory's value is "~/Desktop/"

That's correct, but I think it's not important.

> Does this help for helping me?

Hm, I don't know the right mechanics, but I edebugged some functions and
can see, that finally for `! evince RET' on ~/Desktop/foo.pdf the shell

  evince foo.pdf

is called.  To make that work, the shell has to be in ~/Desktop.  Try
edebugging the function `dired-run-shell-command'.  I guess the value of
`default-directory' is "~" at you (but should be "~/Desktop/"), or no
handler is found.

In both cases, I don't know why that would be. ;-)


reply via email to

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