From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Shea Levy Newsgroups: gmane.emacs.devel Subject: Re: Propagating local variables? Date: Thu, 17 May 2018 08:18:52 -0400 Message-ID: <87in7mv5jn.fsf@xps13.shealevy.com> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Trace: blaine.gmane.org 1526565733 8556 195.159.176.226 (17 May 2018 14:02:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 17 May 2018 14:02:13 +0000 (UTC) To: John Wiegley , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 17 16:02:08 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 1fJJTs-00028r-QH for ged-emacs-devel@m.gmane.org; Thu, 17 May 2018 16:02:08 +0200 Original-Received: from localhost ([::1]:57380 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJJVz-0004in-Tp for ged-emacs-devel@m.gmane.org; Thu, 17 May 2018 10:04:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJHs5-0004EI-5d for emacs-devel@gnu.org; Thu, 17 May 2018 08:19:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJHs0-0006pT-7I for emacs-devel@gnu.org; Thu, 17 May 2018 08:19:01 -0400 Original-Received: from smtprelay0155.hostedemail.com ([216.40.44.155]:39018 helo=smtprelay.hostedemail.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fJHs0-0006ow-1w; Thu, 17 May 2018 08:18:56 -0400 Original-Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id B431F180454D4; Thu, 17 May 2018 12:18:54 +0000 (UTC) X-Session-Marker: 7368656140736865616C6576792E636F6D X-HE-Tag: run91_4db24895cce4a X-Filterd-Recvd-Size: 3865 Original-Received: from localhost (c-71-235-10-46.hsd1.nh.comcast.net [71.235.10.46]) (Authenticated sender: shea@shealevy.com) by omf06.hostedemail.com (Postfix) with ESMTPA; Thu, 17 May 2018 12:18:53 +0000 (UTC) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 216.40.44.155 X-Mailman-Approved-At: Thu, 17 May 2018 10:04:11 -0400 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:225364 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable To provide some more context, the hackiness is two-fold: 1. How do we decide which buffers should inherit the relevant variables? Currently in most cases I'm using a "if it starts with a space it's probably morally a child" heuristic, plus a few extras hard-coded, but it's not great. 2. How do we actually ensure the variables are propagated? I wrote the inherit-local package to do the propagation, but there's no obvious hook point to call it (thus the advice around generate-new-buffer) "John Wiegley" writes: > I'd like to create a module, propagate.el, which defines a new class of b= uffer > local variables: buffer local variables that propagate to any buffers or > processes (in the case of exec-path and process-environment) created on b= ehalf > of the parent. > > For example, in certain language modes I have `exec-path' customized to p= ick > 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 al= l). > > 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 tha= t 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 "propagati= ng > 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 suppor= t 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, somethi= ng > that could "provide an environment" upon creation of these. > > All thoughts welcome, > --=20 > John Wiegley GPG fingerprint =3D 4710 CF98 AF9B 327B B80F > http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE6ESKvwKkwnxgMLnaXAvWlX2G/icFAlr9cywACgkQXAvWlX2G /icDHA//eg/uYi6rB5LzT3Vfc1AbcGsKWy+RhlKw6XrIOd03TORzSFGQh9XHXCdw qsstd3BsWjprAO2VIlIVg+nYYpbfGsC1vlQYS+SeIs7fPFRwS8AkMdnTJTGx8iA4 OPBRygDTq5QpW9ZthSf4NVNsMjw6y/J2DvEzCpvMlUPnqZ7upMXaqsNpKkhAbiqm +6FH8LJSxc5YrwGBUlamuuSoXK561LETl7oBKS3H3Ka0q/Cv9UaZgGw9SnQORNlI s85fCArvcwLtTbEb1Lu8uXA5GuSVqW4ve7AwTzh5LKrE+bU70fyf/GKoFK9f6Ih2 nOownToPlzRMjE3yDnMlCUz83FoMLNFYJ/NMnFYxQ4+qWYw+2FbePxD06adBOXfE ceYmRQozzd34tbLKnecpZMBWvaXtCGNdhGt8FxzmnTHux81DkDQZFwaU2QVioiMm xp1kS90LN0P3rmpqZF5v1L2sHpTgEXJtk+UF591i+aVfCY6g5xKrVmdqalZo64ya UDU11wvxD0trpRyCEFR2uEcS9vUJr9nQU5Cc3Vf5U2L9NN4G2ROSnL4rmEWPnML2 mNLdBAAAfxYBdQrM5hyUmW+Fk08C4qF8G19a8+Ot8fVt70SaehBhHdksL4P0PAsA JczRipYvnkAM9Yu6J79AYTNOoyq7wolQprzw7rfKdQysXb/jONo= =6tz4 -----END PGP SIGNATURE----- --=-=-=--