GNU bug report logs - #75748
[emacs-guix] elisp: Change guix-set-emacs-environment to use local variables.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Janneke Nieuwenhuizen <janneke@HIDDEN>; dated Wed, 22 Jan 2025 08:32:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 75748 <at> debbugs.gnu.org:


Received: (at 75748) by debbugs.gnu.org; 17 Mar 2026 14:14:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 17 10:14:58 2026
Received: from localhost ([127.0.0.1]:49703 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w2VCD-0001HQ-3j
	for submit <at> debbugs.gnu.org; Tue, 17 Mar 2026 10:14:58 -0400
Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:49600)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>)
 id 1w2VC7-0001GZ-JU
 for 75748 <at> debbugs.gnu.org; Tue, 17 Mar 2026 10:14:52 -0400
Received: by mail-wm1-x32e.google.com with SMTP id
 5b1f17b1804b1-4838c15e3cbso52857685e9.3
 for <75748 <at> debbugs.gnu.org>; Tue, 17 Mar 2026 07:14:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1773756890; x=1774361690; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=FPHHWzZyXR0nPUBSpZeLvBMAsn6G8HqKsT4QidRvJKE=;
 b=Lvng5Qx712Krv9r4V4icLpy5PklL8cCG7F+492SkIWwedBbre1SnUmb+sqvx1nYk9a
 IgfH+QRcHNMEn1s3IwpsNXyxKaiYSNsvqpoZu9/2stwZel9QhEpGpaUortLxp3vOt8dp
 O4FVs8dbWZ634WiIb02561Q18+cCIZxyH9AC/+jlND4vt2pXlY5DZJlXdqgc5+FKhSkK
 qTzgM5OQhFrItn67Lzz8tlFl77FYgJ/trRLd9mwE/fx8RqscYxwRyDfNwQZy857zD1Xl
 bJv2nzWv7l1Dcd/MSchKn9hxk2jkAaag2FPPzuz3FO1vYo3LYDf3DnBdeQDdb7UBEeBx
 7WwQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1773756890; x=1774361690;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject
 :date:message-id:reply-to;
 bh=FPHHWzZyXR0nPUBSpZeLvBMAsn6G8HqKsT4QidRvJKE=;
 b=SHKPqPihI2+7rnWIu43KF3kfuyJVVRbOV31U+FAv9padRzbKD/LhyhJHCxw4f9m2UK
 6ZalAkLUAH6gjczGhtbxA0JY+geT9H7vvk64k/DZM7Ei9jbC1LEtrE5YRnxY7IjdohJ+
 ApTXMHZYdxziPAwZV8q8YFv1l5nWdX8Ym1+65CkdRKT1CqQZ3VYRWGQCN1BSJn6xT2Mb
 Bgk55MiPsOxRVx4qyXY/MbN0XJt8VjOUz6q/dbwCrok4BIb0EIo6ncOLNstCGAb5s9sa
 b/ukafz+TLthJyeQPJlUpuI/iP1ReJeRiEaIbIux/hTw/q9O0ABaSBPtYyMUS13wyAsT
 pTjg==
X-Gm-Message-State: AOJu0Yz56bDZaoQe6Fk1qOCWytkCA7gdmZ14U3OnL8rNlgUNSxzMg5SK
 suymbYuZS2+sRmSL5rfIX9aL3/eDDvKoOhRxg5rN8PfAviVAHZHAhXRPsDAyhw==
X-Gm-Gg: ATEYQzyokuhLVijVzud5aTBLR5ryHc38W20tV5C0Al3pUBTkJ50Qh58v+8zK5K6yhkc
 m2hdOcyXJM/lvL3bX/b8UgWnuyokCsYkkGNDQKXe8vXcRrtJ8i0kStYHaO6KYfN52zH3F5ARHMh
 O+7+vP1PXXWyvYKhkLphLKHlsSh9mWU2g5rXT4Ur/8pAjXh2SYo0tmhvR5JK+r6EYyntJaq5o3E
 J8X2u1NgQyATtBjQd0TOzP1WaUBiELL0aTNo28ttYiVYxIrUP+kayt+j1WwGP9BYgeRCvdCoEGW
 5LC1NflfPbmqozYTY+kSuzy34/9RhDkaCMeZKTFLSVb+gpmaQLfXDo2B29myty3kV74uVPaELU5
 I9e2CJIFfYQ/gY3C4S/y5XHHpeieRl+SGEzwf/I0pDL1WmA9wLc9daYuGq0ZdHkt4gRGlJyx925
 PnX86oTN3ScxP/NC7/2Zeq
X-Received: by 2002:a05:600c:a4b:b0:485:3692:e8f7 with SMTP id
 5b1f17b1804b1-48556707ddbmr284924845e9.25.1773756890028; 
 Tue, 17 Mar 2026 07:14:50 -0700 (PDT)
