Subject: [bug#27790] text-editor: mg

From: Tobias Geerinckx-Rice <[email-masked]>
Date: Sat, 22 Jul 2017 16:24:29 +0200

ng0,

Thanks! Some minor points, most of which can be taken care of by the
committer (i.e. probably me) when they push:

ng0 wrote on 22/07/17 at 13:36:
> From d1cae87a9b13b5624deb16666a1da3333bd05681 Mon Sep 17 00:00:00 2001
> From: ng0 <[email-masked]>
> Date: Sat, 22 Jul 2017 11:31:37 +0000
> Subject: [PATCH] gnu: Add mg.
> 
> * gnu/packages/text-editors.scm (mg): New variable.
> ---
>  gnu/packages/text-editors.scm | 57 ++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 56 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/text-editors.scm b/gnu/packages/text-editors.scm
> index 98df48119..9277dd1f5 100644
> --- a/gnu/packages/text-editors.scm
> +++ b/gnu/packages/text-editors.scm
> @@ -3,7 +3,7 @@
>  ;;; Copyright © 2016 Carlo Zancanaro <[email-masked]>
>  ;;; Copyright © 2017 Eric Bavier <[email-masked]>
>  ;;; Copyright © 2017 Feng Shu <[email-masked]>
> -;;; Copyright © 2017 ng0 <[email-masked]>
> +;;; Copyright © 2017 ng0 <[email-masked]>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -34,6 +34,7 @@
>    #:use-module (gnu packages gcc)
>    #:use-module (gnu packages glib)
>    #:use-module (gnu packages gtk)
> +  #:use-module (gnu packages libbsd)
>    #:use-module (gnu packages lua)
>    #:use-module (gnu packages ncurses)
>    #:use-module (gnu packages pkg-config)
> @@ -227,3 +228,57 @@ Wordstar-, EMACS-, Pico, Nedit or vi-like key bindings.  e3 can be used on
>  16, 32, and 64-bit CPUs.")
>      (supported-systems '("x86_64-linux" "i686-linux"))
>      (license license:gpl2+)))
> +
> +(define-public mg
> +  (package
> +    (name "mg")
> +    (version "20170401")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append "http://homepage.boetes.org/software/mg/"
> +                           "mg-" version ".tar.gz"))

HTTPS works, so let's use it just because we can. Same for home-page.

> +       (sha256
> +        (base32
> +         "1arasswgdadbb265rahq3867r9s54jva6k4m3p5n0f8mgjqhhdha"))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:tests? #f ; There is no testsuite

s/There/there/, and s/testsuite/test suite/ since I'm already being
pedantic.

> +       #:make-flags (list "CC=gcc")
> +       #:phases
> +       (modify-phases %standard-phases
> +         (delete 'configure) ; There is no configure script

Same here.

> +         (add-before 'build 'replace-usr
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (substitute* "GNUmakefile"
> +               (("/usr/bin/") "")
> +               (("/usr/local")
> +                (assoc-ref outputs "out")))
> +             #t))
> +         (add-before 'build 'correct-location-of-difftool
> +           (lambda _
> +             (substitute* "buffer.c"
> +               (("/usr/bin/diff")
> +                (which "diff")))

Cool. I learn new things every day.

> +             #t))
> +         (add-before 'install 'install-tutorial
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             ;; This isn't handled by install but is expect

s/expect/expected/, but:

> +             ;; by the tutorial part of mg to be present.

What exactly do you mean by ‘the tutorial part of mg’? I tried C-h t
with no result, and the only mentions of ‘tutorial’ in the tarball are
in the manual page and the tutorial itself.

> +             (let* ((out (assoc-ref outputs "out"))
> +                    (doc (string-append out "/share/doc/mg")))
> +               (install-file "tutorial"
> +                             (string-append doc "/tutorial"))
> +               #t))))))
> +    (inputs
> +     `(("ncurses" ,ncurses)
> +       ("libbsd" ,libbsd)))
> +    (native-inputs
> +     `(("pkg-config" ,pkg-config)))
> +    (home-page "http://homepage.boetes.org/software/mg/")
> +    (synopsis "OpenBSD variant of the editor mg")

This appears to be the canonical modern ‘portable’ mg, so I'd move the
OpenBSD bit to the description. We're packaging this as mg, after all,
not mg-openbsd. What do you think of "Small and fast text editor in the
style of GNU Emacs"?

> +    (description
> +     "Mg is a public domain text editor intended to loosely resemble
> +GNU Emacs, while still retaining fast speed and a small memory footprint.
> +It is based on MicroEMACS.")

‘Public-domain’ can be dropped, and IMO so can its MicroEMACS history.
This does leave us with a very short description indeed...

> +    (license license:public-domain)))

True freedom™!

T G-R