Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get folder path in dired-mode?

Tags:

emacs

lisp

elisp

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?

like image 204
coordinate Avatar asked Jun 15 '12 07:06

coordinate


People also ask

How do I create a Dired folder?

The command + ( dired-create-directory ) reads a directory's name, and creates that directory. It signals an error if the directory already exists.

How do you use Dired?

To enter into a directory, move to its listing in the Dired buffer, and simply hit the return key. To view a file, you can place the cursor on its entry and use the f or v key, or simply hit the return key.

How do you refresh Dired?

Refresh the Dired buffer using switches as dired-listing-switches . Type g ( revert-buffer ) to update the contents of the Dired buffer, based on changes in the files and directories listed. This preserves all marks except for those on files that have vanished. Hidden subdirectories are updated but remain hidden.


1 Answers

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
like image 180
phils Avatar answered Oct 09 '22 21:10

phils