Emacs, how to get directory of current buffer?

Sometimes default-directory for the current buffer may be set to something other than the current directory of the file the buffer is currently visiting, in which case the solution above wouldn’t give what the asker was looking for.

In such cases, you can use the file-name-directory method, like so: (file-name-directory buffer-file-name)

Here is a link to the docs:

http://www.gnu.org/software/emacs/manual/html_node/elisp/File-Name-Components.html

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)