From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: saneman Newsgroups: gmane.emacs.help Subject: Re: using string variable with file name Date: Sat, 23 Feb 2008 13:16:11 +0100 Organization: UNI-C Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1203783378 18532 80.91.229.12 (23 Feb 2008 16:16:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Feb 2008 16:16:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 23 17:16:43 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JSx3K-00034q-FX for geh-help-gnu-emacs@m.gmane.org; Sat, 23 Feb 2008 17:16:43 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JSx2o-0005nK-Bp for geh-help-gnu-emacs@m.gmane.org; Sat, 23 Feb 2008 11:16:10 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!goblin1!goblin2!goblin.stu.neva.ru!news.net.uni-c.dk!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 49 Original-NNTP-Posting-Host: 130.225.245.182 Original-X-Trace: news.net.uni-c.dk 1203768968 5609 130.225.245.182 (23 Feb 2008 12:16:08 GMT) Original-X-Complaints-To: usenet@news.net.uni-c.dk Original-NNTP-Posting-Date: Sat, 23 Feb 2008 12:16:08 +0000 (UTC) User-Agent: Thunderbird 2.0.0.6 (X11/20071022) In-Reply-To: Original-Xref: shelby.stanford.edu gnu.emacs.help:156420 X-Mailman-Approved-At: Sat, 23 Feb 2008 11:13:44 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:51794 Archived-At: 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?