Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

0 views
Skip to first unread message

Sébastien Vauban

unread,
Nov 6, 2009, 5:59:47 AM11/6/09
to
Hi,

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 OpenOffice.org 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?

Best regards,
Seb

--
Sébastien Vauban

Tassilo Horn

unread,
Nov 6, 2009, 5:57:21 PM11/6/09
to info-gnu...@gnu.org
Sébastien Vauban <wxhgmq...@spammotel.com>
writes:

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 OpenOffice.org 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. What does

C-h v dired-directory RET

in that dired buffer say?

Bye,
Tassilo

Sébastien Vauban

unread,
Nov 9, 2009, 3:48:53 AM11/9/09
to
Hi Tassilo,

Tassilo Horn wrote:
> Sébastien Vauban <wxhgmq...@spammotel.com>
> writes:
>
> 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 OpenOffice.org 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:

--8<---------------cut here---------------start------------->8---
! 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. [...]
--8<---------------cut here---------------end--------------->8---


> What does
>
> C-h v dired-directory RET
>
> in that dired buffer say?

--8<---------------cut here---------------start------------->8---
dired-directory's value is "~/Desktop/"
Local in buffer Desktop; global value is nil

Documentation:
The directory name or wildcard spec that this dired directory lists.
Local to each dired buffer. May be a list, in which case the car is the
directory name and the cdr is the list of files to mention.
The directory name must be absolute, but need not be fully expanded.
--8<---------------cut here---------------end--------------->8---

Does this help for helping me?

Tassilo Horn

unread,
Nov 11, 2009, 12:01:46 PM11/11/09
to info-gnu...@gnu.org
Sébastien Vauban <wxhgmq...@spammotel.com>
writes:

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 OpenOffice.org 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
command

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. ;-)

Bye,
Tassilo

0 new messages