guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#74158] [PATCH 3/4] * gnu/packages/text-editors.scm (parinfer-rust-e


From: Nicolas Graves
Subject: [bug#74158] [PATCH 3/4] * gnu/packages/text-editors.scm (parinfer-rust-emacs): New variable.
Date: Sun, 03 Nov 2024 21:30:26 +0100

On 2024-11-01 13:28, Lee Thompson wrote:

> Change-Id: I6c6fb384edb03b55bae63137576c364cf11e42a5
> ---
>  gnu/packages/text-editors.scm | 53 +++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
>
> diff --git a/gnu/packages/text-editors.scm b/gnu/packages/text-editors.scm
> index fae021f012..027f8adb6c 100644
> --- a/gnu/packages/text-editors.scm
> +++ b/gnu/packages/text-editors.scm
> @@ -467,6 +467,59 @@ (define-public parinfer-rust
>  can load dynamic libraries.")
>      (license license:expat)))
>  
> +(define-public parinfer-rust-emacs
> +  (package
> +    (name "parinfer-rust-emacs")
> +    (version "0.4.6")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/justinbarclay/parinfer-rust-emacs";)
> +             (commit (string-append "v" version))))
> +       (sha256
> +        (base32 "1v5lcbs1x4f3b428sj9rkjbmfpzyxzny7i0pgdpnr8nyjvpkzns8"))
> +       (file-name (git-file-name name version))))
> +    (build-system cargo-build-system)
> +    (arguments
> +     `(#:install-source? #f
> +       #:cargo-inputs (("rust-getopts" ,rust-getopts-0.2)
> +                       ("rust-libc" ,rust-libc-0.2)
> +                       ("rust-emacs" ,rust-emacs-0.19)
> +                       ("rust-serde" ,rust-serde-1)
> +                       ("rust-serde-json" ,rust-serde-json-1)
> +                       ("rust-serde-derive" ,rust-serde-derive-1)
> +                       ("rust-unicode-segmentation" 
> ,rust-unicode-segmentation-1)
> +                       ("rust-unicode-width" ,rust-unicode-width-0.1))

>From here the code is probably correct but a bit old style.
I suggest some replacements below.

> +       #:phases (modify-phases %standard-phases
> +                  (add-after 'install 'install-plugins-and-libs
> +                    (lambda* (#:key outputs #:allow-other-keys)
> +                      (let* ((out (assoc-ref outputs "out"))
> +                             (lib (string-append out "/lib"))

When you use gexpressions, you don't have to refer to out and can use
#$output instead, which make this unecessary.
To use gexpressions, drop the first ` , add a list before
#:install-source, add a ` for cargo inputs, and a #~ before
(modify-phases. Then you can replace out by #$output.

> +                             (vimfiles (string-append out
> +                                        "/share/vim/vimfiles/"
> +                                        "pack/guix/start/parinfer")))
> +                        (with-directory-excursion "target/release"
> +                          (install-file "libparinfer_rust.so" lib))
> +                        (substitute* "plugin/parinfer.vim"
> +                          (("(let s:libdir = ).*" all libdir)
> +                           (format #f "~a'~a'\n" libdir lib)))

This is correct but I would suggest either using string-append instead
of format, or using ~s instead of '~a' if quotes are the same to vim (I
don't know if that's the case).  Note that you can also use ~% instead
of \n. 

> +                        (install-file "doc/parinfer.txt"
> +                                      (string-append vimfiles "/doc"))
> +                        (install-file "plugin/parinfer.vim"
> +                                      (string-append vimfiles "/plugin"))
> +                        (install-file "rc/parinfer.kak"
> +                                      (string-append out 
> "/share/kak/autoload"))))))))
> +    (inputs (list clang))
> +    (home-page "https://github.com/justinbarclay/parinfer-rust-emacs";)
> +    (synopsis "Emacs-centric fork of parinfer-rust")
> +    (description
> +     "A full-featured, super fast implementation of Shaun Lebron’s

You can probably start wiht "This package" or "@command{parinfer-rust}"
provides...

> +@code{parinfer}.  This repo has Vim, Neovim, and Kakoune plugins, and an 
> Emacs
> +plugin is available.  The Rust library can be called from other editors that

If you only install for vim, don't indicate Emacs (unclear).

> +can load dynamic libraries.")
> +    (license license:isc)))
> +
>  (define-public joe
>    (package
>      (name "joe")

-- 
Best regards,
Nicolas Graves





reply via email to

[Prev in Thread] Current Thread [Next in Thread]