[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using string variable with file name

From: Thierry Volpiatto
Subject: Re: using string variable with file name
Date: Sat, 23 Feb 2008 17:49:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

saneman <address@hidden> writes:

> Joost Kremers wrote:
>> saneman wrote:
>>> In my .emacs file I have made:
>>> ;; Directories
>>> (setq mylisp "~/work/mylisp/")
>>> ;; Line numbers
>>> (load-file mylisp cons "setnu.el")
>>> (global-set-key "\C-cl" 'setnu-mode)
>>> But this gives an error. How do I "cons" the variable mylisp with a
>>> filename?
>> (cons mylisp "setnu.el")
>> however, that gives you a cons, which (i think) is not what you want. in
>> order to concatenate strings, you need concat:
>> (concat mylisp "setnu.el")
>> but even that is probably not the best way to do what you want. it's
>> probably better to add "~/work/mylisp" to your load path:
>> (setq load-path (cons "~/work/mylisp" load-path))
>> then you can load the file without explicitly naming its path:
>> (load-file "setnu.el")
> When using you last advice:
> (setq load-path (cons "~/work/mylisp" load-path))
> (load-file "setnu.el")
> I get the error:
> File error: "Cannot open load file", "/home/saneman/setnu.el"
> Seems that the load-path is not updated.
> The fist solution:
> (setq mylisp "~/work/mylisp/")
> (load-file (concat mylisp "setnu.el" ))
> works. Are there any rules that say that .el files will not be found
> in the load-path?
Try that:(if setnu.el is in the directory mylisp)

(add-to-list 'load-path "~/work/mylisp")
(load "setnu.el")
A + Thierry
Pub key:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]