diff mbox series

[bug#62664,WIP] gnu: Add emacs-copilot.

Message ID 20230404143043.3202-1-Rostislav.Svoboda@gmail.com
State New
Headers show
Series [bug#62664,WIP] gnu: Add emacs-copilot. | expand

Commit Message

Rostislav Svoboda April 4, 2023, 2:30 p.m. UTC
---
 gnu/packages/emacs-xyz.scm | 46 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

Comments

Rostislav Svoboda April 4, 2023, 2:35 p.m. UTC | #1
As hinted in the commit message, this patch is Work-In-Progress,
waiting for Node v16+ to become available as a Guix package. I.e. this
patch is not ready for integration in the upstream, yet
However I assume some folks may benefit from it, anyway.

Cheers Bost

Le mar. 4 avr. 2023 à 16:31, Rostislav Svoboda
<rostislav.svoboda@gmail.com> a écrit :
>
> ---
>  gnu/packages/emacs-xyz.scm | 46 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
>
> diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
> index 2b96c60057..d037fa9075 100644
> --- a/gnu/packages/emacs-xyz.scm
> +++ b/gnu/packages/emacs-xyz.scm
> @@ -36689,6 +36689,52 @@ (define-public emacs-tintin-mode
>        (description "This major mode focuses on highlighting as many aspects of the TinTin++ scripting language as possible, organizing commands into functional categories and highlighting specific modes that many commands use to accomplish different tasks.")
>        (license license:asl2.0))))
>
> +(define-public emacs-copilot
> +  (let ((commit "e11847ab0c3b183a1e53fbc1ac587de82912b9cf")
> +        (revision "0"))
> +    (package
> +      (name "emacs-copilot")
> +      (version (git-version "0" revision commit))
> +      (source
> +       (origin
> +         (method git-fetch)
> +         (uri (git-reference
> +               (url "https://github.com/zerolfx/copilot.el.git")
> +               (commit commit)))
> +         (file-name (git-file-name name version))
> +         (sha256
> +          (base32
> +           "0gsxb268vqyim65ag8d7dlgdqyxqrjcjirlnbfbfq0pdr1y2158q"))))
> +      (build-system emacs-build-system)
> +      (arguments
> +       (list
> +        #:include #~(cons "^dist/" %default-include)
> +        #:phases
> +        #~(modify-phases %standard-phases
> +            (add-after 'unpack 'substitute-copilot-node-executable
> +              (lambda* (#:key inputs #:allow-other-keys)
> +                (emacs-substitute-variables "copilot.el"
> +                  ("copilot-node-executable"
> +;;; Copilot requires Node 16+, however packaging v16 and/or v18 is not
> +;;; trivial. See https://issues.guix.gnu.org/53414,
> +;;; https://issues.guix.gnu.org/59188 .
> +;;;
> +;;; As a hack, download and compile recent Node version manually.
> +                   (format #f "%s/node-v18.15.0/out/Release/node" (getenv "dev")) ; Remove this line when Node 16+ becomes available as a Guix package.
> +                   ;; (search-input-file inputs "/bin/node")                      ; Activate this line when Node 16+ becomes available as a Guix package.
> +                   )))))))
> +      ;; (inputs (list node))                                                     ; Activate this line when Node 16+ becomes available as a Guix package.
> +      (propagated-inputs
> +       (list emacs-dash emacs-editorconfig emacs-s))
> +      (home-page
> +       "https://github.com/zerolfx/copilot.el.git")
> +      (synopsis "An unofficial Copilot plugin for Emacs")
> +      (description
> +       "Copilot.el is an Emacs plugin for GitHub Copilot. This plugin is
> +unofficial and based on binaries provided by copilot.vim. Note: You need
> +access to GitHub Copilot to use this plugin.")
> +      (license license:gpl3+))))
> +
>  ;;;
>  ;;; Avoid adding new packages to the end of this file. To reduce the chances
>  ;;; of a merge conflict, place them above by existing packages with similar
> --
> 2.39.2
>
jgart April 4, 2023, 2:54 p.m. UTC | #2
Hi Rostislav,

Thanks for this patch. It builds fine for me. Linter complains about a few nitpicks regarding line lengths and article of synopsis.

I added your patch as a pre-release to Guix "R" Us:

https://git.sr.ht/~whereiseveryone/guixrus/commit/4fe9054f758c022ef757773b9870cbd548bde26d

I'll let you know if we run into any other issues when trying the package from Guix "R" Us.

all best,

jgart

https://whereis.みんな/
https://toys.whereis.みんな/
Liliana Marie Prikler April 4, 2023, 7:19 p.m. UTC | #3
Am Dienstag, dem 04.04.2023 um 16:30 +0200 schrieb Rostislav Svoboda:
> +       "Copilot.el is an Emacs plugin for GitHub Copilot. This
> plugin is
> +unofficial and based on binaries provided by copilot.vim. Note: You
> need
> +access to GitHub Copilot to use this plugin.")
> +      (license license:gpl3+))))
Given that this package is based on binaries, and the fact that Github
Copilot has attracted a wide variety of concerns regarding licensing,
privacy and autocompleted vulnerabilities, I think we can do better
without it :)

