Subject: Re: [bug#68180] [PATCH v2 4/4] gnu: Add emacs-pde.

From: Liliana Marie Prikler <[email-masked]>
Date: Tue, 02 Jan 2024 06:22:27 +0100

Am Montag, dem 01.01.2024 um 20:58 -0500 schrieb Maxim Cournoyer:
> * gnu/packages/emacs-xyz.scm (emacs-pde): New variable.
> 
> Change-Id: Icab5d8acf9d441bb4a832a82e75432d64cc77ba7
> ---
> 
> (no changes since v1)
> 
>  gnu/packages/emacs-xyz.scm | 86
> ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 86 insertions(+)
> 
> diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
> index a8ac238f58..fe46342adf 100644
> --- a/gnu/packages/emacs-xyz.scm
> +++ b/gnu/packages/emacs-xyz.scm
> @@ -167,6 +167,7 @@ (define-module (gnu packages emacs-xyz)
>    #:use-module (guix build-system cmake)
>    #:use-module (guix build-system copy)
>    #:use-module (guix build-system emacs)
> +  #:use-module (guix build-system perl)
>    #:use-module (guix build-system trivial)
>    #:use-module (gnu packages)
>    #:use-module (gnu packages admin)
> @@ -271,6 +272,7 @@ (define-module (gnu packages emacs-xyz)
>    #:use-module (gnu packages erlang)
>    #:use-module (gnu packages statistics)
>    #:use-module (gnu packages libcanberra)
> +  #:use-module (gnu packages texinfo)
>    #:use-module (gnu packages virtualization)
>    #:use-module (gnu packages web-browsers)
>    #:use-module (gnu packages wget)
> @@ -12271,6 +12273,90 @@ (define-public emacs-hl-todo
>  regexp that matches all known keywords.")
>      (license license:gpl3+)))
>  
> +(define-public emacs-pde
> +  (package
> +    (name "emacs-pde")
> +    (version "0.2.17")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append
> "mirror://cpan/authors/id/Y/YE/YEWENBIN/Emacs-PDE-v"
> +                           version ".tar.gz"))
> +       (modules '((guix build utils)))
> +       (snippet '(begin
> +                   ;; Delete pre-generated Texinfo and HTML
> documentation.
> +                   (for-each delete-file '("lisp/doc/pde.info"
> +                                           "lisp/doc/pde.html"))
> +                   (delete-file-recursively "lisp/doc/pde")))
> +       (sha256
> +        (base32
> "1i82isha839c8lx73kgp43v7gxr2adsr1yfw1glyxvi62w5ab9qz"))))
> +    (build-system perl-build-system)
> +    (arguments
> +     (list
> +      #:imported-modules `(,@%emacs-build-system-modules
> +                           ,@%perl-build-system-modules)
> +      #:modules '((guix build perl-build-system)
> +                  (guix build emacs-utils)
> +                  (guix build utils))
> +      #:module-build-flags
> +      #~(list (string-append "--elispdir=" #$output
> +                             "/share/emacs/site-lisp/pde")
> +              "--verbose")
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'patch-commands
> +            (lambda* (#:key inputs #:allow-other-keys)
> +              (make-file-writable "lisp/pde-vars.el")
> +              (emacs-substitute-variables "lisp/pde-vars.el"
> +                ("pde-perl-program"
> +                 (search-input-file inputs "bin/perl"))
> +                ("pde-perl-version"
> +                 #$(package-version (this-package-input "perl")))
> +                ("pde-perldoc-program"
> +                 (search-input-file inputs "bin/perldoc"))
> +                ("pde-find-program"
> +                 (search-input-file inputs "bin/find")))
> +              (make-file-writable "lisp/perlcritic.el")
> +              (emacs-substitute-variables "lisp/perlcritic.el"
> +                ("perlcritic-program"
> +                 (search-input-file inputs "bin/perlcritic")))
> +              (make-file-writable "lisp/perldoc.el")
> +              (emacs-substitute-variables "lisp/perldoc.el"
> +                ("perldoc-cache-el"
> +                 "(expand-file-name \"~/.cache/perldoc-cache.el\"")
> +                ("perldoc-pod2man"
> +                 (search-input-file inputs "bin/pod2man")))
> +              (make-file-writable "lisp/perltidy.el")
> +              (emacs-substitute-variables "lisp/perltidy.el"
> +                ("perltidy-program"
> +                 (search-input-file inputs "bin/perltidy")))
> +              (substitute* "lisp/tools/perldoc-cache.pl"
> +                (("`perldoc")
> +                 (string-append
> +                  "`" (search-input-file inputs "bin/perldoc"))))))
I'd use for-each to make the files writable, possibly also a directory
excursion.
> +          (add-after 'build 'generate-doc
> +            (lambda _
> +              (invoke "./Build" "info")))
> +          (add-after 'install 'move-doc
> +            (lambda _
> +              (let ((info (string-append #$output
> "/share/info/pde.info")))
> +                (mkdir-p (dirname info))
> +                (rename-file (string-append
> +                              #$output
> +                              "/share/emacs/site-
> lisp/pde/doc/pde.info")
> +                             info)))))))
> +    (native-inputs (list emacs-minimal perl-module-build texinfo))
> +    (inputs (list findutils perl perl-critic))
> +    (home-page "https://metacpan.org/release/Emacs-PDE")
> +    (synopsis "Perl Development Environment for Emacs")
> +    (description "Emacs::PDE is a collection of Emacs Lisp
> extensions to
> +facilitate Perl programming.  CPerl Mode has provided an excellent
> environment
> +for coding; Emacs::PDE provides other common tools such as creating
> files
> +using templates, smart compiling, @command{perldoc},
> @command{perltidy},
> +debugger, tags tree view and so on.  PDE also provides an easy
> configuration
> +for Perl programing, and a tutorial for novices to start using
> Emacs.")
> +    (license license:perl-license)))
> +

Otherwise LGTM.