From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: using string variable with file name Date: Sat, 23 Feb 2008 17:49:56 +0100 Message-ID: <871w7339e3.fsf@thievol.homelinux.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1203784747 26785 80.91.229.12 (23 Feb 2008 16:39:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Feb 2008 16:39:07 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: saneman Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 23 17:39:31 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 1JSxPM-0001tC-S4 for geh-help-gnu-emacs@m.gmane.org; Sat, 23 Feb 2008 17:39:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JSxOr-0000Cj-Bd for geh-help-gnu-emacs@m.gmane.org; Sat, 23 Feb 2008 11:38:57 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JSxOb-0000CR-JR for help-gnu-emacs@gnu.org; Sat, 23 Feb 2008 11:38:41 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JSxOa-0000Bm-6j for help-gnu-emacs@gnu.org; Sat, 23 Feb 2008 11:38:41 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JSxOZ-0000Bc-Oc for help-gnu-emacs@gnu.org; Sat, 23 Feb 2008 11:38:39 -0500 Original-Received: from ug-out-1314.google.com ([66.249.92.170]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JSxOZ-0004rN-9K for help-gnu-emacs@gnu.org; Sat, 23 Feb 2008 11:38:39 -0500 Original-Received: by ug-out-1314.google.com with SMTP id a2so212033ugf.48 for ; Sat, 23 Feb 2008 08:38:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references:date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=voLPksDUBirM6+RlopUjSu/UmKj0rRDSKIIrcwubTaQ=; b=QynsaJMBDnJs/B/NSrKSxsOqNthdpB3PK6pLqkJZhfAhpPw1cakVtk58Hbx8s5qvQlGlralKM2QtLjlor1sU2aaDjHBVB3qa1Ip7QAPZ/HJmzBVmTPK6XGPaVUrMsuc/IkRDTnCkNgb0hUOBPZRuAkin6EcyVyuoa482TipipvY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id:user-agent:mime-version:content-type; b=akBcETnaK+H+pCeRtganmPLUClAyFjoUt45RL/aSh99u6ELrrELc+Wv/fp6D4LDBDOiApzLgVI6xcamHBik5FuAE5mnqIlym8eTCUgUlQ43EyZd22/E5N5AzgXylq5m/rf5Z5t9UT+jFKysMcEYw962Y9qquWiBxgrYQYi6F2xE= Original-Received: by 10.66.251.3 with SMTP id y3mr631770ugh.88.1203784718840; Sat, 23 Feb 2008 08:38:38 -0800 (PST) Original-Received: from thievol.homelinux.org ( [77.197.77.154]) by mx.google.com with ESMTPS id d4sm2723400fga.2.2008.02.23.08.38.36 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 23 Feb 2008 08:38:37 -0800 (PST) In-Reply-To: (saneman's message of "Sat, 23 Feb 2008 13:16:11 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:51799 Archived-At: saneman 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: http://pgp.mit.edu