From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id SEJqAUCt8mJ2ZAAAbAwnHQ (envelope-from ) for ; Tue, 09 Aug 2022 20:53:52 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id gK9/AECt8mIXMQAAG6o9tA (envelope-from ) for ; Tue, 09 Aug 2022 20:53:52 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9878DF131 for ; Tue, 9 Aug 2022 20:53:51 +0200 (CEST) Received: from localhost ([::1]:51194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLUMQ-0001db-NW for larch@yhetil.org; Tue, 09 Aug 2022 14:53:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLUKi-0000pD-1w for guix-patches@gnu.org; Tue, 09 Aug 2022 14:52:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55267) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oLUKh-00025o-N3 for guix-patches@gnu.org; Tue, 09 Aug 2022 14:52:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oLUKh-0003U4-JY for guix-patches@gnu.org; Tue, 09 Aug 2022 14:52:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57086] [PATCH 5/6] guix: emacs-utils: Add emacs-compile-directory. References: <4c232648145659a2c3edca6d32725d8120cc14d3.camel@gmail.com> In-Reply-To: <4c232648145659a2c3edca6d32725d8120cc14d3.camel@gmail.com> Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 09 Aug 2022 18:52:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57086 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57086@debbugs.gnu.org Received: via spool by 57086-submit@debbugs.gnu.org id=B57086.166007111213336 (code B ref 57086); Tue, 09 Aug 2022 18:52:03 +0000 Received: (at 57086) by debbugs.gnu.org; 9 Aug 2022 18:51:52 +0000 Received: from localhost ([127.0.0.1]:45009 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oLUKV-0003Sv-Q5 for submit@debbugs.gnu.org; Tue, 09 Aug 2022 14:51:52 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:44697) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oLUKR-0003S2-BM for 57086@debbugs.gnu.org; Tue, 09 Aug 2022 14:51:49 -0400 Received: by mail-ed1-f68.google.com with SMTP id t5so16226782edc.11 for <57086@debbugs.gnu.org>; Tue, 09 Aug 2022 11:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:date:subject:to:content-transfer-encoding:message-id :mime-version; bh=/INyg+1eMQ8AHSX1C7bx4VZv/ingHjQkWmWyGlm0PHI=; b=AsVZJlkvrHqPhzV4QI7nlsbJzlBPA4XL9JsQGeaqwS9kzEyEfA6Bw9ZwyyZKi/cVQY Ck1R79zOIqth9GCjkwNUmgj6kExAWaNQAS9vGoww75E0eE1nWAXqM1L8LPxA7DvI44K5 YVhaYmZa5GvM0/4y15MQWmm/67h5+VDfCdxjp3Z67ULJ/yjo5HtzaEWT04uh3fkSMfrk dosBAXHgxQHlcmdhoOq9/BL3xOJhimp9y77rZ956KmmkHjEx2sQsZsD7cGrZpCTgwomX jRpOXgmqJFNALANx4RZsTmMFbhFRFxVLwJKDbrTCT89XoUSf8X4Mix1niS7zA/AwtuJ/ inrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:subject:to:content-transfer-encoding :message-id:mime-version; bh=/INyg+1eMQ8AHSX1C7bx4VZv/ingHjQkWmWyGlm0PHI=; b=yEGsygzr5AettLN8AuBqfM8o40nOe+mDmZEaZKRU2MZ4WYtJm/CTFNzkwArNDifdzC 9a0kEd3q0BgwNV3FxXSLOWCVY9I+msPfcXLQ33UTU94vJOi4ZDaby6IrFKRhWppdWVg0 JFmMdrjov2ftyXv3E0IPcDUS6eQsL3n6OU8PcIBBPqoY8FOjnex1lsqI6gWHFJXuCvBa m9RS1Jiszwug6GeXU15g3qAkjU1wEQxCO46ug7BxkGwQ5yD1e+5v55pOJMVIektMTN74 uklqoVo0Wum+W/Nzpt+gef9UQD5U6sTreahAhAmTwaUV0mPLeeRW+86SBQ4Nhxf/nnNU qv4A== X-Gm-Message-State: ACgBeo2tCdbjxA9dRM4FWvLzIA/N7WoSQz4JRqCho4pDJReRhCpBuR8H 8quC+imJ/vFsBZbxV1ynHG7TuD+vN4k= X-Google-Smtp-Source: AA6agR4JJYPn8K0Y21i2UWp8EzUyF/EAr36M1daZaquYB4nYfTwpNjC0YnJ4xfoSgFh7RMAfrrt+bg== X-Received: by 2002:a50:ee85:0:b0:43d:3e0:6157 with SMTP id f5-20020a50ee85000000b0043d03e06157mr23495229edr.19.1660071101584; Tue, 09 Aug 2022 11:51:41 -0700 (PDT) Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id x24-20020a170906149800b00705cdfec71esm1422023ejc.7.2022.08.09.11.51.41 for <57086@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 11:51:41 -0700 (PDT) From: Liliana Marie Prikler Date: Tue, 9 Aug 2022 20:26:06 +0200 Content-Transfer-Encoding: 7bit Message-ID: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1660071231; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=/INyg+1eMQ8AHSX1C7bx4VZv/ingHjQkWmWyGlm0PHI=; b=Ae+4OySrr15EH8m3TmnXud9iB7ousRhrrFgZtUnoteF96hvOXt85DKYHsabApqUKl2YzxL nWVom7uRKFT4J7vpnj7qh6vPoVdYc2MvgB5sgAQPT6NRHOYRbYUp5FHtG+PGGNYFk2wdcF Y9+vkLU/0b2S+4lBFKV9OJR2NljSgYFfi1lJVeq5nLf4oJtabLjxn9aivj1YsQpW9RQOCQ qYwzP7TjLJpoOFDXmH31HHSSCDW0KNYAXTdHjaQ65ypieFBQEWVC6ZwvOM1d3Bbwhv5VFL tG7AKKPm0yuyFl69pLphp6pR+E4T/QLI//xufrEasQAXVZjCu8qryL28ATHMmw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1660071231; a=rsa-sha256; cv=none; b=KQKo6WC+IVwa0EeQCG2Rz0AlpOMtMcnumdOZzGt0zrVlBLiP9pCx7EYHWXoV1mNc2z5f4i u4s98flobKqpcmCBO6+Bd+EzmajNTlDMeeHPRYaFyxjmIsPD7FswBLFMU+zrsOqWjZrrch LIkgc+fevoK5hfBwtLywNw0mte7AsHgVNeAAjKHwbXH6rx1EysWbtvsejtBK8EdCka+K38 jBn6AnKHBpbz5oEUAuKk7+3pcTNPQyS0uHAur5vs001eWgrPs+exibdeXEaKNaF/wvGP8w YC/cbuF9554CVbwTjs0SfcjMg7ro++ihDMWPOlc/f6nUUtCsRRO6cA313nWV0w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=AsVZJlkv; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 6.11 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=AsVZJlkv; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 9878DF131 X-Spam-Score: 6.11 X-Migadu-Scanner: scn1.migadu.com X-TUID: YTosJyuNpMSj * guix/build/emacs-utils.scm (emacs-compile-directory): New variable. --- guix/build/emacs-utils.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index 8ee547f2b3..17155a0b8b 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-compile-directory emacs-header-parse as-display @@ -115,6 +116,31 @@ (define* (emacs-byte-compile-directory dir) (byte-recompile-directory (file-name-as-directory ,dir) 0 1)))) (emacs-batch-eval expr))) +(define* (emacs-compile-directory dir) + "Compile all files in DIR to native code. + +If native code is not supported, compile to bytecode instead." + (emacs-batch-eval + `(let ((byte-compile-debug t) ; for proper exit status + (byte+native-compile (native-comp-available-p)) + (files (directory-files-recursively ,dir "\\.el$"))) + (mapc + (lambda (file) + (let (byte-to-native-output-file) + (if byte+native-compile + (native-compile file (concat (file-name-sans-extension file) + ".eln")) + (byte-compile-file file)) + ;; Sadly, we can't use pcase because quasiquote works different in + ;; Emacs. See `batch-byte+native-compile' in comp.el for the + ;; actual shape of byte-to-native-output-file. + (unless (null byte-to-native-output-file) + (rename-file (car byte-to-native-output-file) + (cdr byte-to-native-output-file) + t)))) + files)) + #:dynamic? #t)) + (define (emacs-header-parse section file) "Parse the header SECTION in FILE and return it as a string." (emacs-batch-script -- 2.37.0