From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: uzibalqa Newsgroups: gmane.emacs.help Subject: Re: Add code from other files Date: Thu, 04 Jul 2024 17:32:31 +0000 Message-ID: References: <6d098cab-1a96-4eb7-a4c3-1a4cf0fb3270@starynkevitch.net> <2fa9f251-0c84-46b5-9a88-b525eb79a413@starynkevitch.net> <_PaeWZsPmOkMG6EHs5Q_pGgCKfPN6KS5G97LT-TdrvMPSwG-KP24LmGkPsei8HjCBOai36qQUA5h-XeSeyQ2OoB49djwEFS5RjWzONWiAG4=@proton.me> 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="32878"; mail-complaints-to="usenet@ciao.gmane.io" Cc: uzibalqa via Users list for the GNU Emacs text editor To: uzibalqa Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 04 19:33:17 2024 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 1sPQKb-0008Jz-Ay for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 04 Jul 2024 19:33:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPQK4-0001p8-Vb; Thu, 04 Jul 2024 13:32:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPQK3-0001od-Lh for help-gnu-emacs@gnu.org; Thu, 04 Jul 2024 13:32:43 -0400 Original-Received: from mail-40130.protonmail.ch ([185.70.40.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPQK0-0006Mc-Bc for help-gnu-emacs@gnu.org; Thu, 04 Jul 2024 13:32:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1720114356; x=1720373556; bh=6jS0nGvbgOgmO/XwDAXzAqnsZpW5mOEpqTQ1wzQ/0tI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=I192xz6Und2awoDf6Na00AI0fOs/FQapE/B4Ocml10xNjXujgr2DqmAei/Tw77CDz 90sVbhLWAwp5Kxxus50wWErCMaAKwQOQdh26YaDeKF1YExlEaY6QayN4ztgW9JdOhw 2yqz/NEJTNKKjbnxMteG8WZT8tdS8lemSqs7Gw4/H0bduNykCgEpOcp/fy+Y/mu78f ZvDq0JwAaZoaYmGWGMbdesb+pwcki5pjxrMxBS8feGEFAaCRyFCx7ICFcXWRCHMdqB Dh/y292vSdjBVb8oo+1aW7qXo5Z9zdK44DbgHNWmFkVVaf5xqYc1oALkt3FgM7KTTk caDKBFDu6WPCg== In-Reply-To: Feedback-ID: 52887082:user:proton X-Pm-Message-ID: 7e364a09ee287ad0294a49284e83c5c3af3aaae6 Received-SPF: pass client-ip=185.70.40.130; envelope-from=uzibalqa@proton.me; helo=mail-40130.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, TO_EQ_FM_DIRECT_MX=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147072 Archived-At: Sent with Proton Mail secure email. On Thursday, July 4th, 2024 at 5:16 PM, uzibalqa wrote= : > On Thursday, July 4th, 2024 at 12:10 PM, uzibalqa uzibalqa@proton.me wrot= e: >=20 > > On Thursday, July 4th, 2024 at 11:19 AM, uzibalqa uzibalqa@proton.me wr= ote: > >=20 > > > On Thursday, July 4th, 2024 at 11:11 AM, Basile Starynkevitch basile@= starynkevitch.net wrote: > > >=20 > > > > On 7/4/24 13:03, uzibalqa wrote: > > > >=20 > > > > > On Thursday, July 4th, 2024 at 3:49 AM, Basile Starynkevitch basi= le@starynkevitch.net wrote: > > > > >=20 > > > > > > On 7/4/24 01:44, uzibalqa wrote: > > > > > >=20 > > > > > > > I have a file and want to add the code from other files to it= . What does one do ? > > > > > >=20 > > > > > > You should explain more. Are you thinking of Elisp code? GNU em= acs can > > > > > > be used to edit non-code files (eg LaTeX documents) > > > > > >=20 > > > > > > -- > > > > > > Basile STARYNKEVITCH basile@starynkevitch.net > > > > > > I have an elisp file and want to include the functionality pres= ent in another .el file. > > > >=20 > > > > Can't you use the load primitive function of Elisp > > > >=20 > > > > > load is a primitive-function in =E2=80=98C source code=E2=80= =99. > > > > >=20 > > > > > (load FILE &optional NOERROR NOMESSAGE NOSUFFIX MUST-SUFFIX) > > > > >=20 > > > > > Execute a file of Lisp code named FILE. > > > > > First try FILE with =E2=80=98.elc=E2=80=99 appended, then try wit= h =E2=80=98.el=E2=80=99, then try > > > > > with a system-dependent suffix of dynamic modules (see =E2=80= =98load-suffixes=E2=80=99), > > > > > then try FILE unmodified (the exact suffixes in the exact order a= re > > > > > determined by =E2=80=98load-suffixes=E2=80=99). Environment varia= ble references in > > > > > FILE are replaced with their values by calling =E2=80=98substitut= e-in-file-name=E2=80=99. > > > > > This function searches the directories in =E2=80=98load-path= =E2=80=99. > > > > >=20 > > > > > If optional second arg NOERROR is non-nil, > > > > > report no error if FILE doesn=E2=80=99t exist. > > > > > Print messages at start and end of loading unless > > > > > optional third arg NOMESSAGE is non-nil (but =E2=80=98force-load-= messages=E2=80=99 > > > > > overrides that). > > > > > If optional fourth arg NOSUFFIX is non-nil, don=E2=80=99t try add= ing > > > > > suffixes to the specified name FILE. > > > > > If optional fifth arg MUST-SUFFIX is non-nil, insist on > > > > > the suffix =E2=80=98.elc=E2=80=99 or =E2=80=98.el=E2=80=99 or the= module suffix; don=E2=80=99t accept just > > > > > FILE unless it ends in one of those suffixes or includes a direct= ory name. > > > > >=20 > > > > > If NOSUFFIX is nil, then if a file could not be found, try lookin= g for > > > > > a different representation of the file by adding non-empty suffix= es to > > > > > its name, before trying another file. Emacs uses this feature to = find > > > > > compressed versions of files when Auto Compression mode is enable= d. > > > > > If NOSUFFIX is non-nil, disable this feature. > > > > >=20 > > > > > The suffixes that this function tries out, when NOSUFFIX is nil, = are > > > > > given by the return value of =E2=80=98get-load-suffixes=E2=80= =99 and the values listed > > > > > in =E2=80=98load-file-rep-suffixes=E2=80=99. If MUST-SUFFIX is no= n-nil, only the > > > > > return value of =E2=80=98get-load-suffixes=E2=80=99 is used, i.e.= the file name is > > > > > required to have a non-empty suffix. > > > > >=20 > > > > > When searching suffixes, this function normally stops at the firs= t > > > > > one that exists. If the option =E2=80=98load-prefer-newer= =E2=80=99 is non-nil, > > > > > however, it tries all suffixes, and uses whichever file is the ne= west. > > > > >=20 > > > > > Loading a file records its definitions, and its =E2=80=98provide= =E2=80=99 and > > > > > =E2=80=98require=E2=80=99 calls, in an element of =E2=80=98load-h= istory=E2=80=99 whose > > > > > car is the file name loaded. See =E2=80=98load-history=E2=80= =99. > > > > >=20 > > > > > While the file is in the process of being loaded, the variable > > > > > =E2=80=98load-in-progress=E2=80=99 is non-nil and the variable = =E2=80=98load-file-name=E2=80=99 > > > > > is bound to the file=E2=80=99s name. > > > > >=20 > > > > > Return t if the file exists and loads successfully. > > > > >=20 > > > > > Probably introduced at or before Emacs version 1.1. > >=20 > > What are the 'provide' and 'require' calls and should I use them ? > > When is it appropriate to use 'load'. A useful feature of load is > > that prints messages at start and end of loading. I have a main file and three auxiliary files. I can use `load` for the auxi= liary files and use `provide` for the main file. Would this be the correct approa= ch ? This approach ensures that all auxiliary files are loaded when the main fil= e is loaded,=20 and that the main file can be required as a single unit.