Subject: Re: bug#26678: [PATCH] gnu: Add emacs-gnuplot-mode.

From: Alex Kost <[email-masked]>
Date: Sat, 29 Apr 2017 17:10:54 +0300

Arun Isaac (2017-04-27 15:55 +0530) wrote:

> * gnu/packages/emacs.scm (emacs-gnuplot-mode): New variable.
> ---
>  gnu/packages/emacs.scm | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)

Thanks!  The patch looks good to me, the only thing: it would be good to
generate "…-autoloads.el" file (see below) to make "M-x gnuplot-mode"
available right away, otherwise a user has to adjust ".emacs" to
autoload it.

> diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
> index 14d851184..b5307f56a 100644
> --- a/gnu/packages/emacs.scm
> +++ b/gnu/packages/emacs.scm
> @@ -4519,3 +4519,33 @@ It should enable you to implement low-level X11 applications.")
>      (description "EXWM is a full-featured tiling X window manager for Emacs
>  built on top of XELB.")
>      (license license:gpl3+)))
> +
> +(define-public emacs-gnuplot-mode
> +  (package
> +    (name "emacs-gnuplot-mode")

BTW this package is called "gnuplot" on MELPA, because there is another
"gnuplot-mode" (also available on MELPA):

  https://github.com/mkmcc/gnuplot-mode

Perhaps we should stick to the MELPA names, otherwise it may be
confusing if we call this package "gnuplot-mode", WDYT?

> +    (version "0.7.0")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append
> +             "https://github.com/bruceravel/gnuplot-mode/archive/"
> +             version ".tar.gz"))
> +       (file-name (string-append name "-" version ".tar.gz"))
> +       (sha256
> +        (base32
> +         "0glzymrn138lwig7p4cj17x4if5jisr6l4g6wcbxisqkqgc1h01i"))))
> +    (build-system gnu-build-system)
> +    (native-inputs `(("emacs" ,emacs-minimal)))
> +    (arguments
> +     `(#:configure-flags
> +       (list (string-append "EMACS=" (assoc-ref %build-inputs "emacs")
> +                            "/bin/emacs")
> +             (string-append "--with-lispdir="
> +                            (assoc-ref %outputs "out")
> +                            "/share/emacs/site-lisp/guix.d/gnuplot-mode-"
> +                            ,version))))

To generate "autoloads.el", the 'arguments' could be written like this:

    (arguments
     (let ((elisp-dir (string-append "/share/emacs/site-lisp/guix.d"
                                     "/gnuplot-mode-" version)))
       `(#:modules ((guix build gnu-build-system)
                    (guix build utils)
                    (guix build emacs-utils))
         #:imported-modules (,@%gnu-build-system-modules
                             (guix build emacs-utils))
         #:configure-flags
         (list (string-append "EMACS=" (assoc-ref %build-inputs "emacs")
                              "/bin/emacs")
               (string-append "--with-lispdir=" %output ,elisp-dir))
         #:phases
         (modify-phases %standard-phases
           (add-after 'install 'generate-autoloads
             (lambda* (#:key outputs #:allow-other-keys)
               (emacs-generate-autoloads
                "gnuplot"
                (string-append (assoc-ref outputs "out") ,elisp-dir))
               #t))))))

> +    (home-page "https://github.com/bruceravel/gnuplot-mode")
> +    (synopsis "Emacs major mode for interacting with gnuplot")
> +    (description "@code{emacs-gnuplot-mode} is an emacs major mode for
> +interacting with gnuplot.")
> +    (license license:gpl2+)))

-- 
Alex