From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: wael-zwaiter@gmx.com Newsgroups: gmane.emacs.help Subject: Re: Elisp - Store path only once Date: Sat, 9 Jan 2021 13:55:48 +0100 Message-ID: References: <87a6tie5yv.fsf@omarpolo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7510"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Omar Polo Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 09 13:56:44 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kyDnQ-0001rE-7R for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 13:56:44 +0100 Original-Received: from localhost ([::1]:41706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyDnP-0005bQ-8b for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 07:56:43 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyDn2-0005bH-5f for help-gnu-emacs@gnu.org; Sat, 09 Jan 2021 07:56:21 -0500 Original-Received: from mout.gmx.net ([212.227.17.20]:43203) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyDmy-0002Px-GC for help-gnu-emacs@gnu.org; Sat, 09 Jan 2021 07:56:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1610196949; bh=rAOkQJGTy6g/kJTithiFGV3hOLoDH+GRKa4p+eOxrTI=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=htrncQFFy6rCt+KtSKo767GWhqCRblqRaesqFuuPDjr3W6+juc+ZJ71D+QYgfFpas BJnpa4qEZYNJvlpoAD2dSCXxBP/QwxRujPmbZJjtpzxdqIAujey3vW2BcB4A5I4HuI NWiF76eGDv3GTy0XlclPL7KitPL7A6M2DalN0nVg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs15.server.lan [172.19.170.183]) (via HTTP); Sat, 9 Jan 2021 13:55:48 +0100 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:2iNf/yGt3BaIcJ2b0f50CkxXzc0YZZy3VQdvAJksVsC4OmQJLH5gYvzSSGY5wkxLypPku 72AObMfa+KePfrV1Ttl1iEXHO422rXFJVv37RgUVdKgf7dzqWK1JxsKQLcZDr7eLIBEul8SN3sK4 EBe+qRgke3GIiuzkiVJqAvv1fZslSdUNEEGVdfuJO/21s7VlemXW2vckjDFMJV23b+d/VqhvY5pD eBL1+cDt9ZySvU1/oJg4IQki2VoPYOaqvR9QN50q7BNL9DR/fR0hYb38rz9aLiAzJITzEvbF0RLx 5g= X-UI-Out-Filterresults: notjunk:1;V03:K0:RzqcwT+8wy0=:SMAKJBN+QycY8F3Nco45yg PAwOsfUiCarsw3UuQePd3cPayN6wwB+wEEr2lksrxpZd5UMOG9CzYeON/rpN6FAyH3y61aM1n /TYnYyg0FbuRDyCCqqGhoWSKsp6QplP4/DSVlio2wlOaa99DU8+J0FwxD3Aa2c8AH2pH2GL5h XK/p1poOfLGCnk/hUly4oRVtHf8Xo3S2dBhs3x9r+mMi83xYXhLuDAFSUFBHuvb3Hvn9ADCr4 Y35fqRzeM26QOkEyM+oV9/tzMHcj7lKbwZKtSjKpNf4lCVETVLTPM9zfWZkB3TWlaF+g/wAp7 wVulQg4U6T8VMURVKCXv2CqGtSKtRBs7te1GgYP5xxHOIZKgogwbVG2IpsGcA2d+Af8R6QRJe r375l73iIjEVTjSZKiNKONoBTnaA0MaBARBH3KUG5ByHspfgPN7ySqfWZ4RAG9ck/QtOOA1tQ RGfGhuLnfQebJe51iAev86ufiuorcMKAUd6P82F1Gl78NeXzOx5TDUdzX0kMC10jW7pGATd9w RpQzDe4BKW71XGoS8+U6SAULwjJM12MZwTL6sxnMP39V6WUFFAS2LOQFgGIJNe3n7lcKR8JJV E3Wznnq2qmjtg= Received-SPF: pass client-ip=212.227.17.20; envelope-from=wael-zwaiter@gmx.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:127127 Archived-At: How can enable Rainbow Delimiters on all files (not just programming language files)? > Sent: Saturday, January 09, 2021 at 11:53 PM > From: "Omar Polo" > To: wael-zwaiter@gmx.com > Cc: help-gnu-emacs@gnu.org > Subject: Re: Elisp - Store path only once > > On 9 January 2021 12:30:57 CET, wael-zwaiter@gmx.com wrote: > >Am unsure whether I can require on the elisp files I have written. > > > >(require 'g-eshell) > >(require 'g-utils) > > > >Aw getting confused, as I was simply doing > > > >(setq g-eshell > > "/home/bard/Genadm/build/gadin-1.0/elisp/g-eshell.el") > > > >(setq g-utils > > "/home/bard/Genadm/build/gadin-1.0/elisp/g-utils.el") > > > >(load 'g-eshell) > >(load 'g-utils) > > > >> Sent: Saturday, January 09, 2021 at 10:54 PM > >> From: "Omar Polo" > >> To: wael-zwaiter@gmx.com > >> Cc: help-gnu-emacs@gnu.org > >> Subject: Re: Elisp - Store path only once > >> > >> > >> wael-zwaiter@gmx.com writes: > >> > >> > I have a lot of customisation files for emacs stored in the > >> > directory /home/bard/Genadm/build/gadin-1.0/elisp/. > >> > > >> > Would like to store the path so that I can define it only once. > >> > How can I do this in Emacs Lisp. > >> > > >> > > >> > (setq g-eshell > >> > "/home/bard/Genadm/build/gadin-1.0/elisp/g-eshell.el") > >> > > >> > (setq g-utils > >> > "/home/bard/Genadm/build/gadin-1.0/elisp/g-utils.el") > >> > >> Couldn't you just > >> > >> (add-to-list 'load-path > >"/home/bard/Genadm/build/gadin-1.0/elisp") > >> > >> and then > >> > >> (require 'g-eshell) > >> (require 'g-utils) > >> > >> when needed? > >> > >> > > you should definitely check the manual for more detailed information, bu= t the gist of it is that when you > > (require 'something) > > emacs will search for something.el in all the directories listed in load= -path. This is like the UNIX $PATH variable if you're familiar, only for = elisp files instead. > > Now, you can require any file, given that they contains a provide at the= bottom. i.e. your g-eshell.el should ends with > > (provide 'g-shell) > > this way you can avoid typing the full path every time, and is also easi= er to move those files without braking you configuration. > > (Also, require is better than load because it won't evaluate the same fi= le two times) > -- > Sent from my Android device with K-9 Mail. Please excuse my brevity. >