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

Don't link if the `-pkg.el` file is not found #131

Open Fuco1 opened 1 year ago

Fuco1 commented 1 year ago

I tried to link trinary devel version from my local git repo but it also installs the version from melpa

> eask link add trinary /home/matus/.emacs.d/projects/trinary-logic                                                                                                                                      (1) :master
Running Eask in the development environment
Press Ctrl+C to cancel.

Executing script inside Emacs...

✓ Checking Emacs version 28.2... done!
✓ Checking system gnu/linux... done!
✓ Try constructing the package-descriptor (elsa.el)... succeeded!
Unmatched website URL ’https://github.com/emacs-elsa/Elsa’; add ;; URL: https://github.com/emacs-elsa/Elsa to package-file
Unmatched dependency ’cl-lib’; add (depends-on "cl-lib") to Eask-file or consider removing it
Unmatched dependency ’seq’; add (seq "VERSION") to package-file or consider removing it
✓ Loading Eask file in /home/matus/.emacs.d/projects/Elsa/Eask... done!

Package-file seems to be missing ‘trinary.el’
Installing 5 package dependencies...
Loading package information... done ✓
  - Installing dash (20221013.836)... done ✓
  - Skipping seq (2.23)... already installed ✗
  - Installing f (20230116.1032)... done ✓
  - Installing trinary (20230225.1944)... done ✓
  - Installing lsp-mode (20230227.1358)... done ✓
(Total of 4 dependencies installed, 1 skipped)

✓ Created link from /home/matus/.emacs.d/projects/trinary-logic to trinary-1.2.1

✓ You have now created the link, here are things you might want to consider:

  - [ ] ‘SOURCE-pkg.el‘ file                                  Package descriptor
  - [ ] (Optional) ‘SOURCE-autoloads.el‘                      Package autoloads
  - [ ] (Optional) Compile source package with ‘.elc‘ files   Use ‘.elc‘ may be metter choice

If the source package uses Eask, you can use ‘eask‘ commands to accomplish these tasks.

  * ‘eask pkg-file‘
  * ‘eask autoloads‘
  * ‘eask compile‘

The resulting directory structure

image

jcs090218 commented 1 year ago

It seems like you need a -pkg.el file in your trinary package, or else package.el would not recognize it as a package. Then you do eask install trinary it will show as skipped,

Loading package information... done
Installing 1 specified package...
  - Skipping trinary (1.2.1)... already installed

(Total of 0 package installed, 1 skipped)

You can generate it with eask pkg-file.

Output eask list --depth 0

Error loading autoloads: (file-missing Cannot open load file No such file or directory d:/_workspace/openai/.eask/29.0.60/elpa/trinary-1.2.1/trinary-autoloads)
 [+] tblui          20161007.1912    Define tabulated list UI easily
 [+] tablist        20200427.2205    Extended tabulated-list-mode
 [+] request        20230127.417     Compatible layer for URL request
 [+] magit-popup    20200719.1015    Define prefix-infix-suffix command combos
 [+] elsa           20230227.1727    Emacs Lisp Static Analyser
 [+] lsp-mode       20230227.1358    LSP mode
 [+] lv             20200507.1518    Other echo area
 [+] markdown-mode  20230227.342     Major mode for Markdown-formatted text
 [+] spinner        1.7.4            Add spinners and progress-bars to the mode-line for ongoing operations
 [+] ht             20230214.1632    The missing hash table library for Emacs
 [+] f              20230116.1032    Modern API for working with files and directories
 [+] s              20220902.1511    The long lost Emacs string manipulation library.
 [+] trinary        1.2.1            Trinary logic
 [+] dash           20221013.836     A modern list library for Emacs

(Total of 14 packages installed)
Fuco1 commented 1 year ago

Ah I see now that it prints Package-file seems to be missing ‘trinary.el’. But I missed it in all the output. Maybe we should add some red cross or something so it stands out a bit more? Or actually, I think I would prefer the link command to just fail if it's not possible to link.

jcs090218 commented 1 year ago

Yeah, the current behavior is from Cask. It might be easier if we just require a pkg.el file. The current logic is kinda complex,

https://github.com/emacs-eask/cli/blob/dfac98b2dfb2feb2369b618522507cc201475fe3/lisp/link/add.el#L49-L92

jcs090218 commented 1 year ago

I've opened a PR in #133. Can you try this branch?

Fuco1 commented 1 year ago

I tried linking another package (ansi.el) and it works better now indeed. It's much less confusing.

But actually, assuming the other project is using Eask as well, maybe we could generate the package file there automatically?

jcs090218 commented 1 year ago

But actually, assuming the other project is using Eask as well, maybe we could generate the package file there automatically?

That's was my first thought, but I don't know generating files somewhere else (consider link outside of the project) provides the best UX. Two things I am considering:

  1. Best UX
  2. Generating outside of project may cause confusion? 🤔
  3. Maybe we can create a custom variable so users can customize in the Eask-file?

I may just think too much. 😅

Fuco1 commented 1 year ago

Actually yea, you're right about point 2.

I would then just change the wording on this

Options are,

  - [ ] Use ‘eask pkg-file‘ to create one
  - [ ] Write your own ‘-pkg.el‘ file

to emphasize more that you need to run eask pkg-file in the other (linked) project.

jcs090218 commented 1 year ago

I've implemented the behavior in #139. I think not enough people use Eask + link, so I've added to see what people think. Let me know if we should revert this. ;)

to emphasize more that you need to run eask pkg-file in the other (linked) project.

Would you like to open a PR for this? 😁Like this?

- Options are,
+ Options are, (in linked project)

    - [ ] Use ‘eask pkg-file‘ to create one
    - [ ] Write your own ‘-pkg.el‘ file