From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Propagating local variables? Date: Thu, 17 May 2018 10:45:50 -0400 Message-ID: References: <87fu2se06r.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1526568326 2500 195.159.176.226 (17 May 2018 14:45:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 17 May 2018 14:45:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 17 16:45:22 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 1fJK9i-0000Yz-Ep for ged-emacs-devel@m.gmane.org; Thu, 17 May 2018 16:45:22 +0200 Original-Received: from localhost ([::1]:59108 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJKBp-0000Yk-1f for ged-emacs-devel@m.gmane.org; Thu, 17 May 2018 10:47:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJKAO-00008f-Va for emacs-devel@gnu.org; Thu, 17 May 2018 10:46:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJKAK-0006SX-3C for emacs-devel@gnu.org; Thu, 17 May 2018 10:46:05 -0400 Original-Received: from [195.159.176.226] (port=53162 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJKAJ-0006Rp-SD for emacs-devel@gnu.org; Thu, 17 May 2018 10:46:00 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fJK8A-00074g-Fh for emacs-devel@gnu.org; Thu, 17 May 2018 16:43:46 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 44 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:D7Ohg0kiFNollq8kJFsl6mCwNq8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:225367 Archived-At: > SM> I only mentioned it as a mechanism to share a variable among various > SM> buffers. We could decide that shell.el obeys a `parent-buffer` variable > SM> (presumably set by some other package) when non-nil by fetching the > SM> buffer-local `process-environment' of that buffer. > There are too many other cases where this is needed. Expecting it to happen > "by convention" means it won't happen in many cases where it should, simply > because the idea of referencing a parent buffer was omitted. Agreed. Maybe this is remotely related to the idea of major-mode variables. We could imagine introducing a new notion of "setting", with operations like: (setting-set NAME VALUE CONTEXT) (setting-get NAME) where `setting-get` returns the "nearest" setting of NAME. CONTEXT could be: - a window - a frame - a major-mode - a buffer - a directory - a file - a terminal - ... and the notion of proximity would impose some ordering between these different CONTEXT values. Of course, the current-buffer would be "nearer" than the current frame, but what about the parent of the current-buffer? [ This is relevant to your use-case since in some situations we currently look at frame-parameters to decide how to build subprocess's environment variables (more specifically for the DISPLAY env-var). So a process-environment would actually want to be a combination of the environment specified from the frame and that specified by your parent's buffer. ] Of course, like all other proposals it doesn't solve the problem of making sure this new mechanism is used everywhere. Stefan