emacscollective / epkg

Browse the Emacsmirror package database
https://emacsmirror.net/manual/epkg
GNU General Public License v3.0
55 stars 7 forks source link

Installing `epkg` on emacs-26.1 is broken #16

Closed aplaice closed 6 years ago

aplaice commented 6 years ago

To reproduce:

With a fresh Emacs profile (for instance using HOME=/alternative/path/ emacs), add the following to .emacs.d/init.el:

(custom-set-variables
 '(package-archives
   (quote
    (("gnu" . "https://elpa.gnu.org/packages/")
     ("melpa" . "https://melpa.org/packages/")))))

(package-initialize)
(package-refresh-contents)

(setq packages-to-install '(epkg))
(dolist (package packages-to-install)
  (unless
    (package-installed-p package)
    (package-install package)))

(setq epkg-repository "/path/to/existing/epkg/repo") ;; This isn't necessary, but saves time cloning the repo

Open Emacs, run M-x epkg-list-packages and try to select one of the packages (with the mouse or clicking enter).

Expected result:

epkg and its dependencies are installed without errors, M-x epkg-list-packages lists the packages and selecting one of the packages displays information about it.

Actual result:

During the byte-compilation of epkg the following (non-fatal) warning is raised:

Warning (bytecomp): Unused lexical argument ‘ident’
Warning (bytecomp): ‘(row (car (emacsql db [:select * :from $i1 :where (= $i2 $s3)] (oref-default class closql-table) (oref-default class closql-primary-key) ident)))’ is a malformed function
Warning (bytecomp): reference to free variable ‘row’
Warning (bytecomp): the function ‘when-let’ is not known to be defined.

M-x epkg-list-packages works as expected. However, trying to select a package results in the following error message (and no information displayed):

Invalid function: (row (car (emacsql db [:select * :from $i1 :where (= $i2 $s3)] (oref-default class closql-table) (oref-default class closql-primary-key) ident)))

Further information

Weirdly, if use-package is installed before epkg none of the above issues occur (i.e. there's no warning message during compilation and selecting packages works). Hence, an init.el with:

(custom-set-variables
 '(package-archives
   (quote
    (("gnu" . "https://elpa.gnu.org/packages/")
     ("melpa" . "https://melpa.org/packages/")))))

(package-initialize)
(package-refresh-contents)

(setq packages-to-install '(use-package epkg))
(dolist (package packages-to-install)
  (unless
    (package-installed-p package)
    (package-install package)))

(setq epkg-repository "/path/to/existing/epkg/repo") ;; This isn't necessary, but saves time cloning the repo

will result in a functioning epkg.

In contrast, one with the order of installation of epkg and use-package switched:

(custom-set-variables
 '(package-archives
   (quote
    (("gnu" . "https://elpa.gnu.org/packages/")
     ("melpa" . "https://melpa.org/packages/")))))

(package-initialize)
(package-refresh-contents)

(setq packages-to-install '(epkg use-package))
(dolist (package packages-to-install)
  (unless
    (package-installed-p package)
    (package-install package)))

(setq epkg-repository "/path/to/existing/epkg/repo") ;; This isn't necessary, but saves time cloning the repo

results in a broken epkg (all of the above-mentioned issues are present).

If one diffs the .emacs.d directory trees corresponding to these two cases (use-package installed first or second), the only differing file is the byte-compiled .emacs.d/elpa/closql-20180616.2122/closql.elc, so it's possible that the actual bug is with closql and it only propages to epkg.

(Even more weirdly, it seems that if one tries to install epkg in a later Emacs session than the one when use-package was installed — i.e. one installs use-package, closes/kills Emacs, restarts Emacs, requires use-package, and then installs epkg — all the above issues are still present.)

Thanks for a great package — in the cases where I can get epkg to work, the interface is really lovely!

tarsius commented 6 years ago

Fixed in https://github.com/emacscollective/closql/commit/faed079570c2e70b0e4988177e35b7990afa4752.

aplaice commented 6 years ago

Thanks!