Subject: bug#48331: Emacs' describe-package doesn't work for packages managed by guix

From: Leo Prikler <[email-masked]>
Date: Wed, 19 May 2021 20:42:37 +0200

That looks like it'd mess with people's installed ELPA packages.  In
general, hacks based on package-directory-list don't feel very stable. 
Consider writing a function similar in nature to `package-load-all-
descriptors' instead.

Also, this seems to rely on us not deleting the -pkg.el, but probably
won't work for packages, that don't ship it, e.g. emacs-howm.

[Adding Arun Isaac to CC.  Their commit d8796851 is the first one to
drop -pkg.el, but without explanation.]

Am Mittwoch, den 19.05.2021, 20:58 +0300 schrieb Andrew Tropin:
> From: Andrew Tropin <[email-masked]>
> Date: Wed, 19 May 2021 20:44:22 +0300
> Subject: [PATCH] guix: build: emacs-build-system: Make package.el
> aware of
>  guix packages
> 
> After updating the package-directory-list variable, functions like
> list-packages,
> describe-package become aware of packages installed by guix.
> 
> ---
> This code is getting work done, but I'm not a very experienced elisp
> developer, so
> please review it thoroughly.
> 
>  gnu/packages/aux-files/emacs/guix-emacs.el | 10 ++++++++++
>  guix/build/emacs-build-system.scm          |  2 +-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el
> b/gnu/packages/aux-files/emacs/guix-emacs.el
> index ca9146c535..4aa4220cda 100644
> --- a/gnu/packages/aux-files/emacs/guix-emacs.el
> +++ b/gnu/packages/aux-files/emacs/guix-emacs.el
> @@ -58,6 +58,16 @@ The files in the list do not have extensions (.el,
> .elc)."
>              (load f 'noerror))
>            autoloads)))
> 
> +
> +(require 'package)
> +
> +;; Set `package-directory-list' to the value without elpa/ suffix
> +;; to match the structure of site-lisp directory of guix's emacs
> +;; build system.
> +;;;###autoload
> +(setq package-directory-list
> +      (list (string-remove-suffix "/elpa" (car package-directory-
> list))))
> +
>  (provide 'guix-emacs)
> 
>  ;;; guix-emacs.el ends here
> diff --git a/guix/build/emacs-build-system.scm
> b/guix/build/emacs-build-system.scm
> index e41e9a6595..7565b9a422 100644
> --- a/guix/build/emacs-build-system.scm
> +++ b/guix/build/emacs-build-system.scm
> @@ -53,7 +53,7 @@
> 
>  ;; These are the default inclusion/exclusion regexps for the install
> phase.
>  (define %default-include '("^[^/]*\\.el$" "^[^/]*\\.info$"
> "^doc/.*\\.info$"))
> -(define %default-exclude '("^\\.dir-locals\\.el$" "-pkg\\.el$"
> +(define %default-exclude '("^\\.dir-locals\\.el$"
>                             "^[^/]*tests?\\.el$"))
> 
>  (define gnu:unpack (assoc-ref gnu:%standard-phases 'unpack))