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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s
dired-directory, however this Q&A indicates that it is unreliable in certain circumstances, and thatdefault-directoryis a better choice.default-directoryRETdired-directoryRET