[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dynamic Load Path Management for Emacs Packages: The Case of Lana
From: |
Heime |
Subject: |
Re: Dynamic Load Path Management for Emacs Packages: The Case of Lana |
Date: |
Mon, 02 Jun 2025 20:10:12 +0000 |
Sent with Proton Mail secure email.
On Tuesday, June 3rd, 2025 at 7:13 AM, Ship Mints <shipmints@gmail.com> wrote:
> On Mon, Jun 2, 2025 at 13:01 Heime heimeborgia@protonmail.com wrote:
>
> > Sent with Proton Mail secure email.
> >
> > On Tuesday, June 3rd, 2025 at 2:05 AM, Ship Mints shipmints@gmail.com
> > wrote:
> >
> > > On Mon, Jun 2, 2025 at 9:44 AM Heime via Users list for the GNU Emacs
> > > text
> > > editor help-gnu-emacs@gnu.org wrote:
> > >
> > > > I have the plan to set load-path for a package I am writing. Where the
> > > > ~/.emacs.el includes a function that sets the load-path for the package
> > > > (lana) and loads it.
> > > >
> > > > (let* ( (nadin-base (expand-file-name "~/Opstk/src/Nadin/"))
> > > > (lana-subdir "nadin-1.0/typex/lana")
> > > > (lana-path (expand-file-name lana-subdir nadin-base)) )
> > > >
> > > > (add-to-list 'load-path lana-path))
> > > >
> > > > I now have to integrate such an idea to the actual function that allows
> > > > the use of environment variables and does some checking.
> > > >
> > > > (defun emacs-lana (&optional nadin-path)
> > > > "TODO"
> > > >
> > > > (let* ( (tilde-path (expand-file-name
> > > > "~/Opstk/src/Nadin/nadin-1.0/typex/lana"))
> > > > (env-home-path (substitute-in-file-name
> > > > "$HOME/Opstk/src/Nadin/nadin-1.0/typex/lana"))
> > > > (dftpath (or (and (file-directory-p env-home-path) env-home-path)
> > > > (and (file-directory-p tilde-path) tilde-path)))
> > > > (path (or nadin-path
> > > > (getenv "NADIN_PATH")))) ;; Optionally allow env var
> > > >
> > > > (add-to-list 'load-path (or path dftpath)))
> > > >
> > > > (load "lana")
> > > > (lana-fire)))
> > >
> > > Try something like this instead and you can add more if form conditionals
> > > (I'd use a cond form):
> > >
> > > (use-package lana
> > > :demand t
> > > :load-path (if (getenv "NADIN_PATH")
> > > (getenv "NADIN_PATH")
> > > "~/Opstk/src/Nadin/")
> > > ;; etc etc.
> > > )
> >
> > Why do you have two galls to getenv? To I need to include anything at the
> > end of the file lana.el ?
>
>
>
> You could use or here of course. I was not sure what your conditionals
> really are so I was being expansive.
>
> Since you claim lana is a package, end it with a provides 'lana function
> call.
Yes it is a package with the capability of enabling other packages (e.g.
themes, completion,...).