From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "John Wiegley" Newsgroups: gmane.emacs.devel Subject: Propagating local variables? Date: Tue, 15 May 2018 12:37:30 -0700 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1526413091 2322 195.159.176.226 (15 May 2018 19:38:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 15 May 2018 19:38:11 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (darwin) Cc: Shea Levy To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 15 21:38:07 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fIflu-0000VV-Vh for ged-emacs-devel@m.gmane.org; Tue, 15 May 2018 21:38:07 +0200 Original-Received: from localhost ([::1]:56641 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIfnz-0008Fw-Uj for ged-emacs-devel@m.gmane.org; Tue, 15 May 2018 15:40:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIflS-0006uy-51 for emacs-devel@gnu.org; Tue, 15 May 2018 15:37:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIflP-0006gE-GB for emacs-devel@gnu.org; Tue, 15 May 2018 15:37:38 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:39497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIflP-0006g6-Cg; Tue, 15 May 2018 15:37:35 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:40683) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1fIflP-0001ZF-23; Tue, 15 May 2018 15:37:35 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id 853992231A; Tue, 15 May 2018 15:37:34 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 15 May 2018 15:37:34 -0400 X-ME-Sender: Original-Received: from localhost (76-234-69-149.lightspeed.frokca.sbcglobal.net [76.234.69.149]) by mail.messagingengine.com (Postfix) with ESMTPA id 2E613E498C; Tue, 15 May 2018 15:37:34 -0400 (EDT) Mail-Followup-To: emacs-devel@gnu.org, Shea Levy X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:225320 Archived-At: I'd like to create a module, propagate.el, which defines a new class of buffer local variables: buffer local variables that propagate to any buffers or processes (in the case of exec-path and process-environment) created on behalf of the parent. For example, in certain language modes I have `exec-path' customized to pick up specific versions of the compiler and debugger. If I run M-x gdb, I'd like the debugger used to be the one associated with _that_ buffer -- without making that debugger global to all other buffers (or even available at all). Right now this idea lies at the heart of Shea Levy's nix-buffer package, allowing you to have the equivalent of a "nix-shell" within Emacs, so that a given buffer (and its related child buffers and processes) all see a consistent set of dependencies as defined by some dir-locals.nix file. A next step for this project is to abstract out the concept of "propagating locals" to its own module. However, some of the aspects of implementing it have proven very hacky, so I'm wondering if we need more low-level support for this idea. For example, at the moment we do it with advice around generate-new-buffer. What would be better is to have a general hook for altering what happens when new buffers and processes are created, something that could "provide an environment" upon creation of these. All thoughts welcome, -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2