Subject: [bug#59604] [PATCH] gnu: emacs-rec-mode: Patch executable paths.

From: "(" <[email-masked]>
Date: Sat, 26 Nov 2022 10:09:05 +0000

* gnu/packages/databases.scm (emacs-rec-mode)[source]: Add FILE-NAME.
[arguments]: Use G-expressions.
<#:phases>{'patch-program-paths}: New phase.
[inputs]: Add RECUTILS.
---
 gnu/packages/databases.scm | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index e4dde1b22b..d9930de8fd 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -1625,24 +1625,32 @@ (define-public emacs-rec-mode
               (method url-fetch)
               (uri (string-append "https://elpa.gnu.org/packages/"
                                   "rec-mode-" version ".tar"))
+              (file-name (string-append name "-" version ".tar"))
+              (snippet #~(delete-file "rec-mode.info"))
               (sha256
                (base32
-                "1w1q6kh567fd8xismq9i6wr1y893lypd30l452yvydi1qjiq1n6x"))
-              (snippet '(begin (delete-file "rec-mode.info")))))
+                "1w1q6kh567fd8xismq9i6wr1y893lypd30l452yvydi1qjiq1n6x"))))
     (build-system emacs-build-system)
     (arguments
-     '(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'make-info
-           (lambda _
-             (invoke "makeinfo" "--no-split"
-                     "-o" "rec-mode.info" "rec-mode.texi"))))))
-    (native-inputs
-     (list texinfo))
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'patch-program-paths
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (emacs-substitute-variables "rec-mode.el"
+                     ("rec-recfix" (search-input-file inputs "bin/recfix"))
+                     ("rec-recinf" (search-input-file inputs "bin/recinf"))
+                     ("rec-recsel" (search-input-file inputs "bin/recsel")))))
+               (add-before 'install 'make-info
+                 (lambda _
+                   (invoke "makeinfo" "--no-split"
+                           "-o" "rec-mode.info" "rec-mode.texi"))))))
+    (inputs (list recutils))
+    (native-inputs (list texinfo))
     (home-page "https://www.gnu.org/software/recutils/")
     (synopsis "Emacs mode for working with recutils database files")
-    (description "This package provides an Emacs major mode @code{rec-mode}
-for working with GNU Recutils text-based, human-editable databases.  It
+    (description
+     "This package provides an Emacs major mode @code{rec-mode} for
+working with GNU Recutils text-based, human-editable databases.  It
 supports editing, navigation, and querying of recutils database files
 including field and record folding.")
     (license license:gpl3+)))

base-commit: 4a97591d0a13e88037b3073bd891bcdf35352f87
-- 
2.38.1