Miserable Variable
Miserable Variable

Reputation: 28752

Why can dired-do-shell-command not operate on '.' or '..'?

Using emacs on cygwin, one shell command I use very often from dired buffers using ! bound to dired-do-shell-command is cygstart, .e.g to open a Word document or a Visual Studio project or whatever.

But hitting ! on current directory entry, ., results in error Cannot operate on.' or ..'.

I wanted to find out before I bypass it and allow the command to be run on current and parent directories. Is there any reason for this restriction?

Upvotes: 1

Views: 345

Answers (2)

phils
phils

Reputation: 73246

This restriction has been lifted since the question was asked.

In the current stable release of Emacs (24.3), you can use dired-do-shell-command on . and ..

Upvotes: 0

Oleg Pavliv
Oleg Pavliv

Reputation: 21152

dired-do-shell-command calls dired-get-filename.

If you take a look on the dired-get-filename doc you will see

(dired-get-filename &optional LOCALP NO-ERROR-IF-NOT-FILEP)

In Dired, return name of file mentioned on this line.

...

Optional arg NO-ERROR-IF-NOT-FILEP means treat .' and ..' as regular filenames and return nil if no filename on this line. Otherwise, an error occurs in these cases.

dired-get-filename is called without NO-ERROR-IF-NOT-FILEP argument

Upvotes: 1

Related Questions