Cheers
Giovanni Biscuolo April 5, 2023, 1:07 p.m. UTC | #4
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Dienstag, dem 04.04.2023 um 16:30 +0200 schrieb Rostislav Svoboda:
>> +       "Copilot.el is an Emacs plugin for GitHub Copilot. This
>> plugin is
>> +unofficial and based on binaries provided by copilot.vim. Note: You
>> need
>> +access to GitHub Copilot to use this plugin.")
>> +      (license license:gpl3+))))
> Given that this package is based on binaries,

binaries are wasm files in "dist" folder:
https://github.com/zerolfx/copilot.el/tree/main/dist

--8<---------------cut here---------------start------------->8---
tree-sitter-go.wasm
tree-sitter-javascript.wasm
tree-sitter-python.wasm
tree-sitter-ruby.wasm
tree-sitter-typescript.wasm
tree-sitter.wasm
--8<---------------cut here---------------end--------------->8---

AFAIU taken by copilot.vim repo:
https://github.com/github/copilot.vim/tree/release/copilot/dits

> and the fact that Github
> Copilot has attracted a wide variety of concerns regarding licensing,
> privacy and autocompleted vulnerabilities, I think we can do better
> without it :)

For what it matters, I totally agree with Liliana

Thanks! Gio'
Brian Cully April 6, 2023, 7:34 p.m. UTC | #5
> Given that this package is based on binaries, and the fact that Github
> Copilot has attracted a wide variety of concerns regarding licensing,
> privacy and autocompleted vulnerabilities, I think we can do better
> without it :)

I came to this ticket to make this same comment.
jgart April 7, 2023, 5 a.m. UTC | #6
Hi,

The author is making an effort to prepare copilot.el for submission to MELPA:

https://github.com/zerolfx/copilot.el/issues/120

This package is obviously not ready for GNU Guix at this moment given the vendored WASM, etc. but let's give the project maintainer a chance to see how they manage to prepare this Emacs package for inclusion in MELPA.
diff mbox series

Patch

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 2b96c60057..d037fa9075 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -36689,6 +36689,52 @@  (define-public emacs-tintin-mode
       (description "This major mode focuses on highlighting as many aspects of the TinTin++ scripting language as possible, organizing commands into functional categories and highlighting specific modes that many commands use to accomplish different tasks.")
       (license license:asl2.0))))
 
+(define-public emacs-copilot
+  (let ((commit "e11847ab0c3b183a1e53fbc1ac587de82912b9cf")
+        (revision "0"))
+    (package
+      (name "emacs-copilot")
+      (version (git-version "0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/zerolfx/copilot.el.git")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "0gsxb268vqyim65ag8d7dlgdqyxqrjcjirlnbfbfq0pdr1y2158q"))))
+      (build-system emacs-build-system)
+      (arguments
+       (list
+        #:include #~(cons "^dist/" %default-include)
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'substitute-copilot-node-executable
+              (lambda* (#:key inputs #:allow-other-keys)
+                (emacs-substitute-variables "copilot.el"
+                  ("copilot-node-executable"
+;;; Copilot requires Node 16+, however packaging v16 and/or v18 is not
+;;; trivial. See https://issues.guix.gnu.org/53414,
+;;; https://issues.guix.gnu.org/59188 .
+;;;
+;;; As a hack, download and compile recent Node version manually.
+                   (format #f "%s/node-v18.15.0/out/Release/node" (getenv "dev")) ; Remove this line when Node 16+ becomes available as a Guix package.
+                   ;; (search-input-file inputs "/bin/node")                      ; Activate this line when Node 16+ becomes available as a Guix package.
+                   )))))))
+      ;; (inputs (list node))                                                     ; Activate this line when Node 16+ becomes available as a Guix package.
+      (propagated-inputs
+       (list emacs-dash emacs-editorconfig emacs-s))
+      (home-page
+       "https://github.com/zerolfx/copilot.el.git")
+      (synopsis "An unofficial Copilot plugin for Emacs")
+      (description
+       "Copilot.el is an Emacs plugin for GitHub Copilot. This plugin is
+unofficial and based on binaries provided by copilot.vim. Note: You need
+access to GitHub Copilot to use this plugin.")
+      (license license:gpl3+))))
+
 ;;;
 ;;; Avoid adding new packages to the end of this file. To reduce the chances
 ;;; of a merge conflict, place them above by existing packages with similar