Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the current directory in Emacs Lisp

Tags:

emacs

elisp

I am trying to write a .dir-locals.el file. I want to dynamically find the directory that the file is in and concatenate it with "TAGS". This was my first try:

((nil . ((tags-file-name . (concat default-directory "TAGS")))))

This doesn't work. I am not an Emacs Lisp expert. What is wrong with it?

like image 846
hekevintran Avatar asked May 06 '11 22:05

hekevintran


People also ask

How do I navigate to a folder in Emacs?

To start dired: In Emacs, type M-x dired. You will be prompted for the directory to open. Type in the directory to display, or press Return to open the default directory.

Where is the Emacs load path?

Default value of `load-path' On GNU/Linux, the default value of 'load-path' includes two special directories and their descendants: /usr/local/share/emacs/VERSION/site-lisp and /usr/local/share/emacs/site-lisp .

How do I load a lisp in emacs?

To load an Emacs Lisp file, type M-x load-file . This command reads a file name using the minibuffer, and executes the contents of that file as Emacs Lisp code. It is not necessary to visit the file first; this command reads the file directly from disk, not from an existing Emacs buffer.


1 Answers

In linux, how about:

(getenv "PWD")
like image 52
AAAfarmclub Avatar answered Oct 12 '22 19:10

AAAfarmclub