Subject: [bug#61838] [PATCH v2 01/13] gnu: Add r-simplermarkdown.

From: Ricardo Wurmus <[email-masked]>
Date: Wed, 01 Mar 2023 12:07:20 +0100

Mădălin Ionel Patrașcu <[email-masked]> writes:

> * gnu/packages/cran.scm (r-simplermarkdown): New variable.

Thanks for the update.

Turns out we cannot easily patch references to the pandoc executable.  I
tried this:

--8<---------------cut here---------------start------------->8---
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'patch-pandoc-invocations
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((pandoc (search-input-file inputs "/bin/pandoc")))
                (substitute* '("R/mdtangle.R"
                               "R/mdweave.R"
                               "R/mdweave_to.R")
                  (("'pandoc ")
                   (string-append "'" pandoc " ")))
                (substitute* "R/has_pandoc.R"
                  (("Sys.which\\(\"pandoc\"\\)")
                   (string-append "\"" pandoc "\"")))))))))
--8<---------------cut here---------------end--------------->8---

This works, but the resulting output no longer has any references to
/gnu/store/…-pandoc…/bin/pandoc.  That’s because none of these files
make it to the output.  Instead they all seemingly get squished into a
pair of simplermarkdown.rdx and .rdb files, which are compressed.

So it is safer to propagate pandoc.
This may point to a general problem with the r-build-system that we may
need to investigate later.

-- 
Ricardo