coordinate
coordinate

Reputation: 16234

How to get folder path in dired-mode?

I can get the file path with:

(message (file-name-directory (or buffer-file-name load-file-name)))

But if the buffer in dired-mode, the above code evaluates to nil.

How can I get the folder path in dired-mode with elisp?

Upvotes: 7

Views: 2390

Answers (1)

phils
phils

Reputation: 73246

There's dired-directory, however this Q&A indicates that it is unreliable in certain circumstances, and that default-directory is a better choice.

  • C-hv default-directory RET
  • C-hv dired-directory RET

Upvotes: 8

Related Questions