From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 4G3fIu3T82JhDAEAbAwnHQ (envelope-from ) for ; Wed, 10 Aug 2022 17:51:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id qJvLIu3T82KsfgEA9RJhRA (envelope-from ) for ; Wed, 10 Aug 2022 17:51:09 +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 505223A8C8 for ; Wed, 10 Aug 2022 17:51:09 +0200 (CEST) Received: from localhost ([::1]:38654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLnz9-00058x-LB for larch@yhetil.org; Wed, 10 Aug 2022 11:51:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLnz3-00058T-W0 for guix-patches@gnu.org; Wed, 10 Aug 2022 11:51:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60774) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oLnz3-0005lb-Mv for guix-patches@gnu.org; Wed, 10 Aug 2022 11:51:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oLnz3-0003hK-IJ for guix-patches@gnu.org; Wed, 10 Aug 2022 11:51:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57086] [PATCH v2 5/6] guix: emacs-utils: Add emacs-compile-directory. References: <4c232648145659a2c3edca6d32725d8120cc14d3.camel@gmail.com> Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 10 Aug 2022 15:51:01 +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 Cc: "\(" X-Debbugs-Original-To: 57086@debbugs.gnu.org, 57086@debbugs.gnu.org Received: via spool by 57086-submit@debbugs.gnu.org id=B57086.166014664214173 (code B ref 57086); Wed, 10 Aug 2022 15:51:01 +0000 Received: (at 57086) by debbugs.gnu.org; 10 Aug 2022 15:50:42 +0000 Received: from localhost ([127.0.0.1]:50521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oLnyj-0003gX-Ku for submit@debbugs.gnu.org; Wed, 10 Aug 2022 11:50:41 -0400 Received: from mail-ej1-f67.google.com ([209.85.218.67]:44557) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oLnyi-0003gE-Dl for 57086@debbugs.gnu.org; Wed, 10 Aug 2022 11:50:40 -0400 Received: by mail-ej1-f67.google.com with SMTP id qn6so16654758ejc.11 for <57086@debbugs.gnu.org>; Wed, 10 Aug 2022 08:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:content-transfer-encoding:cc:to:subject :in-reply-to:date:from:from:to:cc; bh=qt6NykkPTNTfYRIgHX3RI1Vc6QQhQqUbCBZmDMa327k=; b=KlE4DGQSTRfLgrriVGrOsQ63jGuM5vzpYpy2csX7aak12c0QVIOMwstk4qWNPLHmrc WNGZlE9D+t4ai0gd/SVHJZ6eVA0qMYvZdGXr1B5kgOHr53G5Ro4w3/ISFcZ2qT3BSzq6 /MfspseF0jLpLG/nVkFfBrB1y2MnlVTvoP2zs+0GUsAucQtUJSqd8UndKy/ok0FJ5X7W xzQZreKhYtJLeeLqx68kgsY55zYCdeINIIhqyJbfyEoF6yLjRVyaVsMh3NjAsaOMgpat 7Z79G2hoL8ZWCBkqzPiQ816P4RQ7lgu6d0oa9CvFLH8xzt6cfs1N8no0VlAkPIWL0hLh p6Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:content-transfer-encoding:cc:to:subject :in-reply-to:date:from:x-gm-message-state:from:to:cc; bh=qt6NykkPTNTfYRIgHX3RI1Vc6QQhQqUbCBZmDMa327k=; b=o7Q2VeU98o1WK9TJFnP3nwytdxTpqi9wz2QVoYuEWZjoS9iOoDgvDJPGQFJY1ZM+tr QvhC0/+G486stF/adMxRowA+2VOC3mATlLTpNjxSpDmuXucJjZFgTRA2OMXJGosnaAi1 CjR4kg9Jiy03LD0Xnzb0txItB66ZfIFhtCcbNXH/52OXcBRqeKiZZACjyqrptbaRITq1 fWkGKr9nh36LPjYuvMy+KA9HNx622fTeWRAUIjtyr2afcTqOVwxFDDxsRFR0v8iW4yXU vzGc+XeItfu3QqRoCrgpVoQS8I4lWbD7L6bCLaVDpcsaF3Q6wp0lYC8/ePVVheyXvMYu oA1A== X-Gm-Message-State: ACgBeo0sONo1rRLTXTEyiVSVHFUlyFowxpcZVG6HyfxraBeklt5kI+ip +SXy7sWP1riycW9E3PgepIiPGVrwa1s= X-Google-Smtp-Source: AA6agR5TIR8U7iBaoM2iIo5cgzOBDFneiLbOsC8X0TPxr0sFAf2GRB69NjggZ9XMtWgiUzVy2JGgBw== X-Received: by 2002:a17:907:2707:b0:730:af0b:3572 with SMTP id w7-20020a170907270700b00730af0b3572mr20369018ejk.411.1660146634488; Wed, 10 Aug 2022 08:50:34 -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 by23-20020a170906a2d700b00730979f568fsm2449707ejb.150.2022.08.10.08.50.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:50:34 -0700 (PDT) From: Liliana Marie Prikler Date: Tue, 9 Aug 2022 20:26:06 +0200 In-Reply-To: Content-Transfer-Encoding: 7bit Message-ID: <15d55f67f02be0988fb541c032190399d89a05ae.camel@gmail.com> 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=1660146669; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=qt6NykkPTNTfYRIgHX3RI1Vc6QQhQqUbCBZmDMa327k=; b=uA+3kvbwGVq+kcWrTGr+02eL72gBgcAhw94BBcqP+82KJkS3rAXauEMDUyEA3Ttk+jzd3n BltzeDPuI2pyW9pTS1RuyGV6xned+3wJjzbK6VuU15U71Nu2vhx/T/83mJ4ajN8j386+ce 4JX7I6p2e2KkW1mPGczTYSKRPjYbQ640VHWSinNqkV+XLOVAlVUG44U5BhEV6PMvpU3fer Poop0/YTWTYfiaNfQmY4Ak+3AsLUa7VxZw3ILg5wLUaVVD6RleB+KQk9WGJtDyiTe9atgu PRLZe5QaBbMkZDDfmU/4harfsW7jjvz8rEL7F9ZqvEnJzZ7mZiQ44lHYEMyjpw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1660146669; a=rsa-sha256; cv=none; b=hboLnN0+kat4UmW0sSxr3hpo2gHiABDEfip4/e/WPHCT/e2l5Osp8m0wazoqEhV07SK9+M ErHzfd1zBkBXCVGVe832vCP/9Ve8G9rXpkKs2p0vQTKjBAuCDbKJZ+kfOJZRSe8diB4IOi faK1znzH0hX7JdZ4bxL3XyQgs6DBjK0NUs6U7/OADsxj6IVJxPTcOVrn7fCfQu72S8P7vd bt6qLhBTdyjHd6iEVJ3ztbneFWXHCTShIdAx2SqqnPbtohQYBfq/A7AKNar0CJbwO8Mhjo JddSeKXbfmTtDhfJqG3mjwVQXY0l+U6cVTxrDk0bgkyrAC/YV3T3qzA9oPWZKA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=KlE4DGQS; 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: 7.61 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=KlE4DGQS; 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: 505223A8C8 X-Spam-Score: 7.61 X-Migadu-Scanner: scn1.migadu.com X-TUID: k/D71lr0kpNN * guix/build/emacs-utils.scm (emacs-compile-directory): New variable. --- guix/build/emacs-utils.scm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index 8ee547f2b3..2eb8f30120 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,33 @@ (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 + ;; For trampoline compilations + (native-compile-target-directory (file-name-directory 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