diff mbox series

[bug#41366,4/4] gnu: Add emacs-importmagic.

Message ID teSJzl5ZJmyFGIPgKRWlybzSW9oX3F5ygHglHRzZ5SXWqVaeDqcnW5d3nJJmEt_963MKLNLPZw3ik1laj28gVxvqa7Nie4z_XYEq5iF-odI=@protonmail.com
State New
Headers show
Series None | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job

Commit Message

ashish.is--- via Guix-patches" via May 23, 2020, 7:27 p.m. UTC
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, May 23, 2020 7:02 PM, Marius Bakke <mbakke@fastmail.com> wrote:

> This patch did not apply for me somehow

Looks like a conflict in the copyright line. (Something something lawyers.) New patch attached!

> I applied the other three, all LGTM.

Thank you!


Ryan

Comments

Nicolas Goaziou May 23, 2020, 8 p.m. UTC | #1
Hello,

Ryan Prior via Guix-patches via <guix-patches@gnu.org> writes:

> +    (propagated-inputs
> +     `(("emacs-epc" ,emacs-epc)
> +       ("emacs-f" ,emacs-f)
> +       ("python-epc" ,python-epc)
> +       ("python-importmagic" ,python-importmagic)))

OOC, are you sure Python packages need to be propagated in this case?

Regards,
ashish.is--- via Guix-patches" via May 23, 2020, 8:41 p.m. UTC | #2
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, May 23, 2020 8:00 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

> OOC, are you sure Python packages need to be propagated in this case?

Hi Nicholas! I tried it with the python packages in "inputs" and impotmagic.el complained about not being able to find them. I'm going to be helping with maintenance of importmagic.el so maybe that's something I can fix on the package side?

At present this seems to work better. I don't know yet what the difference is between inputs and propagated-inputs when it comes to Python packages so maybe somebody else might have a better answer.

Ryan
Marius Bakke May 23, 2020, 9:12 p.m. UTC | #3
Ryan Prior <rprior@protonmail.com> writes:

> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Saturday, May 23, 2020 8:00 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
>> OOC, are you sure Python packages need to be propagated in this case?
>
> Hi Nicholas! I tried it with the python packages in "inputs" and impotmagic.el complained about not being able to find them. I'm going to be helping with maintenance of importmagic.el so maybe that's something I can fix on the package side?
>
> At present this seems to work better. I don't know yet what the difference is between inputs and propagated-inputs when it comes to Python packages so maybe somebody else might have a better answer.

The difference is that propagated-inputs will be installed to the
profile when you 'guix install emacs-importmagic'.

Propagating these will only work if the user already has 'python' in the
profile, which sets up PYTHONPATH.

For regular executables, we solve this by "wrapping" the executable with
PYTHONPATH to avoid the need for propagation.

Ideally we'd patch importmagic.el so that it automatically sets
PYTHONPATH referring to these two packages (prepending to any existing
PYTHONPATH).  I think python-shell-interpreter also should use the
absolute file name of the "python" executable so it does not have to be
installed separately.

Do you think that can work?

Thanks for chiming in Nicolas, I had completely missed those propagated
Python packages.  :-)
ashish.is--- via Guix-patches" via May 23, 2020, 9:18 p.m. UTC | #4
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, May 23, 2020 9:12 PM, Marius Bakke <mbakke@fastmail.com> wrote:

> Do you think that can work?

I'm going to look into it. Prepending the PYTHONPATH and manipulating the python-shell-interpreter doesn't sound like it should be tricky.

Do you by chance know of other Emacs packages in Guix which do this kind of patching so I can look at an example? I'll do some grepping around and see what I can find, or just try something and iterate from there.


Ryan
diff mbox series

Patch

From fdb49b29a29c2955a7efe39a0d20f0a8a0752bb4 Mon Sep 17 00:00:00 2001
From: Ryan Prior <rprior@protonmail.com>
Date: Sun, 17 May 2020 12:56:00 -0500
Subject: [PATCH] gnu: Add emacs-importmagic.

* gnu/packages/emacs-xyz.py (emacs-importmagic): New variable.
---
 gnu/packages/emacs-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index fe68a56fd6..94f5fdbb4e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -71,6 +71,7 @@ 
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2020 pinoaffe <pinoaffe@airmail.cc>
 ;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -16672,6 +16673,28 @@  provided by other Emacs packages dealing with pass:
 image, rotate it, save modified images, and more.")
       (license license:gpl3+))))
 
+(define-public emacs-importmagic
+  (package
+    (name "emacs-importmagic")
+    (version "20180520.303")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://melpa.org/packages/importmagic-" version ".tar"))
+       (sha256
+        (base32 "0xk4i4x4836ksv2pr3aarpbkq6b5sz8c3y6f39fwf698v8zirhs9"))))
+    (build-system emacs-build-system)
+    (propagated-inputs
+     `(("emacs-epc" ,emacs-epc)
+       ("emacs-f" ,emacs-f)
+       ("python-epc" ,python-epc)
+       ("python-importmagic" ,python-importmagic)))
+    (home-page "https://github.com/anachronic/importmagic.el")
+    (synopsis "Fix Python imports")
+    (description "Importmagic.el fixes unresolved imports in Python buffers.")
+    (license license:gpl3)))
+
 (define-public emacs-package-lint
   (let ((commit "69bb89d00ba212b734c676ad056aa793c450b288"))
     (package
-- 
2.26.2