How to make Emacs C source directory permanent?

Viewed 1895

I'm new to Emacs and I'm just learning how to use it. I know how to set my "Emacs C Source dir" but I don't know how to make this change permanent. I guess I have to set it in my .emacs file but I don't know what is the command for it. Can someone help?

2 Answers

Assuming you have a decent locate-style shell-command, this saves you having to remember the path exactly. It should thus still work in your ~/.emacs.d/init.el if you upgrade to a newer version, as long as you still have the sources.

(setq source-directory
      (file-name-directory
       (shell-command-to-string
    (concat "locate --limit 1 emacs-" emacs-version "/src"))))
Related