Using the value of a variable for setting my load path
Okay, I'm a newb to modifying my .el files. All I want to do is something like: (setq windows-path "c:/Documents and Settings/cthiel/projects/windows_setup/emacs/")
And then tack on subdirectories within the emacs directory onto the load path. Something such as (how it's done in ruby): (add-to-list开发者_高级运维 'load-path "#{windows-path}/external")
Check out EmacsWiki:LoadPath for tips on recursively adding directories.
I think you want something like:
(setq windows-path "c:/Documents and Settings/cthiel/projects/windows_setup/emacs/")
(if (fboundp 'normal-top-level-add-subdirs-to-load-path)
(let* ((my-lisp-dir windows-path)
(default-directory my-lisp-dir))
(setq load-path (cons my-lisp-dir load-path))
(normal-top-level-add-subdirs-to-load-path)))
(setq windows-path "c:/Documents and Settings/cthiel/projects/windows_setup/emacs/"
(add-to-list 'load-path (concat windows-path "external"))
Does that achieve your goal?
Documentation:
concat is a built-in function in `fns.c'.
(concat &rest sequences)
Concatenate all the arguments and make the result a string. The result is a string whose elements are the elements of all the arguments. Each argument may be a string or a list or vector of characters (integers).
example:
(concat "The answer to life, " "the universe " "and everything " "is " "42")
=> "The answer to life, the universe and everything is 42"
精彩评论