From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id oCuhFapu8WTBkwAAG6o9tA:P1 (envelope-from ) for ; Fri, 01 Sep 2023 06:55:06 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id oCuhFapu8WTBkwAAG6o9tA (envelope-from ) for ; Fri, 01 Sep 2023 06:55:06 +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 D935641103 for ; Fri, 1 Sep 2023 06:55:05 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=TyXJnfdp; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1693544106; 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=I7jWgxABeuVjvmlSDfa+coE47lXJNf7XYgBz66VnE5E=; b=iQ6rqP+EY6nannkTv4YA4dKZ6StqI0xni/II9LCs/fVXLcsSh5p/HFHMg2wqWn4qkWO9uO B4BEWRj7Ro0lxeKbiGU5cFJ6vlpk5aPdiz4t5hwcO0al9FQE2Bixc8Rp4ZU8GpWF2ntOEm yzO0Jn4/Sz5ZCsJvqbkI1EeffDMK7QQmb5uzGJQ2TwQbsyFbNMsxgdgL8hifZb4GmzzRen m+P5jIQfkVUzNxemNwNnAI14FR+cQME0wE+WV1DhEa9v8CESXLmW11N1ARwZxR2ZTYFgBi fo2vJq8uMJ/YdYsufiirzMHvqJwUQgm785aKijOJeWZlmHuq7mU6ivvEMnlq3w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=TyXJnfdp; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1693544106; a=rsa-sha256; cv=none; b=tweSmKbSWs+JVcVReJ6mtztOy+azRZa1C/a4kOt0R4kTRn4bRoBEpFvETP4WtAXEcC2QFO eblIoeEk0XNe958dqK8VEYw9SG1QqY0pj23gIOiPTff6wif+2lsjj5Qg0UIGWm6kwarJz+ W/0GoiYGXJbZb3d98Hv4u80cm3eLdlxEiPbtRPZTWsj9g4/8AFhOemolW3mpJIQNBYKM1f C4DUPM3q7hVXl9Er3QG8UvvyF2xSsxvqJWgEz37lJZoVA7sl2RBVmF00kyl5A2607FFj9j mJtav032TzeP9G/5rl1ZyPN3uI3YX3zCUaqg2QgLt5smmEmOZxA3v3+p1MiUvA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbwBM-0003m8-2L; Fri, 01 Sep 2023 00:54:56 -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 1qbwBJ-0003l4-Mv for bug-guix@gnu.org; Fri, 01 Sep 2023 00:54:53 -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 1qbwBJ-0006Tu-EX for bug-guix@gnu.org; Fri, 01 Sep 2023 00:54:53 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qbwBS-00019D-7b; Fri, 01 Sep 2023 00:55:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#65575: [PATCH v3 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: Fri, 01 Sep 2023 04:55: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.16935440754346 (code B ref 65575); Fri, 01 Sep 2023 04:55:02 +0000 Received: (at 65575) by debbugs.gnu.org; 1 Sep 2023 04:54:35 +0000 Received: from localhost ([127.0.0.1]:59650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbwB0-000181-FH for submit@debbugs.gnu.org; Fri, 01 Sep 2023 00:54:34 -0400 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]:57459) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbwAx-00017U-Ky for 65575@debbugs.gnu.org; Fri, 01 Sep 2023 00:54:32 -0400 Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-76f066e4fffso98448485a.2 for <65575@debbugs.gnu.org>; Thu, 31 Aug 2023 21:54:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693544057; x=1694148857; darn=debbugs.gnu.org; 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=I7jWgxABeuVjvmlSDfa+coE47lXJNf7XYgBz66VnE5E=; b=TyXJnfdp55Vzm+Wmnr1dIAAktRrFl/+gT6CDwIdkPu8plQbKBI6VCPQqgyovXQEzWK mXqQk+4sfU4GuIqubU7vyflwPg6KW0RHNc/Bdo/rxTvEbfMw9VOHTwjz8jxHGuqc7amH 7Q78ZCKQs9T4+ciu9ZguXDmRploOClBCWCTjWrvGyHHg/r/lklpY3Hd7zVYWzZ+3u4aI zB6rimZSSXi0pwDV/R1xTesAYwa5wBTMeesokMzJ5Z7my8zllLBrsTn/1e3daxep+8mn ixDZ5JQPOc8RzDyAeFsA7tcdV6kK7w0X97ZXvu61pDB93ddvtj6v04Riup3NYBwb+QZl GtRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693544057; x=1694148857; 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=I7jWgxABeuVjvmlSDfa+coE47lXJNf7XYgBz66VnE5E=; b=SPk+SpqELD59iHAUxwIRzKs5DSH6Z86BjJF7jPFWv9v2T+2E8oLw2+maNk1GndbO6e f9lyA6/Yk74gdsFXQk73UnYSgRM2kxyN5SQiZT/vym6ZmS/TPaLL7vepz0LlYXB8XzxD fDLQa19ougbs9BQzTMhmn7lolvbjOXdQTjMxk9B6iP9yxsqJ+2OvYhO+MGu2L84v94PK 1U615J9I00fVxHI7iyTI5vUi33NazAer5mFyaOGZ19g8no64n5xVr/NCqRbMm42rn351 2WYyFpMG6gB+1WKV2DU+w+oQENlsTNoC315TIVUM4ADbi9qdy45iAiPSJNnZ8y1liqi9 sMrw== X-Gm-Message-State: AOJu0YzdGO7eMqtw3xrOmiGvQ2OjSjHZSlDx0JehKIUdc8XftOLxpHk1 3/3/q1t5rMR+fvjZHJFlLczmjA/FikQ= X-Google-Smtp-Source: AGHT+IGVMIWwdi3qqd8826VVC5Re8Lfr9vkuzvrYVwtsRmu0TKUnDe0jyg+qvBzN03WhWQRRejMQHg== X-Received: by 2002:a05:620a:1489:b0:76e:f3a3:4ac6 with SMTP id w9-20020a05620a148900b0076ef3a34ac6mr1234917qkj.35.1693544056841; Thu, 31 Aug 2023 21:54:16 -0700 (PDT) Received: from localhost.localdomain (dsl-10-128-23.b2b2c.ca. [72.10.128.23]) by smtp.gmail.com with ESMTPSA id v15-20020ac8748f000000b00410ad87b1e0sm1176627qtq.46.2023.08.31.21.54.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 21:54:16 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 1 Sep 2023 00:53:19 -0400 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx1.migadu.com X-Migadu-Spam-Score: -3.63 X-Spam-Score: -3.63 X-Migadu-Queue-Id: D935641103 X-TUID: vo+IwRVG0pyi * gnu/packages/aux-files/emacs/guix-emacs.el (guix-emacs--subdirs-files): New procedure. (guix-emacs-load-package-descriptors): Use it. --- (no changes since v2) 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