From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id GLg5FP+97GRFSAEAauVa8A:P1 (envelope-from ) for ; Mon, 28 Aug 2023 17:32:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id GLg5FP+97GRFSAEAauVa8A (envelope-from ) for ; Mon, 28 Aug 2023 17:32:15 +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 EFF765D524 for ; Mon, 28 Aug 2023 17:32:14 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=BNg71qTB; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1693236735; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: 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=siI45K/2zyaNXasgQPMzKMAVo0oZ2qNrI8tuNNkTBKs=; b=Vvl0PtQqCJkPzO4IOsjmzolJUHupCyqmUK2RjUjWfrIjEjaHpLcnlU7mXwpiC/qNkJ7Qyp bTnfiTn68kaqxJn0TM0vIJ+kxht+a+kT8957Z4Gu2Uz2eToIXZRIeBpdHwwLP6+GkPJ/lU TyaeRMMjZ4SSXPSp/6gsv7f3pPHZtQk5CwUZXZ4SP0oUq0L0geO0hPd0FyZIjvwx3kfq2G DIpaSZpZjao35oiI6vvErr4ehXm5nrLLgI+il/TJhQutFwWLb8PblNnwKBHpo9PY1rDTmL AJtSkeLa9cDwud5hbEd5hX/aU6wzredwIoWFLw/FBqG7ulKcJ6K1ZeUT8ktvBw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=BNg71qTB; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1693236735; a=rsa-sha256; cv=none; b=Tk2olbAIGUsCpCkmM9+T+9XEIzPCebVq6VbMCgPNo0VwH9W0ST51d1RGam563NQJLuAi1O rrbZ45hlcwjY7UjPJI9ir/2eqGxmb8R+fgVDgVg+QqzpI0EAGiP+A7Al0eJA2L/bbGQwuz eWYcgrMTodOj6EZ0rGuqY66KQ/dkMcgZxSjyS/aY71F86PLvNfZ4TcRdEDNifjh/+rTS10 E5qnBzEawuA7GHFa4JNlGG0fpejpb8+6zfwCLRTIHMQpXi4Yv28FABOjabsivF2ZDV+Y9i oxYPgwyrFG7gBYRatLJqr9vBjuDGgxhiIFQ3NuSOq3vf8EZF8HdQwQ4VdV764Q== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qae1N-0002Gu-Gr; Mon, 28 Aug 2023 11:19:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qae13-00020c-EA for bug-guix@gnu.org; Mon, 28 Aug 2023 11:18:58 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qae13-0006uY-6C for bug-guix@gnu.org; Mon, 28 Aug 2023 11:18:57 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qae18-0000FD-R0; Mon, 28 Aug 2023 11:19:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#65575: [PATCH v2 2/4] gnu: emacs: Factorize a 'guix-emacs--subdirs-files' procedure. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, cox.katherine.e+guix@gmail.com, liliana.prikler@gmail.com, bug-guix@gnu.org Resent-Date: Mon, 28 Aug 2023 15:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65575 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 65575@debbugs.gnu.org Cc: Maxim Cournoyer , Andrew Tropin , Katherine Cox-Buday , Liliana Marie Prikler X-Debbugs-Original-Xcc: Andrew Tropin , Katherine Cox-Buday , Liliana Marie Prikler Received: via spool by 65575-submit@debbugs.gnu.org id=B65575.1693235892857 (code B ref 65575); Mon, 28 Aug 2023 15:19:02 +0000 Received: (at 65575) by debbugs.gnu.org; 28 Aug 2023 15:18:12 +0000 Received: from localhost ([127.0.0.1]:48770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qae0J-0000De-El for submit@debbugs.gnu.org; Mon, 28 Aug 2023 11:18:11 -0400 Received: from mail-yb1-xb31.google.com ([2607:f8b0:4864:20::b31]:46222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qae0F-0000Cr-4i for 65575@debbugs.gnu.org; Mon, 28 Aug 2023 11:18:07 -0400 Received: by mail-yb1-xb31.google.com with SMTP id 3f1490d57ef6-d77c5414433so3267655276.0 for <65575@debbugs.gnu.org>; Mon, 28 Aug 2023 08:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693235875; x=1693840675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=siI45K/2zyaNXasgQPMzKMAVo0oZ2qNrI8tuNNkTBKs=; b=BNg71qTBGyZBZ5AzSxGM4Ob8BueJSnBP4OPI6NJ8f9gKG11XefJSwJ6dcIALz8M939 6rdP4TN+mG0H99rv/dxL7xL2f0HewVwYmHrpauc6obOD6oro+A9FbJsgLYEI3Ax9P/+C DpNGIGNgOXdSvuBHBLQIh3DGKvU4mOJC4godUfKndmcYXCJ9CrIy6UZL1GesFisoJAbH JMKFR3Cnfd4oXcDV4BUisb1NYlSbHmSiVVNuiixpJ5XV0WU8V5g4SjjvDi2ykZDHqooV I7YFkvTF0FtRPur/r+6CQwYrQuG7HaAE0bDxmnaFOvq7SYO5KqIcoJeqbs8e/1d12LYM EhPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693235875; x=1693840675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=siI45K/2zyaNXasgQPMzKMAVo0oZ2qNrI8tuNNkTBKs=; b=PYR/pCxLoCA6dgwpfq7lutUYbfRaamSplc4OwAhbYZZaavqgvt0+nvonfmSanof4Hu 8qn7P01nSYIo2fQKjbYIpXetqGEI2H/qUvwYSgRGVkTE5orOENeqQ9RaRqib2Yq/S6fB 2+6tmBOSb0VeTSbY05QrqguCTS+zZuqXggHjC5rvyhK0pvkWzGKt7LR2LUcO30zczK92 29SPErATefUr0HTuTg8fR0XWYhkbejCfHIoS7Py9TK0IT37YbSCB1XQ4ngunlfNdSrEC 0ss8pJA1J5a4i8+r7yJ1McIWYgnMUrRFBCMBwHNh4RPM9PUHWEnWx4+b/s1QrH+mg4Z3 GhzQ== X-Gm-Message-State: AOJu0YyxjVfRBZ6KP2/Aq150NvTHebAKW5+/IChqfym01URlmdodzmFG SdI3tLiGg8KXKQlwS1IQKECFTIBWS+A= X-Google-Smtp-Source: AGHT+IGblHG9NhDoUU1RVPeUIkWJNGJ/aNfVX3XaUMEt12inoE1th8955wiOYgEFa469TNOgGzhvAw== X-Received: by 2002:a25:ac24:0:b0:d78:1724:1b1a with SMTP id w36-20020a25ac24000000b00d7817241b1amr12776829ybi.37.1693235874926; Mon, 28 Aug 2023 08:17:54 -0700 (PDT) Received: from localhost.localdomain (dsl-10-132-204.b2b2c.ca. [72.10.132.204]) by smtp.gmail.com with ESMTPSA id s14-20020ac85ece000000b00410a9dd3d88sm2364705qtx.68.2023.08.28.08.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 08:17:54 -0700 (PDT) From: Maxim Cournoyer Date: Mon, 28 Aug 2023 11:16:34 -0400 Message-ID: <0eff8e838b5774c8298d71402f067c5dd59b1709.1693235796.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <6715bc07d825d632140c63bd98c959d31cc5de47.1693235796.git.maxim.cournoyer@gmail.com> References: <6715bc07d825d632140c63bd98c959d31cc5de47.1693235796.git.maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx2.migadu.com X-Migadu-Spam-Score: 4.28 X-Spam-Score: 4.28 X-Migadu-Queue-Id: EFF765D524 X-TUID: PZal4FKcwx+r * gnu/packages/aux-files/emacs/guix-emacs.el (guix-emacs--subdirs-files): New procedure. (guix-emacs-load-package-descriptors): Use it. --- Changes in v2: - Fix unbound 'dir' variable gnu/packages/aux-files/emacs/guix-emacs.el | 34 +++++++++++++--------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el b/gnu/packages/aux-files/emacs/guix-emacs.el index c98e7fe369..4db7ec28c9 100644 --- a/gnu/packages/aux-files/emacs/guix-emacs.el +++ b/gnu/packages/aux-files/emacs/guix-emacs.el @@ -3,7 +3,7 @@ ;; Copyright © 2014, 2015, 2016, 2017 Alex Kost ;; Copyright © 2017 Kyle Meyer -;; Copyright © 2019 Maxim Cournoyer +;; Copyright © 2019, 2023 Maxim Cournoyer ;; This file is part of GNU Guix. @@ -47,6 +47,13 @@ The files in the list do not have extensions (.el, .elc)." (string-match-p "/share/emacs/site-lisp" dir)) load-path)) +(defun guix-emacs--subdirs-files () + "Return the Guix subdirs.el files found on the (non-core) load path." + (seq-filter #'file-exists-p + (mapcar (lambda (dir) + (expand-file-name "subdirs.el" dir)) + (guix-emacs--non-core-load-path)))) + ;;;###autoload (defun guix-emacs-autoload-packages () "Autoload Emacs packages found in EMACSLOADPATH. @@ -63,19 +70,18 @@ The files in the list do not have extensions (.el, .elc)." ;;;###autoload (defun guix-emacs-load-package-descriptors () "Load descriptors for packages found in EMACSLOADPATH via subdirs.el." - (dolist (dir (guix-emacs--non-core-load-path)) - (let ((subdirs-file (expand-file-name "subdirs.el" dir))) - (when (file-exists-p subdirs-file) - (with-temp-buffer - (insert-file-contents subdirs-file) - (goto-char (point-min)) - (let ((subdirs (read (current-buffer)))) - (and (equal (car-safe subdirs) 'normal-top-level-add-to-load-path) - (equal (car-safe (cadr subdirs)) 'list) - (dolist (subdir (cdadr subdirs)) - (let ((pkg-dir (expand-file-name subdir dir))) - (when (file-directory-p pkg-dir) - (package-load-descriptor pkg-dir))))))))))) + (dolist (subdirs-file (guix-emacs--subdirs-files)) + (with-temp-buffer + (insert-file-contents subdirs-file) + (goto-char (point-min)) + (let ((subdirs (read (current-buffer)))) + (and (equal (car-safe subdirs) 'normal-top-level-add-to-load-path) + (equal (car-safe (cadr subdirs)) 'list) + (dolist (subdir (cdadr subdirs)) + (let ((pkg-dir (expand-file-name + subdir (file-name-directory subdirs-file)))) + (when (file-directory-p pkg-dir) + (package-load-descriptor pkg-dir))))))))) ;; If emacs built with tree-sitter, read the value of the environment variable ;; to make tree-sitter grammars available in emacs out-of-the-box. -- 2.41.0