emacs-eask / cli

CLI for building, running, testing, and managing your Emacs Lisp dependencies
https://emacs-eask.github.io/
GNU General Public License v3.0
138 stars 21 forks source link

Cross install a package #238

Closed llemaitre19 closed 8 months ago

llemaitre19 commented 8 months ago

Thank you for this great tool ! I have started to use Eask as a project management tool for an elisp package and all work perfectly.

But it remains one think that I'd like Eask to help me: is it possible to cross install the package from the local package development directory to my local ~/.emacs.d/elpa directory ? If I right understand --config option usage, it cannot help here as eask install --config looks for the Eask file into ~/.emacs.d directory instead of the current directory (the package one).

jcs090218 commented 8 months ago

Thank you for this great tool ! I have started to use Eask as a project management tool for an elisp package and all work perfectly.

Thank you! Glad you like it! ❤️

But it remains one think that I'd like Eask to help me:

Are you trying to install the package you have created? Or install packages to your personal config? 🤔

llemaitre19 commented 8 months ago

Thanks for your prompt reply.

Are you trying to install the package you have created? Or install packages to your personal config?

I am trying to install the package I have created. Running eask install in this package directory, creates the bundle needed by package.el (ie PACKAGE.el, PACKAGE-autoloads.el and PACKAGE-pkg.el) in the .eask/29.1/elpa/PACKAGE-version. I'd like to be able to install the fresh generated PACKAGE-version directly in ~/.emacs.d/elpa, to immediatly be able to use it and to test it within my current Emacs configuration.

Note that I do not use Eask to manage my packages in my Emacs configuration (I only use use-package).

Maybe I have missed something obvious or I am doing something wrong in my elisp package development process !

jcs090218 commented 8 months ago

You don't need to use Eask to manage packages for your configuration, but an Eask-file is required for Eask to work. Therefore, you can create a dummy Eask file in ~/.emacs.d/.

Eask doesn't allow you to install the package directly. But you have several options:

  1. Use the recipe and pull it from your repo: https://emacs-eask.github.io/DSL/#-depends-on-package-name-rest-recipe. Then eask install -c.
  2. Use eask link add (create symbolic link)

Make sure you back up your ~/.emacs.d if something happens.

jcs090218 commented 8 months ago

If you just want to test a package. You can just use eask exec emacs. If you want to test your package with your configuration, you can copy your whole ~/.emacs.d to path/to/working/dir/.eask/VERSION/; then eask exec emacs.

llemaitre19 commented 8 months ago

The eask link add seems to be pretty close to what I am looking for. But I am a bit confused by the creation the dummy Eask file (and the usage of the -c flag in that case). eask init in my .emacs.d asks me for an entry point. Answering init.el leads later to an error about missing headers when running eask link add PACKAGE PATH_TO_PACKAGE...

Maybe another solution would be to simply create a custom Eask command running a copy of the .eask/29.1/elpa/PACKAGE-version folder to ~/.emacs/elpa. Is there an Eask elisp function that could help to get the first path (ie .eask/29.1/elpa/PACKAGE-version ) ?

One advantage is that it does not require a dummy Eask file in my .emacs.d.

jcs090218 commented 8 months ago

You can remove the DSL (package-file ...) from your config's Eask-file. This is my Eask-file:

(package "jcs-emacs"
         "9.0.2"
         "Emacs configuration works across all OSs")

(website-url "https://github.com/jcs-emacs/jcs-emacs")
(keywords "lisp" "config")

(files "early-init.el" "init.el"
       "lisp/*.el"
       "lisp/lib/*.el"
       "site-lisp/*.el"
       "modules/**"
       "banners/**"
       "fonts/**"
       "templates/**")

(script "test" "echo \"Error: no test specified\" && exit 1")