Received: from lili ([2a01:e0a:59b:9120:bd92:7cc7:2aef:d5f8])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-48557a73a75sm115861405e9.15.2026.03.17.07.14.48
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 17 Mar 2026 07:14:48 -0700 (PDT)
From: Simon Tournier <zimon.toutoune@HIDDEN>
To: Janneke Nieuwenhuizen <janneke@HIDDEN>
Subject: Re: bug#75748: [emacs-guix] elisp: Change
 guix-set-emacs-environment to use local variables.
In-Reply-To: <20250122083100.32018-1-janneke@HIDDEN> (Janneke Nieuwenhuizen's
 message of "Wed, 22 Jan 2025 09:30:58 +0100")
References: <20250122083100.32018-1-janneke@HIDDEN>
Date: Tue, 17 Mar 2026 15:04:25 +0100
Message-ID: <87wlzav9g6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 75748
Cc: 75748 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

Hi Janneke,

This submission feels alone. :-)

    https://issues.guix.gnu.org/issue/75748

In the context of Debbugs sunset, what do you think to re-send it as a
pull request to Codeberg <https://codeberg.org/guix/emacs-guix>.


On Wed, 22 Jan 2025 at 09:30, Janneke Nieuwenhuizen <janneke@HIDDEN> wrote:

> This changes the semantics of "guix-set-emacs-environment" and that's
> probably what one would expect.  Keeping old functionality as
> "guix-set-emacs-environment-global".
>
> * elisp/guix-misc.el (guix-set-emacs-environment): Rename to...:
> (guix-set-emacs-environment-global): ...this.
> (guix-set-emacs-environment): New procedure setting a buffer-local environment.
> * doc/emacs-guix.texi (Miscellaneous Commands): Update accordingly.
> Add hint about "emacs-envrc".
> ---
>  doc/emacs-guix.texi | 17 +++++++++++++----
>  elisp/guix-misc.el  | 33 ++++++++++++++++++++++++++++++---
>  2 files changed, 43 insertions(+), 7 deletions(-)

Or even maybe directly merge it. :-)  I mean, it LGTM.

Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#75748; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 22 Jan 2025 08:31:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 22 03:31:27 2025
Received: from localhost ([127.0.0.1]:59663 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1taW91-0002RN-3R
	for submit <at> debbugs.gnu.org; Wed, 22 Jan 2025 03:31:27 -0500
Received: from lists.gnu.org ([2001:470:142::17]:55968)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <janneke@HIDDEN>) id 1taW8x-0002R7-Kh
 for submit <at> debbugs.gnu.org; Wed, 22 Jan 2025 03:31:24 -0500
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 <janneke@HIDDEN>) id 1taW8o-0004tp-SG
 for guix-patches@HIDDEN; Wed, 22 Jan 2025 03:31:15 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <janneke@HIDDEN>)
 id 1taW8n-0007Um-0h; Wed, 22 Jan 2025 03:31:13 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to:
 references; bh=+Fdp6GpSctU0wjgZ307MHrCtqtr4Bsz9eUTSYs/hnDU=; b=eFkhmxY/H9gNmm
 UeGO6nujMHAm6Ehj4hPUrnditNWrSwPeiFRCJ8igo4e0DyOJFntm96x1JFugSmzyYJnEdbvp93aFI
 T0BdN/54bB/WlfDwr1kIBxPuXt2zWIePF+to1fYdLOg7lPJMAwzXotBCUGjTpQFMJH0kVovxtBz34
 WXmKyMY53x+TRs3AMRnwx2oLHODhBpACbZ1Eag8yubTZVY2I/nbPZg4RkRU8h8dKNxsMnb1EGXAVq
 JYdKAr9k0Rcw3w/sBA8MrlTkG8dxGPgl/RShzrpfYDH2CSJp1XvwLfS+wna+l+1LPI/FvsAASRmZM
 bwv8s0MBiWrI6WORrOgw==;
From: Janneke Nieuwenhuizen <janneke@HIDDEN>
To: guix-patches@HIDDEN
Subject: [emacs-guix] elisp: Change guix-set-emacs-environment to use local
 variables.
Date: Wed, 22 Jan 2025 09:30:58 +0100
Message-ID: <20250122083100.32018-1-janneke@HIDDEN>
X-Mailer: git-send-email 2.46.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: submit
Cc: ludo@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This changes the semantics of "guix-set-emacs-environment" and that's
probably what one would expect.  Keeping old functionality as
"guix-set-emacs-environment-global".

