Subject: [bug#53279] [PATCH] gnu: Add emacs-dtache

From: Nicolas Goaziou <[email-masked]>
Date: Sat, 15 Jan 2022 21:25:05 +0100

Hello,

Niklas Eklund <[email-masked]> writes:

> +(define-public emacs-dtache
> +  (package
> +    (name "emacs-dtache")
> +    (version "0.3")

Thank you.

> +    (native-inputs (list emacs-ert-runner))
> +    (inputs (list dtach))

Nitpick: native-inputs and inputs are usually located after arguments
and build-system.

Adding "dtach" to input is insufficient. You also need to set
`dtache-dtach-program' so it points to the dtach program provided as an
input. Likewise, you also need to set `dtache-shell-program' so it
points to the bash from the package inputs.

For example, you can do the first step with the following phase:

--8<---------------cut here---------------start------------->8---
(add-after 'unpack 'locate-dtach
  (lambda* (#:key inputs #:allow-other-keys)
    (make-file-writable "dtache.el")
    (emacs-substitute-variables "dtache.el"
      ("dtache-dtach-program"
       (search-input-file inputs "/bin/dtach")))))
--8<---------------cut here---------------end--------------->8---

> +    (arguments
> +     `(#:test-command '("ert-runner")
> +       #:phases
> +       ,#~(modify-phases %standard-phases
> +            (add-before 'install 'install-dtache-env
> +              (lambda _
> +                (let ((bin (string-append #$output "/bin")))
> +                  (mkdir-p bin)
> +                  (copy-file "dtache-env"
> +                             (string-append bin "/dtache-env"))))))))

You can simplify the arguments further:

--8<---------------cut here---------------start------------->8---
(arguments
 (list
  #:test-command #~(list "ert-runner")
  #:phases
  #~(modify-phases %standard-phases
      (add-before 'install 'install-dtache-env
        (lambda _
          (install-file "dtache-env" (string-append #$output "/bin")))))))
--8<---------------cut here---------------end--------------->8---

Could you send an updated patch?

Regards,
-- 
Nicolas Goaziou