(source 'gnu)
(source 'melpa)
(source 'jcs-elpa)

(depends-on "emacs" "29.1")

(depends-on "pkg-dm")
(depends-on "noflet")

(setq network-security-level 'low)  ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432

Maybe another solution would be to simply create a custom Eask command running a copy of the .eask/29.1/elpa/PACKAGE-version folder to ~/.emacs/elpa. Is there an Eask elisp function that could help to get the first path (ie .eask/29.1/elpa/PACKAGE-version ) ?

One advantage is that it does not require a dummy Eask file in my .emacs.d.

That would work too. You can define your own custom command: (paste it to your Eask-file)

(eask-defcommand copy-to-my-config
  (let ((package-dir (file-name-directory (locate-library "jtsx"))))
    (copy-directory package-dir (expand-file-name "~/.emacs.d/elpa/"))))

Then $ eask run command copy-to-my-config.

jcs090218 commented 8 months ago

Notice rc is not a valid tag name. Use pre, beta, alpha, or snapshot instead.

llemaitre19 commented 8 months ago

Thanks, so I have created this Eask file in my .emacs.d:

(package ".emacs.d"
         "1.0.0"
         "Emacs configuration")

(website-url "https://github.com/llemaitre19/emacs.d")
(keywords "lisp" "config")

(script "test" "echo \"Error: no test specified\" && exit 1")

(source "gnu")

(depends-on "emacs" "29.1")

When I run eask -c -v 5 link add jtsx . in the jtsx local repository, I get this error:

Running Eask in the configuration (~/.emacs.d/) environment
Press Ctrl+C to cancel.

Executing script inside Emacs...

[EXEC] emacs emacs -Q --script /usr/local/lib/node_modules/@emacs-eask/cli/lisp/link/add.el jtsx . --eask-c --eask--verbose 5

✓ Loading config Eask file in /home/loic/.emacs.d/Eask... done!

Loading configuration... Loading /home/loic/.emacs.d/init.el (source)...
[yas] Prepared just-in-time loading of snippets successfully.
ad-handle-definition: ‘shell’ got redefined
git exited with status 1

Am I doing something wrong ?

For the 2nd solution, (file-name-directory (locate-library "jtsx")) resolves to ~/.emacs.d/lisp instead of jtsx/.eask/29.1/elpa/jtsx-0.4.2-pre1. I think a call to some Eask elisp helper function is needed here to retrieve this specific path.

llemaitre19 commented 8 months ago

Notice rc is not a valid tag name. Use pre, beta, alpha, or snapshot instead.

Thanks. This is based on versioning standards or tips documented somewhere, I guess ?

jcs090218 commented 8 months ago

Am I doing something wrong ?

It seems like there is something wrong with your configuration since the -c flag will load your configuration before the tasks. Try the flag -q, so it won't load your configuration. 🤔

For the 2nd solution, (file-name-directory (locate-library "jtsx")) resolves to ~/.emacs.d/lisp instead of jtsx/.eask/29.1/elpa/jtsx-0.4.2-pre1.

Where did you call this function? 🤔 If I have the following:

(eask-defcommand print-jtsx-path
  (message "%s" (file-name-directory (locate-library "jtsx"))))

Then $ eask run command print-jtsx-path gives me:

[RUN]: print-jtsx-path
d:/_workspace/_eask/jtsx/.eask/29.2/elpa/jtsx-0.4.2snapshot/

Thanks. This is based on versioning standards or tips documented somewhere, I guess ?

No, I just go straight into the source code. There are the documentation there.

llemaitre19 commented 8 months ago

It seems like there is something wrong with your configuration since the -c flag will load your configuration before the tasks. Try the flag -q, so it won't load your configuration.

Yes adding -q makes the command work.

Where did you call this function?

Sorry, I call it within eval-expression command in my Emacs session to test it, that should be the mistake. And of course your code works as intended if executed correctly.

No, I just go straight into the source code. There are the documentation there.

Not sure my question was clear... I just wonder why rc is not valid for Eask: does Eask follows some offical or popular recommendations regarding versioning rules that deprecates using rc ?

Closing the issue. Many thanks for your very helpful support !

jcs090218 commented 8 months ago

I'm glad you solved it! 🎉🚀

Not sure my question was clear... I just wonder why rc is not valid for Eask: does Eask follow some offical or popular recommendations regarding versioning rules that deprecates using rc?

Yes, Eask follows the Emacs’ standard. There is documentation out there somewhere on the GNU manual site. Sorry, I couldn't find it since it was a long while ago. 🥲