* elisp/guix-misc.el (guix-set-emacs-environment): Rename to...:
(guix-set-emacs-environment-global): ...this.
(guix-set-emacs-environment): New procedure setting a buffer-local environment.
* doc/emacs-guix.texi (Miscellaneous Commands): Update accordingly.
Add hint about "emacs-envrc".
---
 doc/emacs-guix.texi | 17 +++++++++++++----
 elisp/guix-misc.el  | 33 ++++++++++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/doc/emacs-guix.texi b/doc/emacs-guix.texi
index 3219354..d073cb8 100644
--- a/doc/emacs-guix.texi
+++ b/doc/emacs-guix.texi
@@ -11,6 +11,7 @@ This document describes Emacs-Guix, the Emacs interface for the
 @quotation
 Copyright @copyright{} 2014-2019, 2021 Alex Kost@*
 Copyright @copyright{} 2018 Oleg Pykhalov
+Copyright @copyright{} 2018, 2025 Janneke Nieuwenhuizen
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3
@@ -1764,10 +1765,18 @@ Open a mail buffer to report a bug for GNU Guix similarly to
 @kbd{M-x@tie{}report-emacs-bug} command.
 
 @findex guix-set-emacs-environment
-@item M-x guix-set-emacs-environment
-Set current Emacs environment according to a specified profile.  Note
-that there is no way to restore the original environment (you have to
-restart Emacs if you wish to do it).
+@item M-x guix-set-emacs-environment-global
+Buffer-locally set Emacs environment according to a specified profile.
+Note that there is no way to restore the original environment for this
+buffer (you have to kill the buffer and re-create it if you wish to do
+it).  If you find yourself using this command often, you may want to
+look at the @file{emacs-envrc} package.
+
+@findex guix-set-emacs-environment-global
+@item M-x guix-set-emacs-environment-global
+Globalally set current Emacs environment according to a specified
+profile.  Note that there is no way to restore the original
+environment (you have to restart Emacs if you wish to do it).
 
 @findex guix-pull
 @item M-x guix-pull
diff --git a/elisp/guix-misc.el b/elisp/guix-misc.el
index f4a7aaa..0cc0dfc 100644
--- a/elisp/guix-misc.el
+++ b/elisp/guix-misc.el
@@ -1,7 +1,7 @@
 ;;; guix-misc.el --- Miscellaneous definitions  -*- lexical-binding: t -*-
 
 ;; Copyright © 2014–2018 Alex Kost <alezost@HIDDEN>
-;; Copyright © 2018, 2020, 2023 Janneke Nieuwenhuizen <janneke@HIDDEN>
+;; Copyright © 2018, 2020, 2023, 2025 Janneke Nieuwenhuizen <janneke@HIDDEN>
 
 ;; This file is part of Emacs-Guix.
 
@@ -223,8 +223,8 @@ FILE.  With a prefix argument, also prompt for PROFILE."
     (guix-display-buffer guix-search-paths-buffer-name)))
 
 ;;;###autoload
-(defun guix-set-emacs-environment (&optional profile)
-  "Set Emacs environment to match PROFILE.
+(defun guix-set-emacs-environment-global (&optional profile)
+  "Set global Emacs environment to match PROFILE.
 PROFILE can be a named profile (like '~/.guix-profile',
 '~/.config/guix/work') or a direct link to profile from the
 store, like GUIX_ENVIRONMENT variable (see Info node `(guix)
@@ -248,6 +248,33 @@ If PROFILE is nil, use `guix-current-profile'."
         (when (equal variable "INFOPATH")
           (setq Info-directory-list (split-string value ":")))))))
 
+;;;###autoload
+(defun guix-set-emacs-environment (&optional profile)
+  "Set Emacs environment to match PROFILE.
+PROFILE can be a named profile (like '~/.guix-profile',
+'~/.config/guix/work') or a direct link to profile from the
+store, like GUIX_ENVIRONMENT variable (see Info node `(guix)
+Invoking guix environment' for details).
+
+If PROFILE is nil, use `guix-current-profile'."
+  (interactive (list (guix-read-profile)))
+  (let ((specs (guix-eval-read
+                (guix-make-guile-expression
+                 'search-paths-specifications
+                 (guix-file-name profile)))))
+    (dolist (spec specs)
+      (-let* (((variable separator path) spec)
+              (current-value (getenv variable))
+              (value (if (and separator current-value)
+                         (concat path separator current-value)
+                       path)))
+        (setq-local process-environment
+                    (cons (concat variable "=" value) process-environment))
+        (when (equal variable "PATH")
+          (setq-local exec-path (split-string value ":")))
+        (when (equal variable "INFOPATH")
+          (setq-local Info-directory-list (split-string value ":")))))))
+
 
 ;;; Executing guix commands
 
-- 
2.46.0





Acknowledgement sent to Janneke Nieuwenhuizen <janneke@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#75748; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 17 Mar 2026 14:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.