From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH 0/2] Add a function to parse emacs elisp's package header Resent-From: Fredrik Salomonsson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 14 May 2022 23:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55420@debbugs.gnu.org Cc: Fredrik Salomonsson X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165256924410025 (code B ref -1); Sat, 14 May 2022 23:01:01 +0000 Received: (at submit) by debbugs.gnu.org; 14 May 2022 23:00:44 +0000 Received: from localhost ([127.0.0.1]:47700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nq0kd-0002bd-W0 for submit@debbugs.gnu.org; Sat, 14 May 2022 19:00:44 -0400 Received: from lists.gnu.org ([209.51.188.17]:47994) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nq0kc-0002bW-Vg for submit@debbugs.gnu.org; Sat, 14 May 2022 19:00:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nq0kc-0005kl-OF for guix-patches@gnu.org; Sat, 14 May 2022 19:00:42 -0400 Received: from mout01.posteo.de ([185.67.36.65]:35929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nq0ka-0000UQ-TQ for guix-patches@gnu.org; Sat, 14 May 2022 19:00:42 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 0B282240026 for ; Sun, 15 May 2022 01:00:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1652569238; bh=ftqUDi9Qb0qOqeFFtbz5VMuJbzTz0CK57bvmOdDiTSg=; h=From:To:Cc:Subject:Date:From; b=m7oce0ZIQsVFmmzMHIZHGeOvlR+4QRgUlBE+5tNPC5uQfkQL+p4u/e5eCZSMwVk9U cGgmmKLfeMsTmp04IQ0wevOzKMgJZWqgZm1Nkr+iyIlJZLn9dEWymzHVrAFh/O5CCJ 2wVm7OapxCAIlRDIUwuE+TxmPUCSsMNUWDf6/1hrT7s/klHDKMNvoQ+azJmyjFXF22 w5Y4TAFn+3mOE94u8DoyAq7dhvVOWyPBKQtKQXnUnAXcWNW1xpH5P+0gcdj+25Vm2U k4HLTU6ek1AOGNDt64uMHiiAh+0mUalVxlnMhTTTuaPidc1XGb4tBEjLg/ACu2oJXz PziwB1yIN1U3Q== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4L11Fd1Jbxz9rxB; Sun, 15 May 2022 01:00:36 +0200 (CEST) From: Fredrik Salomonsson Date: Sat, 14 May 2022 23:00:17 +0000 Message-Id: <20220514230017.27372-1-plattfot@posteo.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=185.67.36.65; envelope-from=plattfot@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) When writing a guix.scm file for an emacs packages, I wanted a way to fetch the version I specify in the header of the elisp file. I found that I could do that with the lisp-mnt library in emacs. Unfortunately none of the emacs utility functions in guix/build/emacs-utils.scm return the output of an elisp expression. With these two patches I aim to add that functionality. I spilt it in two functions: emacs-batch-script: Run an arbitrary elisp expression and return the output as a string. emacs-header-parse: Given a header section and a file it will return the value of that section. For example (emacs-header-parse "version" "path/to/an/elisp/package.el") Reason for the spilt is that people might want to run other elisp snippets. Fredrik Salomonsson (2): guix: emacs-utils: Add emacs-batch-script. guix: emacs-utils: Add emacs-header-parse. guix/build/emacs-utils.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) base-commit: 3935451f63c078cae9a928d87c6838ec3138abc0 -- 2.36.0 From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH 1/2] guix: emacs-utils: Add emacs-batch-script. References: <20220514230017.27372-1-plattfot@posteo.net> In-Reply-To: <20220514230017.27372-1-plattfot@posteo.net> Resent-From: Fredrik Salomonsson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 14 May 2022 23:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55420@debbugs.gnu.org Cc: Fredrik Salomonsson Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.165256952210513 (code B ref 55420); Sat, 14 May 2022 23:06:02 +0000 Received: (at 55420) by debbugs.gnu.org; 14 May 2022 23:05:22 +0000 Received: from localhost ([127.0.0.1]:47705 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nq0p8-0002jU-IL for submit@debbugs.gnu.org; Sat, 14 May 2022 19:05:22 -0400 Received: from mout01.posteo.de ([185.67.36.65]:57871) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nq0p7-0002jG-AC for 55420@debbugs.gnu.org; Sat, 14 May 2022 19:05:21 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 81DBB240026 for <55420@debbugs.gnu.org>; Sun, 15 May 2022 01:05:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1652569515; bh=nLx4SCMIiphivWa8LKGj/QosQ91bRVpPl9ClRBXDdgo=; h=From:To:Cc:Subject:Date:From; b=QlanBXaZby38Pny+B9mYRgIDbAEHP/ixHxJ4GqrEqaf9MJLUQGFr1f/G2AwSlXVeZ cdUD5PRssgyD6ronRXwUcitOkkfSanmftJhPyk0Q6pEMZk8+m7kipuBKoLjkxC4Xgx 0bhrsy5tCwSUInxp6ZNQrHpsAKh/fDugxzn/oWiHkBjdXKQ9dFKllRxgMgchksyet5 +Lvr1+8O+FYUBSehIfmGK09t3J0DzjS9qrSROVRf4oPkPqQW+eA5JQ1VSWSKShJL0h L3fmpxsyWQhpi9m4Y1jP+fqAPwRpFG8T/SHkpSifiE/WxBzqXQI/fV3sPDjVVrfw9N 4QuQDCPpzeibg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4L11Ly4LH7z9rxD; Sun, 15 May 2022 01:05:14 +0200 (CEST) From: Fredrik Salomonsson Date: Sat, 14 May 2022 23:05:07 +0000 Message-Id: <20220514230508.27885-1-plattfot@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/build/emacs-utils.scm (emacs-batch-script): New procedure. --- guix/build/emacs-utils.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index 60a754b9e9..8d40b9e139 100644 --- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2014 Alex Kost ;;; Copyright © 2018, 2020, 2022 Maxim Cournoyer ;;; Copyright © 2019 Liliana Marie Prikler +;;; Copyright © 2022 Fredrik Salomonsson ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,10 +23,13 @@ (define-module (guix build emacs-utils) #:use-module (guix build utils) #:use-module (ice-9 format) + #:use-module (ice-9 popen) + #:use-module (ice-9 rdelim) #:export (%emacs emacs-batch-eval emacs-batch-edit-file emacs-batch-disable-compilation + emacs-batch-script emacs-generate-autoloads emacs-byte-compile-directory @@ -69,6 +73,15 @@ (define (emacs-batch-disable-compilation file) (add-file-local-variable 'no-byte-compile t) (basic-save-buffer)))) +(define (emacs-batch-script expr) + "Execute the Elisp code EXPR in Emacs batch mode and return output." + (call-with-port + (open-pipe* + OPEN_READ + (%emacs) "--quick" "--batch" + (string-append "--eval=" (expr->string expr))) + read-string)) + (define (emacs-generate-autoloads name directory) "Generate autoloads for Emacs package NAME placed in DIRECTORY." (let* ((file (string-append directory "/" name "-autoloads.el")) -- 2.36.0 From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH 2/2] guix: emacs-utils: Add emacs-header-parse. Resent-From: Fredrik Salomonsson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 14 May 2022 23:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55420@debbugs.gnu.org Cc: Fredrik Salomonsson Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.165256952810533 (code B ref 55420); Sat, 14 May 2022 23:06:02 +0000 Received: (at 55420) by debbugs.gnu.org; 14 May 2022 23:05:28 +0000 Received: from localhost ([127.0.0.1]:47708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nq0pD-0002jo-SR for submit@debbugs.gnu.org; Sat, 14 May 2022 19:05:28 -0400 Received: from mout01.posteo.de ([185.67.36.65]:49189) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nq0pC-0002jN-8H for 55420@debbugs.gnu.org; Sat, 14 May 2022 19:05:26 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id B8D7D240026 for <55420@debbugs.gnu.org>; Sun, 15 May 2022 01:05:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1652569520; bh=Pu/HOC61G0Zl7SmN/IWgSls5vEmEqNNli7SWC9nb/Nw=; h=From:To:Cc:Subject:Date:From; b=as/scnpVFw3WPbbF5/N1Db8ylJ1A5bHhYnTyxEd9wWxpsMv7pnzsFp10UPzkj8A4a N1kWZ7mJxTn+TQDM923NXNqiDuohGbZo8xZLRqe8kL1VQrB67X7f9QLtU8ItR0dO9M h+gJ84hDurbS5PihsvkHZ8J9cyEetE0erAN6YohRCpTzRnHwYydDkFNHuPfAiEa8si crdXstPVjpDZqSTv+JgBF/itgkJmRmpGAIph5z1EqqM7CclT6/Lv215vph1WG9jUBj VS6KpzNVjxo5xL85GxpFkqNxr8ygaPBo33n8b6/DW0BzO50XKh7Ip47tH6tKRAj0fZ v2ZNWLrf2FmYg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4L11M40p7tz6tn0; Sun, 15 May 2022 01:05:19 +0200 (CEST) From: Fredrik Salomonsson Date: Sat, 14 May 2022 23:05:08 +0000 Message-Id: <20220514230508.27885-2-plattfot@posteo.net> In-Reply-To: <20220514230508.27885-1-plattfot@posteo.net> References: <20220514230508.27885-1-plattfot@posteo.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/build/emacs-utils.scm (emacs-header-parse): New procedure. --- guix/build/emacs-utils.scm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index 8d40b9e139..76d9464806 100644 --- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -32,6 +32,7 @@ (define-module (guix build emacs-utils) emacs-batch-script emacs-generate-autoloads emacs-byte-compile-directory + emacs-header-parse as-display emacs-substitute-sexps @@ -97,6 +98,14 @@ (define* (emacs-byte-compile-directory dir) (byte-recompile-directory (file-name-as-directory ,dir) 0 1)))) (emacs-batch-eval expr))) +(define (emacs-header-parse section file) + "Parse the header SECTION in FILE and return it as a string." + (emacs-batch-script + `(progn + (require 'lisp-mnt) + (find-file ,file) + (princ (lm-header ,section))))) + (define as-display ;syntactic keyword for 'emacs-substitute-sexps' '(as display)) -- 2.36.0 From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH 0/2] Add a function to parse emacs elisp's package header Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 01 Jun 2022 20:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Fredrik Salomonsson Cc: 55420@debbugs.gnu.org Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.165411592730186 (code B ref 55420); Wed, 01 Jun 2022 20:39:02 +0000 Received: (at 55420) by debbugs.gnu.org; 1 Jun 2022 20:38:47 +0000 Received: from localhost ([127.0.0.1]:52014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nwV78-0007qo-OC for submit@debbugs.gnu.org; Wed, 01 Jun 2022 16:38:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60836) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nwV77-0007qa-Pf for 55420@debbugs.gnu.org; Wed, 01 Jun 2022 16:38:46 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44096) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwV72-0002uq-Ft; Wed, 01 Jun 2022 16:38:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=1A0bdIhk1jyC0AFNyE6+NWhAQ/FhSMYjfQikPg0Hjig=; b=brf4PJjKor/i09ylecsh GUAQnVpqxI5ZiB6d7kLLB+PZyhKGoP04axBSXSBi40XEHpLFxFsPES9MGaWe4O7Bpr4rWKI0zshsY IRFAHCqFn3E7WIBWEUVWikRV4Brwl/Yz7ATFyJOrwRW9yHuWAjz+eRee4cnMo0771HD8DjbXOzkRZ 0HdPBc3YBspxF3y9d+in9Yb5QJ5YbPcPDqiWKSsJfN1j18r51uLEoyIj1gt+X3+PbVzthr/QfBbdJ cdh1xxRXhYjcaXqcEXbFli+EP6/ChJJII4Wc+ECQwjW1mHPHSXc+3vxANkVIiffJ/ZiITTUZK8LIH wIT8BsSRGKuSlA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:50652 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwV72-0005U4-34; Wed, 01 Jun 2022 16:38:40 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20220514230017.27372-1-plattfot@posteo.net> <20220514230508.27885-1-plattfot@posteo.net> Date: Wed, 01 Jun 2022 22:38:38 +0200 In-Reply-To: <20220514230508.27885-1-plattfot@posteo.net> (Fredrik Salomonsson's message of "Sat, 14 May 2022 23:05:07 +0000") Message-ID: <87ee08t8z5.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Fredrik, The patches LGTM modulo cosmetic issues: Fredrik Salomonsson skribis: > * guix/build/emacs-utils.scm (emacs-batch-script): New procedure. [...] > +(define (emacs-batch-script expr) > + "Execute the Elisp code EXPR in Emacs batch mode and return output." > + (call-with-port > + (open-pipe* > + OPEN_READ > + (%emacs) "--quick" "--batch" > + (string-append "--eval=3D" (expr->string expr))) > + read-string)) I suggest something like: (let* ((pipe (open-pipe* =E2=80=A6)) (output (read-string pipe)) (status (close-pipe pipe))) (unless (zero? status) ;; Use SRFI-34 + either a &message condition or (better) ;; a dedicate SRFI-35 condition type for the error. (raise (condition =E2=80=A6))) output) That way, execution failures would be caught and reported. Ludo=E2=80=99. =20=20=20=20=20 From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH 0/2] Add a function to parse emacs elisp's package header Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 01 Jun 2022 20:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Fredrik Salomonsson Cc: 55420@debbugs.gnu.org Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.165411596030273 (code B ref 55420); Wed, 01 Jun 2022 20:40:01 +0000 Received: (at 55420) by debbugs.gnu.org; 1 Jun 2022 20:39:20 +0000 Received: from localhost ([127.0.0.1]:52021 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nwV7g-0007sD-0c for submit@debbugs.gnu.org; Wed, 01 Jun 2022 16:39:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60938) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nwV7f-0007rx-1g for 55420@debbugs.gnu.org; Wed, 01 Jun 2022 16:39:19 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44190) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwV7Z-0002zA-Pj; Wed, 01 Jun 2022 16:39:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=HKlvrv7K+CsGJeLQXcAW3TNbM1KZ0rglT1uyriqWqYc=; b=BNOEaR3WywtxWmBjqG8z 2BELretJw2Gx4nUpnc4XWYNWtXjLzPwWu5mfp+3J65Pmovwa+StZbLgSEu8xSLM7sEKh9+gB+ZS46 xyRW+rLRa0glS5Ff6pvc2KM6LPbwkWKHxLqYncwGgP3dxKGh45Wu6G/WTljei2npl1GqoVpqPUc5E 2VloZAe0dEZW3p+SX9szcngk0b8mX64cWBWN6guLrPTSU/mgt5TgKPR3EuL1EIz41GuFOwa7f9veB X6YwJORp4EeAPSSEMgMy2MP5oG9IcA5mhSKxzeB+Deer32oTX3eVdEnMQ8ng+/K7lfgDH8K4LwOhf 9rqG3VRaR9CHnw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:50420 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwV7Z-0005X6-DC; Wed, 01 Jun 2022 16:39:13 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20220514230508.27885-1-plattfot@posteo.net> <20220514230508.27885-2-plattfot@posteo.net> Date: Wed, 01 Jun 2022 22:39:11 +0200 In-Reply-To: <20220514230508.27885-2-plattfot@posteo.net> (Fredrik Salomonsson's message of "Sat, 14 May 2022 23:05:08 +0000") Message-ID: <87a6awt8y8.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Fredrik Salomonsson skribis: > * guix/build/emacs-utils.scm (emacs-header-parse): New procedure. LGTM! Could you send a v2 of these patches? Thanks in advance, Ludo=E2=80=99. From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH 0/2] Add a function to parse emacs elisp's package header Resent-From: Fredrik Salomonsson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 02 Jun 2022 02:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 55420@debbugs.gnu.org Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.165413843413262 (code B ref 55420); Thu, 02 Jun 2022 02:54:01 +0000 Received: (at 55420) by debbugs.gnu.org; 2 Jun 2022 02:53:54 +0000 Received: from localhost ([127.0.0.1]:52273 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nwayA-0003Rq-0y for submit@debbugs.gnu.org; Wed, 01 Jun 2022 22:53:54 -0400 Received: from mout01.posteo.de ([185.67.36.65]:41079) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nway8-0003Rb-Bt for 55420@debbugs.gnu.org; Wed, 01 Jun 2022 22:53:52 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 58854240026 for <55420@debbugs.gnu.org>; Thu, 2 Jun 2022 04:53:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1654138426; bh=5ZMYTxRibkCvmf7xNATMLXAFRXPHc3ddOGRcu3nvrsw=; h=From:To:Cc:Subject:Date:From; b=DzcatjIZqpBKcEiDtO86i6xoUjL/9l7G3EtWyfyta4stU2P4/sLTP4iADuMJ63sTl KQBVaAWq+kNVU/G6jeqgVs16IIZns+uIkPUihNHKyZuFWB1FzyxhTKz3t4TL5pPQub LVqvQjIul2297jcPvBKIsZtI36Amrw9k8eajcXOnkPeCoKtUpe03SG/xbxR0mYvuVj LPOzYgo4vIosZESJnox+qZ1DrE7GP+QFxUSppdY/brbTsp0KFhQiDaTfKABcIIa1Gg 7p7eAFnjn0uRX3QbL8MI4kfSDpr/BxvgkiqV6JXuQbp8fs1brmejh3jwZNgsu72sK9 j3cx+carCo9zQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LD9ZK1ccsz6tmJ; Thu, 2 Jun 2022 04:53:44 +0200 (CEST) From: Fredrik Salomonsson In-Reply-To: <87ee08t8z5.fsf_-_@gnu.org> References: <20220514230017.27372-1-plattfot@posteo.net> <20220514230508.27885-1-plattfot@posteo.net> <87ee08t8z5.fsf_-_@gnu.org> Date: Thu, 02 Jun 2022 02:53:42 +0000 Message-ID: <87zgivai89.fsf@d2.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Ludo, Ludovic Court=C3=A8s writes: > Hi Fredrik, > > The patches LGTM modulo cosmetic issues: > > Fredrik Salomonsson skribis: > >> * guix/build/emacs-utils.scm (emacs-batch-script): New procedure. > > [...] > >> +(define (emacs-batch-script expr) >> + "Execute the Elisp code EXPR in Emacs batch mode and return output." >> + (call-with-port >> + (open-pipe* >> + OPEN_READ >> + (%emacs) "--quick" "--batch" >> + (string-append "--eval=3D" (expr->string expr))) >> + read-string)) > > I suggest something like: > > (let* ((pipe (open-pipe* =E2=80=A6)) > (output (read-string pipe)) > (status (close-pipe pipe))) > (unless (zero? status) > ;; Use SRFI-34 + either a &message condition or (better) > ;; a dedicate SRFI-35 condition type for the error. > (raise (condition =E2=80=A6))) > output) > > That way, execution failures would be caught and reported. Thank you for the feedback. I update the procedure to use a dedicated SRFI-35 condition type. But I cannot figure out how to capture the error message from emacs, as I want the condition type to contain both the expression as well as the error you get from emacs. Here is what I have so far: (define-condition-type &emacs-batch-error &error emacs-batch-error? (expression emacs-batch-error-expression) (message emacs-batch-error-message)) =20=20=20=20 (define (emacs-batch-script expr) "Execute the Elisp code EXPR in Emacs batch mode and return output." (let* ((error-pipe (open-output-string)) (pipe (with-error-to-port error-pipe (lambda () (open-pipe* OPEN_READ (%emacs) "--quick" "--batch" (string-append "--eval=3D" (expr->string expr)))))) (output (read-string pipe)) (error (get-output-string error-pipe)) (status (close-pipe pipe))) (unless (zero? status) (raise (condition (&emacs-batch-error (expression expr) (message error))))) output)) Here is the output when I test it out in the guix repl: ---------------------------------------------------------------------------= ----- scheme@(guix-user)> (use-modules (guix build emacs-utils)) (use-modules (guix build emacs-utils)) scheme@(guix-user)> (emacs-batch-script '(prog (princ "hello"))) (emacs-batch-script '(prog (princ "hello"))) ice-9/boot-9.scm:1685:16: In procedure raise-exception: Wrong type (expecting exact integer): #<&emacs-batch-error expression: (pro= g (princ "hello")) message: ""> Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guix-user) [1]>=20 ---------------------------------------------------------------------------= ----- Note the message is empty in #<&emacs-batch-error=E2=80=A6>. It should cont= ain: Debugger entered--Lisp error: (void-function prog) (prog (princ "hello")) command-line-1(("--eval=3D(prog (princ \"hello\"))")) command-line() normal-top-level() Any idea what I'm doing wrong? Thanks --=20 s/Fred[re]+i[ck]+/Fredrik/g From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH 0/2] Add a function to parse emacs elisp's package header Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 02 Jun 2022 13:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Fredrik Salomonsson Cc: 55420@debbugs.gnu.org Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.16541775076101 (code B ref 55420); Thu, 02 Jun 2022 13:46:01 +0000 Received: (at 55420) by debbugs.gnu.org; 2 Jun 2022 13:45:07 +0000 Received: from localhost ([127.0.0.1]:53196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nwl8M-0001aL-S1 for submit@debbugs.gnu.org; Thu, 02 Jun 2022 09:45:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nwl8H-0001ZH-8W for 55420@debbugs.gnu.org; Thu, 02 Jun 2022 09:45:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58462) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwl8B-0004Iq-U0; Thu, 02 Jun 2022 09:44:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=hgz1J84dNs239QybEBgkJeh8jkAiu+o0aqUwSf7RBKo=; b=GdG+Tjuwkrkpeh22S55P X7d7bRSyAYogQ83GfbQthup/v1YFH/rmqEAHIEqL8LmVsaO3wHl4Kall8mBVE0l9fGHgeH2jCTQlN ICdxfkh4iKjGjehQx8Kt3EGtiv0Tr8xSWEgl4lobc4Q2ZNtqvaRQj9xLx1OC0LTHhkjDqygVT4ajD Sq0HpH0heGejjnBRaOts8p50PtXNgtgonyISh663en6RCesKCn8XCI41u85BWQIqNhPSO/VtA/l2+ reDm+3+tNqAZpVJM5PDV6hgcaf1LzG91aN/d4KB3ATx2olPqyQbwJEzsAFlE0PdtN2vWnp90RIq7t v4SWMiR0g33ezg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:57632 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwl8B-0002hx-8G; Thu, 02 Jun 2022 09:44:55 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20220514230017.27372-1-plattfot@posteo.net> <20220514230508.27885-1-plattfot@posteo.net> <87ee08t8z5.fsf_-_@gnu.org> <87zgivai89.fsf@d2.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Quartidi 14 Prairial an 230 de la =?UTF-8?Q?R=C3=A9volution,?= jour de l'Acacia X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 02 Jun 2022 15:44:53 +0200 In-Reply-To: <87zgivai89.fsf@d2.com> (Fredrik Salomonsson's message of "Thu, 02 Jun 2022 02:53:42 +0000") Message-ID: <87fsknp4bu.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Fredrik Salomonsson skribis: > Here is what I have so far: > > (define-condition-type &emacs-batch-error &error > emacs-batch-error? > (expression emacs-batch-error-expression) > (message emacs-batch-error-message)) >=20=20=20=20=20 > (define (emacs-batch-script expr) > "Execute the Elisp code EXPR in Emacs batch mode and return output." > (let* ((error-pipe (open-output-string)) > (pipe (with-error-to-port error-pipe > (lambda () > (open-pipe* > OPEN_READ > (%emacs) "--quick" "--batch" > (string-append "--eval=3D" (expr->string expr))))= )) > (output (read-string pipe)) > (error (get-output-string error-pipe)) > (status (close-pipe pipe))) > (unless (zero? status) > (raise (condition (&emacs-batch-error > (expression expr) > (message error))))) > output)) Unfortunately =E2=80=98open-pipe*=E2=80=99 is not smart enough to redirect = stderr to a non-file port (a string port in this case). One way around it would be to merge stdout and stderr, like so: (parameterize ((current-error-port (current-output-port))) (open-pipe* =E2=80=A6)) but then you get both on the same stream, which could be a problem for instance if Emacs emits warnings and such. You could work around it by establishing a second pipe: (match (pipe) ((stderr-input . stderr-output) (parameterize ((current-error-port stderr-output)) (open-pipe* =E2=80=A6)))) Here you should be able to read, in the parent process, from =E2=80=98stderr-input=E2=80=99. Another option is to not try to capture stderr: after all, that=E2=80=99ll = get printed on the screen anyway. HTH, Ludo=E2=80=99. From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH v2 1/2] guix: emacs-utils: Add emacs-batch-script. References: <20220514230017.27372-1-plattfot@posteo.net> In-Reply-To: <20220514230017.27372-1-plattfot@posteo.net> Resent-From: Fredrik Salomonsson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 05 Jun 2022 00:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55420@debbugs.gnu.org Cc: Fredrik Salomonsson Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.16543883835057 (code B ref 55420); Sun, 05 Jun 2022 00:20:02 +0000 Received: (at 55420) by debbugs.gnu.org; 5 Jun 2022 00:19:43 +0000 Received: from localhost ([127.0.0.1]:59795 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxdza-0001JQ-GH for submit@debbugs.gnu.org; Sat, 04 Jun 2022 20:19:42 -0400 Received: from mout01.posteo.de ([185.67.36.65]:47597) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxdzV-0001J7-OX for 55420@debbugs.gnu.org; Sat, 04 Jun 2022 20:19:40 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id CAD8E240027 for <55420@debbugs.gnu.org>; Sun, 5 Jun 2022 02:19:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1654388371; bh=L9Hf9VdwkFnH1hhGyJxqo7noBPJKkpHZbofQS8q/MJA=; h=From:To:Cc:Subject:Date:From; b=I9sYRWmtgNVFGopgRa/yYQ2N0fgfKxozzvIziVLRXeQEMxTfOWqE0DXPUfpsgLfWv wC/03KG3l5nKryLJ/iw3QbjFbUGOUfQoVrzKV/I1X4PvW1L181g75jNMlsC2T8EitK 6xArn2C7tEu9lPLac8B1jTsrdkWfrrb4D1ZcFGgGZhoO7Z9y6ak5fZLkxDUi/Hm+mG uTCkrVpXSSCR+xI1c4FR12CMx/mddFQb4cf1AJu0UUJr6JAKx0BQdhqXsT0elZQ6et ksjPpDQHMGCAEfeKvujghH8YFdxNMhwybaEqQHXJMI19Jty6CooztKaMrmGHD5IN4p n8T+FMG45UlIQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LFy0y58n8z6tmM; Sun, 5 Jun 2022 02:19:30 +0200 (CEST) From: Fredrik Salomonsson Date: Sun, 5 Jun 2022 00:19:23 +0000 Message-Id: <20220605001924.184934-1-plattfot@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/build/emacs-utils.scm (emacs-batch-script): New procedure. * tests/build-emacs-utils.scm: New file. * Makefile.am (TESTS): Add `tests/build-emacs-utils.scm'. --- Makefile.am | 1 + guix/build/emacs-utils.scm | 30 +++++++++++++++++++++++++++ tests/build-emacs-utils.scm | 41 +++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 tests/build-emacs-utils.scm diff --git a/Makefile.am b/Makefile.am index e8d4b7ef8a..4a8514ea3a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -469,6 +469,7 @@ SCM_TESTS = \ tests/boot-parameters.scm \ tests/bournish.scm \ tests/builders.scm \ + tests/build-emacs-utils.scm \ tests/build-utils.scm \ tests/cache.scm \ tests/challenge.scm \ diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index 60a754b9e9..1684bf3262 100644 --- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2014 Alex Kost ;;; Copyright © 2018, 2020, 2022 Maxim Cournoyer ;;; Copyright © 2019 Liliana Marie Prikler +;;; Copyright © 2022 Fredrik Salomonsson ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,10 +23,19 @@ (define-module (guix build emacs-utils) #:use-module (guix build utils) #:use-module (ice-9 format) + #:use-module (ice-9 popen) + #:use-module (ice-9 rdelim) + #:use-module (srfi srfi-34) + #:use-module (srfi srfi-35) #:export (%emacs emacs-batch-eval emacs-batch-edit-file emacs-batch-disable-compilation + emacs-batch-script + + emacs-batch-error? + emacs-batch-error-message + emacs-generate-autoloads emacs-byte-compile-directory @@ -69,6 +79,26 @@ (define (emacs-batch-disable-compilation file) (add-file-local-variable 'no-byte-compile t) (basic-save-buffer)))) +(define-condition-type &emacs-batch-error &error + emacs-batch-error? + (message emacs-batch-error-message)) + +(define (emacs-batch-script expr) + "Execute the Elisp code EXPR in Emacs batch mode and return output." + (let* ((error-pipe (pipe)) + (port (parameterize ((current-error-port (cdr error-pipe))) + (open-pipe* + OPEN_READ + (%emacs) "--quick" "--batch" + (string-append "--eval=" (expr->string expr))))) + (output (read-string port)) + (status (close-pipe port))) + (close-port (cdr error-pipe)) + (unless (zero? status) + (raise (condition (&emacs-batch-error + (message (read-string (car error-pipe))))))) + output)) + (define (emacs-generate-autoloads name directory) "Generate autoloads for Emacs package NAME placed in DIRECTORY." (let* ((file (string-append directory "/" name "-autoloads.el")) diff --git a/tests/build-emacs-utils.scm b/tests/build-emacs-utils.scm new file mode 100644 index 0000000000..03b73b1fed --- /dev/null +++ b/tests/build-emacs-utils.scm @@ -0,0 +1,41 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Fredrik Salomonsson +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + + +(define-module (test build-emacs-utils) + #:use-module (guix tests) + #:use-module (guix build emacs-utils) + #:use-module (guix build utils) + #:use-module ((guix utils) + #:select (call-with-temporary-directory)) + #:use-module (srfi srfi-34) + #:use-module (srfi srfi-64)) + +(test-begin "build-emacs-utils") + +(test-equal "print foo from emacs" + "foo" + (emacs-batch-script '(princ "foo"))) + +(test-assert "emacs-batch-script: raise &emacs-batch-error on failure" + (guard (c ((emacs-batch-error? c) + (string-contains (emacs-batch-error-message c) + "Lisp error: (wrong-type-argument numberp \"three\")"))) + (emacs-batch-script '(mapcar 'number-to-string (list 1 2 "three"))))) + +(test-end "build-emacs-utils") base-commit: 271736117e3f09b616a2dbd5d74c9595926c9297 -- 2.36.1 From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH v2 2/2] guix: emacs-utils: Add emacs-header-parse. Resent-From: Fredrik Salomonsson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 05 Jun 2022 00:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55420@debbugs.gnu.org Cc: Fredrik Salomonsson Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.16543883845065 (code B ref 55420); Sun, 05 Jun 2022 00:20:02 +0000 Received: (at 55420) by debbugs.gnu.org; 5 Jun 2022 00:19:44 +0000 Received: from localhost ([127.0.0.1]:59797 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxdzb-0001Jd-VB for submit@debbugs.gnu.org; Sat, 04 Jun 2022 20:19:44 -0400 Received: from mout02.posteo.de ([185.67.36.66]:49005) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxdzZ-0001JD-KH for 55420@debbugs.gnu.org; Sat, 04 Jun 2022 20:19:42 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id B3E59240107 for <55420@debbugs.gnu.org>; Sun, 5 Jun 2022 02:19:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1654388375; bh=Tz4lxpV5l2GYe6LS5apP0+3x+FwL/ndP77P/hweNnjE=; h=From:To:Cc:Subject:Date:From; b=Ws5FC8i4N3KLDevmzQe9ZvtUVPQFZLdcGNaT4SvQ48C0b3AIYmEJDgbX9dc1qSygH GJmdfZacomQEsSWYmrJgESY3/RKNwusa9L+DWex/FYVaeZE7BKnB6LDt3FbE7eR4g4 qjyImUeZQQJhnLbZoxVrDHyT6xemZiTb6ofH6dX7duvhS328dU+G+cb+4onASOPqxI /M1ewSa1eG4XHjkM+Z6X5aGr+V8TwPMy4PEU7xWwMUHsg5rGMQ3tF7EQqNMBuGLwIt +HeArf2HxWO9i4tviNWsFcdrvpPrA+P2d0xgHDfisDUNue8+Lakll/y99HZAy60EOP dReqCNm2jV/VQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LFy125kPpz6tmM; Sun, 5 Jun 2022 02:19:34 +0200 (CEST) From: Fredrik Salomonsson Date: Sun, 5 Jun 2022 00:19:24 +0000 Message-Id: <20220605001924.184934-2-plattfot@posteo.net> In-Reply-To: <20220605001924.184934-1-plattfot@posteo.net> References: <20220605001924.184934-1-plattfot@posteo.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/build/emacs-utils.scm (emacs-header-parse): New procedure. * tests/build-emacs-utils.scm ("emacs-header-parse: fetch version", "emacs-header-parse: fetch keywords", "emacs-header-parse: fetch nonexistent author"): New tests. --- guix/build/emacs-utils.scm | 9 +++++++++ tests/build-emacs-utils.scm | 30 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index 1684bf3262..8ee547f2b3 100644 --- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -38,6 +38,7 @@ (define-module (guix build emacs-utils) emacs-generate-autoloads emacs-byte-compile-directory + emacs-header-parse as-display emacs-substitute-sexps @@ -114,6 +115,14 @@ (define* (emacs-byte-compile-directory dir) (byte-recompile-directory (file-name-as-directory ,dir) 0 1)))) (emacs-batch-eval expr))) +(define (emacs-header-parse section file) + "Parse the header SECTION in FILE and return it as a string." + (emacs-batch-script + `(progn + (require 'lisp-mnt) + (find-file ,file) + (princ (lm-header ,section))))) + (define as-display ;syntactic keyword for 'emacs-substitute-sexps' '(as display)) diff --git a/tests/build-emacs-utils.scm b/tests/build-emacs-utils.scm index 03b73b1fed..57647caaa2 100644 --- a/tests/build-emacs-utils.scm +++ b/tests/build-emacs-utils.scm @@ -38,4 +38,34 @@ (define-module (test build-emacs-utils) "Lisp error: (wrong-type-argument numberp \"three\")"))) (emacs-batch-script '(mapcar 'number-to-string (list 1 2 "three"))))) +(define (test-emacs-header-parse section) + (call-with-temporary-directory + (lambda (directory) + (let ((mock-elisp-file (string-append directory "/foo.el"))) + (call-with-output-file mock-elisp-file + (lambda (port) + (display ";;; foo --- mock emacs package -*- lexical-binding: t -*- + +;; Created: 4 Jun 2022 +;; Keywords: lisp test +;; Version: 1.0.0 +;;; Commentary: +;;; Code: +;;; foo.el ends here +" + port))) + (emacs-header-parse section mock-elisp-file))))) + +(test-equal "emacs-header-parse: fetch version" + "1.0.0" + (test-emacs-header-parse "version")) + +(test-equal "emacs-header-parse: fetch keywords" + "lisp test" + (test-emacs-header-parse "keywords")) + +(test-equal "emacs-header-parse: fetch nonexistent author" + "nil" + (test-emacs-header-parse "author")) + (test-end "build-emacs-utils") -- 2.36.1 From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH 0/2] Add a function to parse emacs elisp's package header Resent-From: Fredrik Salomonsson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 05 Jun 2022 00:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 55420@debbugs.gnu.org Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.16543897657675 (code B ref 55420); Sun, 05 Jun 2022 00:43:01 +0000 Received: (at 55420) by debbugs.gnu.org; 5 Jun 2022 00:42:45 +0000 Received: from localhost ([127.0.0.1]:59809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxeLt-0001zi-68 for submit@debbugs.gnu.org; Sat, 04 Jun 2022 20:42:45 -0400 Received: from mout01.posteo.de ([185.67.36.65]:40567) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxeLr-0001zU-CD for 55420@debbugs.gnu.org; Sat, 04 Jun 2022 20:42:44 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 4BE9C240027 for <55420@debbugs.gnu.org>; Sun, 5 Jun 2022 02:42:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1654389757; bh=nma+Bhc72gT9U4UfoaTkNnjeiQHmGYP08R1saaWkjUs=; h=From:To:Cc:Subject:Date:From; b=rWmuYzsFgj4JG0XKVBAmLQ9mjj/tB8Ap8+IhkYS0dJ7QVyxHX5POkulwcMaFUQRh/ A3o0WsWoGw0eVxJpltPDPM+zyRK2tBBVOTfJAQv8YzOVAZR/rBKYK43CwAuFE/PWXx UHXKvj8742zHwYmjOdvL3P97t006w57vVViCOyVAdOy1TSa1d5RiJhqMeJ1mmZKr8C wXqU5Az2NjbBAYsRI0mpX7wwtuVG03TzkbH9j85P+42aIg3uRbQ9YO5zguotooLugX Ge44v6L/ocMuxk9KIzDsPjPak4pdoxgDEFkGCc3I5KSTR4lDaVPZTaqSw4ImiMqzn0 0BpcjAKIWsx8Q== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LFyWc18vnz6tmh; Sun, 5 Jun 2022 02:42:35 +0200 (CEST) From: Fredrik Salomonsson In-Reply-To: <87fsknp4bu.fsf@gnu.org> References: <20220514230017.27372-1-plattfot@posteo.net> <20220514230508.27885-1-plattfot@posteo.net> <87ee08t8z5.fsf_-_@gnu.org> <87zgivai89.fsf@d2.com> <87fsknp4bu.fsf@gnu.org> Date: Sun, 05 Jun 2022 00:42:34 +0000 Message-ID: <87h750rldx.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Ludo, Ludovic Court=C3=A8s writes: > Hi, > > Fredrik Salomonsson skribis: > >> Here is what I have so far: >> >> (define-condition-type &emacs-batch-error &error >> emacs-batch-error? >> (expression emacs-batch-error-expression) >> (message emacs-batch-error-message)) >>=20=20=20=20=20 >> (define (emacs-batch-script expr) >> "Execute the Elisp code EXPR in Emacs batch mode and return output= ." >> (let* ((error-pipe (open-output-string)) >> (pipe (with-error-to-port error-pipe >> (lambda () >> (open-pipe* >> OPEN_READ >> (%emacs) "--quick" "--batch" >> (string-append "--eval=3D" (expr->string expr)))= ))) >> (output (read-string pipe)) >> (error (get-output-string error-pipe)) >> (status (close-pipe pipe))) >> (unless (zero? status) >> (raise (condition (&emacs-batch-error >> (expression expr) >> (message error))))) >> output)) > > Unfortunately =E2=80=98open-pipe*=E2=80=99 is not smart enough to redirec= t stderr to a > non-file port (a string port in this case). > > One way around it would be to merge stdout and stderr, like so: > > (parameterize ((current-error-port (current-output-port))) > (open-pipe* =E2=80=A6)) > > but then you get both on the same stream, which could be a problem for > instance if Emacs emits warnings and such. > > You could work around it by establishing a second pipe: > > (match (pipe) > ((stderr-input . stderr-output) > (parameterize ((current-error-port stderr-output)) > (open-pipe* =E2=80=A6)))) > > Here you should be able to read, in the parent process, from > =E2=80=98stderr-input=E2=80=99. > > Another option is to not try to capture stderr: after all, that=E2=80=99l= l get > printed on the screen anyway. I just sent in v2 of the patches. Changes are: - emacs-batch-script will now raise an &emacs-batch-error if emacs batch script fails. I opted to capture the stderr and package that up in the condition. Thank you for the pointers! I removed the expression slot I had in my prototype. It felt redundant, emacs error message should be enough. - tests/build-emacs-utils.scm: I added tests for the two new procedures. It was good that I added the tests as I had missed to use (srfi srfi-34) in build/emacs-utils.scm during my prototyping and that generated the cryptic error: Wrong type (expecting exact integer): #<&emacs-batch-error=E2=80=A6> Took me a while to figure that one out. But now all is good. The tests are passing. Thanks again. --=20 s/Fred[re]+i[ck]+/Fredrik/g From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH v2 1/2] guix: emacs-utils: Add emacs-batch-script. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 05 Jun 2022 09:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Fredrik Salomonsson , 55420@debbugs.gnu.org Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.165442275829792 (code B ref 55420); Sun, 05 Jun 2022 09:53:02 +0000 Received: (at 55420) by debbugs.gnu.org; 5 Jun 2022 09:52:38 +0000 Received: from localhost ([127.0.0.1]:60110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxmw2-0007kS-0K for submit@debbugs.gnu.org; Sun, 05 Jun 2022 05:52:38 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:44458) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxmvy-0007kF-JA for 55420@debbugs.gnu.org; Sun, 05 Jun 2022 05:52:36 -0400 Received: from [172.20.10.9] ([188.188.198.16]) by xavier.telenet-ops.be with bizsmtp id fMsX270100Mj3JL01MsYV9; Sun, 05 Jun 2022 11:52:32 +0200 Message-ID: <38a5e03d835b2daa2dd1959048f1d03f6f5a48cd.camel@telenet.be> From: Maxime Devos Date: Sun, 05 Jun 2022 11:52:27 +0200 In-Reply-To: <20220605001924.184934-1-plattfot@posteo.net> References: <20220514230017.27372-1-plattfot@posteo.net> <20220605001924.184934-1-plattfot@posteo.net> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-G+LecsihqW5m/7Zh5LU8" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1654422752; bh=orh3RzG4EX/PeEgZWdazU2xPtvMcp27sHwmZiYZcF98=; h=Subject:From:To:Date:In-Reply-To:References; b=lCm8Svd5hb+wzoRWi4a/+8FkHE/3ekI1qDIf5hGO3gz+MSd7Afccr5BGgTJX1C89B +cklIUnr+w0ECV9EJTY+Hy3qlJzF4okphQS33Diw1GyhSMLIrdDusRb0n+JuqyNSR7 bp/gtapoBMeCJ+5NrE2wBvnVhdDann5n+rRw1nLkKGXBPUMDLtrvHklL8mzxIytkMW RgJFd17CSD3wS2kl5WmBEkVHld0VRkPShdKH0LWLj7nbVgSPfqgPwLFHSWnhFnVWpV bjM9SiPdtYWLvcPVKRzOoiUh67gQ4BQUDr87XEF2D3Ql8DHy9VUNq+xiA/bIplZzKo y7sROJxA51ICQ== X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-G+LecsihqW5m/7Zh5LU8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Fredrik Salomonsson schreef op zo 05-06-2022 om 00:19 [+0000]: > +(test-equal "print foo from emacs" > +=C2=A0 "foo" > +=C2=A0 (emacs-batch-script '(princ "foo"))) IIUC, this can only be run if emacs is in $PATH when running the tests, so sometimes the test needs to be skipped. As an example on how to do this, see the "pypi->guix-package, wheels" test in tests/pypi.scm. Greetings, Maxime. --=-G+LecsihqW5m/7Zh5LU8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYpx82xccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7puYAQCWIg6YACUP+M/WyndYxWZjFjuT Pg2TfhpjyXweT1h3KgD/fRMlo09wcX62XRhrHyua0WjZRhr0+qXm0UNWw40XPgg= =Vv4M -----END PGP SIGNATURE----- --=-G+LecsihqW5m/7Zh5LU8-- From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH v3 1/2] guix: emacs-utils: Add emacs-batch-script. References: <20220514230017.27372-1-plattfot@posteo.net> In-Reply-To: <20220514230017.27372-1-plattfot@posteo.net> Resent-From: Fredrik Salomonsson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 05 Jun 2022 19:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55420@debbugs.gnu.org Cc: Fredrik Salomonsson Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.165445872528172 (code B ref 55420); Sun, 05 Jun 2022 19:53:02 +0000 Received: (at 55420) by debbugs.gnu.org; 5 Jun 2022 19:52:05 +0000 Received: from localhost ([127.0.0.1]:33561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxwI7-0007KJ-8u for submit@debbugs.gnu.org; Sun, 05 Jun 2022 15:52:05 -0400 Received: from mout01.posteo.de ([185.67.36.65]:50677) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxwI2-0007Jj-6O for 55420@debbugs.gnu.org; Sun, 05 Jun 2022 15:52:02 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 8D4E7240027 for <55420@debbugs.gnu.org>; Sun, 5 Jun 2022 21:51:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1654458711; bh=3QmFu7NTbkRC0nhbTFW4Cy0FkgYDp/1ICvDnLzYelCg=; h=From:To:Cc:Subject:Date:From; b=gkiac1D4K2K+G4eTlMVpTHl2NwWB0vzh9Unv2cMo29VQar5g2Y9royAvt1R/TCoP1 U2Cs9cwq3XdFVVThpVWSwQL3pIBYS3VxOWgh9TYBjpbWwU/mEqRODOhs7zJ52MLO++ XSqlnRKhmYgESif+zwmMziK6YCIxOWwbYW+CFIVeOvzuHkCZXT0YD8vambaEPNVMGY KKJeWHvnn40vXjKMiTcIwzLW3S9nhiv1iOseun3EYoUSlLcO7rAsS3CqG5XmD4JkVy sBvNH7DHMUu7dvf4jZd9uBbZKQT4Sn0QGqfarY/vw0dVc+2NC73WkbWR99Y9zGYmYi o1LiKlPJWoypQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LGS1f3b6Gz6tmp; Sun, 5 Jun 2022 21:51:50 +0200 (CEST) From: Fredrik Salomonsson Date: Sun, 5 Jun 2022 19:51:42 +0000 Message-Id: <20220605195143.23591-1-plattfot@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/build/emacs-utils.scm (emacs-batch-script): New procedure. * tests/build-emacs-utils.scm: New file. * Makefile.am (TESTS): Add `tests/build-emacs-utils.scm'. --- Makefile.am | 1 + guix/build/emacs-utils.scm | 30 ++++++++++++++++++++++++++ tests/build-emacs-utils.scm | 43 +++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 tests/build-emacs-utils.scm diff --git a/Makefile.am b/Makefile.am index e8d4b7ef8a..4a8514ea3a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -469,6 +469,7 @@ SCM_TESTS = \ tests/boot-parameters.scm \ tests/bournish.scm \ tests/builders.scm \ + tests/build-emacs-utils.scm \ tests/build-utils.scm \ tests/cache.scm \ tests/challenge.scm \ diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index 60a754b9e9..1684bf3262 100644 --- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2014 Alex Kost ;;; Copyright © 2018, 2020, 2022 Maxim Cournoyer ;;; Copyright © 2019 Liliana Marie Prikler +;;; Copyright © 2022 Fredrik Salomonsson ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,10 +23,19 @@ (define-module (guix build emacs-utils) #:use-module (guix build utils) #:use-module (ice-9 format) + #:use-module (ice-9 popen) + #:use-module (ice-9 rdelim) + #:use-module (srfi srfi-34) + #:use-module (srfi srfi-35) #:export (%emacs emacs-batch-eval emacs-batch-edit-file emacs-batch-disable-compilation + emacs-batch-script + + emacs-batch-error? + emacs-batch-error-message + emacs-generate-autoloads emacs-byte-compile-directory @@ -69,6 +79,26 @@ (define (emacs-batch-disable-compilation file) (add-file-local-variable 'no-byte-compile t) (basic-save-buffer)))) +(define-condition-type &emacs-batch-error &error + emacs-batch-error? + (message emacs-batch-error-message)) + +(define (emacs-batch-script expr) + "Execute the Elisp code EXPR in Emacs batch mode and return output." + (let* ((error-pipe (pipe)) + (port (parameterize ((current-error-port (cdr error-pipe))) + (open-pipe* + OPEN_READ + (%emacs) "--quick" "--batch" + (string-append "--eval=" (expr->string expr))))) + (output (read-string port)) + (status (close-pipe port))) + (close-port (cdr error-pipe)) + (unless (zero? status) + (raise (condition (&emacs-batch-error + (message (read-string (car error-pipe))))))) + output)) + (define (emacs-generate-autoloads name directory) "Generate autoloads for Emacs package NAME placed in DIRECTORY." (let* ((file (string-append directory "/" name "-autoloads.el")) diff --git a/tests/build-emacs-utils.scm b/tests/build-emacs-utils.scm new file mode 100644 index 0000000000..27cff46c38 --- /dev/null +++ b/tests/build-emacs-utils.scm @@ -0,0 +1,43 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Fredrik Salomonsson +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + + +(define-module (test build-emacs-utils) + #:use-module (guix tests) + #:use-module (guix build emacs-utils) + #:use-module (guix build utils) + #:use-module ((guix utils) + #:select (call-with-temporary-directory)) + #:use-module (srfi srfi-34) + #:use-module (srfi srfi-64)) + +(test-begin "build-emacs-utils") +;; Only run the following tests if emacs is present. +(test-skip (if (which "emacs") 0 2)) + +(test-equal "emacs-batch-script: print foo from emacs" + "foo" + (emacs-batch-script '(princ "foo"))) + +(test-assert "emacs-batch-script: raise &emacs-batch-error on failure" + (guard (c ((emacs-batch-error? c) + (string-contains (emacs-batch-error-message c) + "Lisp error: (wrong-type-argument numberp \"three\")"))) + (emacs-batch-script '(mapcar 'number-to-string (list 1 2 "three"))))) + +(test-end "build-emacs-utils") base-commit: 271736117e3f09b616a2dbd5d74c9595926c9297 -- 2.36.1 From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH v3 2/2] guix: emacs-utils: Add emacs-header-parse. Resent-From: Fredrik Salomonsson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 05 Jun 2022 19:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55420@debbugs.gnu.org Cc: Fredrik Salomonsson Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.165445872728186 (code B ref 55420); Sun, 05 Jun 2022 19:53:02 +0000 Received: (at 55420) by debbugs.gnu.org; 5 Jun 2022 19:52:07 +0000 Received: from localhost ([127.0.0.1]:33565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxwIB-0007KY-1s for submit@debbugs.gnu.org; Sun, 05 Jun 2022 15:52:07 -0400 Received: from mout02.posteo.de ([185.67.36.66]:44129) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxwI8-0007Jr-GI for 55420@debbugs.gnu.org; Sun, 05 Jun 2022 15:52:06 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 4BD52240108 for <55420@debbugs.gnu.org>; Sun, 5 Jun 2022 21:51:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1654458718; bh=m6E9CYvuzXSeGSIOwwmLxc66Q6NBctPOrCvzoGgZAgM=; h=From:To:Cc:Subject:Date:From; b=UlAzeJEdOkbG97qOoMh97KLGBXYtstHNxv4i1FtRK4+G437y+3e/+GSS2yw1Hnajg yP+Uu18BNo5BrcSNFnXzqs4uJGykaR42EmGMaGgSdg7iY+FOiIjg2u/pooWLY4nMA+ iZPE/mWY8DjiKahvn3oo5Hz0M5KofDy7kZtmpGPRbZ3pXzkbwANctZt/5aqhV8+nJx M64n3b5pxHglpcRna39LcmVTkFSmGaohjDNExsRX/JBXJa0D6ReCmX082xcP+FVUGW JzxNNOk+WQdFyT7s3wpoh2rK2BV4fBi87Kxi2ySgGUWJ5PesraQoxDSSHuYNxV8FIQ AT5pgM0wJQ1tA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LGS1n2X5Wz6tmp; Sun, 5 Jun 2022 21:51:57 +0200 (CEST) From: Fredrik Salomonsson Date: Sun, 5 Jun 2022 19:51:43 +0000 Message-Id: <20220605195143.23591-2-plattfot@posteo.net> In-Reply-To: <20220605195143.23591-1-plattfot@posteo.net> References: <20220605195143.23591-1-plattfot@posteo.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/build/emacs-utils.scm (emacs-header-parse): New procedure. * tests/build-emacs-utils.scm ("emacs-header-parse: fetch version", "emacs-header-parse: fetch keywords", "emacs-header-parse: fetch nonexistent author"): New tests. --- guix/build/emacs-utils.scm | 9 +++++++++ tests/build-emacs-utils.scm | 27 ++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index 1684bf3262..8ee547f2b3 100644 --- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -38,6 +38,7 @@ (define-module (guix build emacs-utils) emacs-generate-autoloads emacs-byte-compile-directory + emacs-header-parse as-display emacs-substitute-sexps @@ -114,6 +115,14 @@ (define* (emacs-byte-compile-directory dir) (byte-recompile-directory (file-name-as-directory ,dir) 0 1)))) (emacs-batch-eval expr))) +(define (emacs-header-parse section file) + "Parse the header SECTION in FILE and return it as a string." + (emacs-batch-script + `(progn + (require 'lisp-mnt) + (find-file ,file) + (princ (lm-header ,section))))) + (define as-display ;syntactic keyword for 'emacs-substitute-sexps' '(as display)) diff --git a/tests/build-emacs-utils.scm b/tests/build-emacs-utils.scm index 27cff46c38..081032285a 100644 --- a/tests/build-emacs-utils.scm +++ b/tests/build-emacs-utils.scm @@ -28,7 +28,7 @@ (define-module (test build-emacs-utils) (test-begin "build-emacs-utils") ;; Only run the following tests if emacs is present. -(test-skip (if (which "emacs") 0 2)) +(test-skip (if (which "emacs") 0 5)) (test-equal "emacs-batch-script: print foo from emacs" "foo" @@ -40,4 +40,29 @@ (define-module (test build-emacs-utils) "Lisp error: (wrong-type-argument numberp \"three\")"))) (emacs-batch-script '(mapcar 'number-to-string (list 1 2 "three"))))) +(call-with-temporary-directory + (lambda (directory) + (let ((mock-elisp-file (string-append directory "/foo.el"))) + (call-with-output-file mock-elisp-file + (lambda (port) + (display ";;; foo --- mock emacs package -*- lexical-binding: t -*- + +;; Created: 4 Jun 2022 +;; Keywords: lisp test +;; Version: 1.0.0 +;;; Commentary: +;;; Code: +;;; foo.el ends here +" + port))) + (test-equal "emacs-header-parse: fetch version" + "1.0.0" + (emacs-header-parse "version" mock-elisp-file)) + (test-equal "emacs-header-parse: fetch keywords" + "lisp test" + (emacs-header-parse "keywords" mock-elisp-file)) + (test-equal "emacs-header-parse: fetch nonexistent author" + "nil" + (emacs-header-parse "author" mock-elisp-file))))) + (test-end "build-emacs-utils") -- 2.36.1 From unknown Mon Aug 18 17:56:31 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH v2 1/2] guix: emacs-utils: Add emacs-batch-script. Resent-From: Fredrik Salomonsson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 05 Jun 2022 20:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxime Devos , 55420@debbugs.gnu.org Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.165445937329211 (code B ref 55420); Sun, 05 Jun 2022 20:03:01 +0000 Received: (at 55420) by debbugs.gnu.org; 5 Jun 2022 20:02:53 +0000 Received: from localhost ([127.0.0.1]:33574 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxwSb-0007b4-6f for submit@debbugs.gnu.org; Sun, 05 Jun 2022 16:02:53 -0400 Received: from mout02.posteo.de ([185.67.36.66]:46535) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxwSZ-0007as-LX for 55420@debbugs.gnu.org; Sun, 05 Jun 2022 16:02:52 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id DC0DC240108 for <55420@debbugs.gnu.org>; Sun, 5 Jun 2022 22:02:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1654459365; bh=0UXnvbUT3M0yutIDEd8qlc9RkRufBpQcjcn9TL0wD3o=; h=From:To:Subject:Date:From; b=Fe48K6WtcKBYd0iCo46iUM1jw9678nmTLMHJxcfAcF/mE1CgglGLGtOgOK2MYvnGR iChdkG2G5xwJmr+gtrCcqlFyLjPla0UmBxNDQVoxZcROW2VcXEY3Ip1Af84wk+Sc7c lB11SuIi4bEGmlCtrb3XU9MnxR68kYv/TmdQQkDFXhiku8aVrqO8FR2yI/soETf0PX erLptkykPXmnBa7HCowezeXW30avzIEox2hAZrKWlCZAQ9cIC9MV5BP3/WE1IXbYRv bUy1PovaLHgZfHPGfZSGDb5WoyUm0lg/8RBYyoQWme6MyU/xsQGj3xB0AO+hvWA01R HSLaKmCslVUiw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LGSGD5K0wz6tnZ; Sun, 5 Jun 2022 22:02:44 +0200 (CEST) From: Fredrik Salomonsson In-Reply-To: <38a5e03d835b2daa2dd1959048f1d03f6f5a48cd.camel@telenet.be> References: <20220514230017.27372-1-plattfot@posteo.net> <20220605001924.184934-1-plattfot@posteo.net> <38a5e03d835b2daa2dd1959048f1d03f6f5a48cd.camel@telenet.be> Date: Sun, 05 Jun 2022 20:02:42 +0000 Message-ID: <87v8teop3x.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Maxime, Maxime Devos writes: > Fredrik Salomonsson schreef op zo 05-06-2022 om 00:19 [+0000]: >> +(test-equal "print foo from emacs" >> +=C2=A0 "foo" >> +=C2=A0 (emacs-batch-script '(princ "foo"))) > > IIUC, this can only be run if emacs is in $PATH when running the tests, > so sometimes the test needs to be skipped. As an example on how to do > this, see the "pypi->guix-package, wheels" test in tests/pypi.scm. Yes, you are correct. All my tests started to fail when I added `--pure` to my test command. I just sent in a v3 of the patches when I skip the tests if emacs is not in the PATH. I also changed the tests for the `emacs-header-parse` to be wrapped by `call-with-temporary-directory`. It felt wasteful to create and destroy that file for each test when the file is static. I opted to just have one test-skip and skip all five of them. Although that migth be too fragile. Would be great to have something like: (unless (which "emacs") (test-skip "emacs-batch-script:") (test-skip "emacs-header-parse:")) But the docs just mention a counter or the full name of a test. --=20 s/Fred[re]+i[ck]+/Fredrik/g From unknown Mon Aug 18 17:56:31 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Fredrik Salomonsson Subject: bug#55420: closed (Re: bug#55420: [PATCH 0/2] Add a function to parse emacs elisp's package header) Message-ID: References: <87czf7dofa.fsf_-_@gnu.org> <20220514230017.27372-1-plattfot@posteo.net> X-Gnu-PR-Message: they-closed 55420 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 55420@debbugs.gnu.org Date: Fri, 17 Jun 2022 20:30:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1655497802-598-1" This is a multi-part message in MIME format... ------------=_1655497802-598-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #55420: [PATCH 0/2] Add a function to parse emacs elisp's package header which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 55420@debbugs.gnu.org. --=20 55420: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D55420 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1655497802-598-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 55420-done) by debbugs.gnu.org; 17 Jun 2022 20:29:23 +0000 Received: from localhost ([127.0.0.1]:47043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2Iap-00008S-Aj for submit@debbugs.gnu.org; Fri, 17 Jun 2022 16:29:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2Ian-00008E-W7 for 55420-done@debbugs.gnu.org; Fri, 17 Jun 2022 16:29:22 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44186) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2Iai-00012i-JG; Fri, 17 Jun 2022 16:29:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=6qEJRqsQ8vHjl2h1n+2I/taSKvhBdLJTFSj73+z6Hng=; b=D3N5G6mxAX6Sd3QK43YJ 7+D0Midw1DE4VE0QYVtV2SFJF9CFNDVq63x39kEruFPt+bBfn6rzSs3dlbT5ZDsHk2d+idIgd1TFn Ue1iaaxtdXRXlqmc0sqwvmRk4CiELv6vdrHzOvjvZMcmzQBrTK+VEeQA/pk6xB2TmG8r2WsIAV/UI y7T2ogBl/4vIU+NPED7nwsqtQYGUquQiBZt5a4KXSqP35SSuufAS7vsjXQ78Xqr0Y5PPYW6/3wLuo amr9YIV1L30tUl0xy2G30gTs4h1ibO3ZRtPd/dTp+N24u1ZMSdSF3C00jnCUxYs73o4jJTDGTeYl5 6uTaO1h3cx93Jw==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=60818 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2Iai-0005fz-6Y; Fri, 17 Jun 2022 16:29:16 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Fredrik Salomonsson Subject: Re: bug#55420: [PATCH 0/2] Add a function to parse emacs elisp's package header References: <20220514230017.27372-1-plattfot@posteo.net> <20220605195143.23591-1-plattfot@posteo.net> Date: Fri, 17 Jun 2022 22:29:13 +0200 In-Reply-To: <20220605195143.23591-1-plattfot@posteo.net> (Fredrik Salomonsson's message of "Sun, 5 Jun 2022 19:51:42 +0000") Message-ID: <87czf7dofa.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 55420-done Cc: 55420-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Fredrik, Fredrik Salomonsson skribis: > * guix/build/emacs-utils.scm (emacs-batch-script): New procedure. > > * tests/build-emacs-utils.scm: New file. > > * Makefile.am (TESTS): Add `tests/build-emacs-utils.scm'. [...] > * guix/build/emacs-utils.scm (emacs-header-parse): New procedure. > > * tests/build-emacs-utils.scm ("emacs-header-parse: fetch version", > "emacs-header-parse: fetch keywords", "emacs-header-parse: fetch > nonexistent author"): New tests. Thanks, applied. Apologies for the delay! Ludo=E2=80=99. ------------=_1655497802-598-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 14 May 2022 23:00:44 +0000 Received: from localhost ([127.0.0.1]:47700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nq0kd-0002bd-W0 for submit@debbugs.gnu.org; Sat, 14 May 2022 19:00:44 -0400 Received: from lists.gnu.org ([209.51.188.17]:47994) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nq0kc-0002bW-Vg for submit@debbugs.gnu.org; Sat, 14 May 2022 19:00:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nq0kc-0005kl-OF for guix-patches@gnu.org; Sat, 14 May 2022 19:00:42 -0400 Received: from mout01.posteo.de ([185.67.36.65]:35929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nq0ka-0000UQ-TQ for guix-patches@gnu.org; Sat, 14 May 2022 19:00:42 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 0B282240026 for ; Sun, 15 May 2022 01:00:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1652569238; bh=ftqUDi9Qb0qOqeFFtbz5VMuJbzTz0CK57bvmOdDiTSg=; h=From:To:Cc:Subject:Date:From; b=m7oce0ZIQsVFmmzMHIZHGeOvlR+4QRgUlBE+5tNPC5uQfkQL+p4u/e5eCZSMwVk9U cGgmmKLfeMsTmp04IQ0wevOzKMgJZWqgZm1Nkr+iyIlJZLn9dEWymzHVrAFh/O5CCJ 2wVm7OapxCAIlRDIUwuE+TxmPUCSsMNUWDf6/1hrT7s/klHDKMNvoQ+azJmyjFXF22 w5Y4TAFn+3mOE94u8DoyAq7dhvVOWyPBKQtKQXnUnAXcWNW1xpH5P+0gcdj+25Vm2U k4HLTU6ek1AOGNDt64uMHiiAh+0mUalVxlnMhTTTuaPidc1XGb4tBEjLg/ACu2oJXz PziwB1yIN1U3Q== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4L11Fd1Jbxz9rxB; Sun, 15 May 2022 01:00:36 +0200 (CEST) From: Fredrik Salomonsson To: guix-patches@gnu.org Subject: [PATCH 0/2] Add a function to parse emacs elisp's package header Date: Sat, 14 May 2022 23:00:17 +0000 Message-Id: <20220514230017.27372-1-plattfot@posteo.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=185.67.36.65; envelope-from=plattfot@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: Fredrik Salomonsson X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) When writing a guix.scm file for an emacs packages, I wanted a way to fetch the version I specify in the header of the elisp file. I found that I could do that with the lisp-mnt library in emacs. Unfortunately none of the emacs utility functions in guix/build/emacs-utils.scm return the output of an elisp expression. With these two patches I aim to add that functionality. I spilt it in two functions: emacs-batch-script: Run an arbitrary elisp expression and return the output as a string. emacs-header-parse: Given a header section and a file it will return the value of that section. For example (emacs-header-parse "version" "path/to/an/elisp/package.el") Reason for the spilt is that people might want to run other elisp snippets. Fredrik Salomonsson (2): guix: emacs-utils: Add emacs-batch-script. guix: emacs-utils: Add emacs-header-parse. guix/build/emacs-utils.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) base-commit: 3935451f63c078cae9a928d87c6838ec3138abc0 -- 2.36.0 ------------=_1655497802-598-1--