From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Inheriting some local variables from source code block editing buffers Date: Mon, 30 Apr 2018 00:09:35 +0200 Message-ID: <874ljt3bs0.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fCuVs-0008Ur-Pz for emacs-orgmode@gnu.org; Sun, 29 Apr 2018 18:09:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fCuVr-0001So-RK for emacs-orgmode@gnu.org; Sun, 29 Apr 2018 18:09:44 -0400 In-Reply-To: (=?utf-8?B?IkfDtmt0dcSf?= Kayaalp"'s message of "Sun, 29 Apr 2018 20:19:03 +0300") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: =?utf-8?B?R8O2a3R1xJ8=?= Kayaalp Cc: emacs-orgmode@gnu.org Hi G=C3=B6ktu=C4=9F, thanks for your patch. Kayaalp writes: > when editing a source block, passing some local variables from the > original buffer into the buffer in which the source code is edited might > be useful. My use case is passing the value of =E2=80=98lexical-binding= =E2=80=99 when > editing Elisp source code blocks in my literate .emacs so that I don't > mistakenly evaluate code in a non-lexical environment thinking it's the > opposite instead. Yes, I see how this can be useful in this case. Do you have other examples on local variables that would be useful to pass on when editing code in Org Src buffers? > I've implemented this with the patch attached to this message, if it's > deemed useful, I can revise it for inclusion upstream (just wanted to > see what you think about the idea with this one). Note that in the particular case of lexical-binding and emacs-lisp blocks, there is the :lexical block parameter -- of course, this is for execution, not edition, but you can use it as a clue on whether the block supposes lexical binding or not. In general, instead of inheriting values from the Org's buffer, I'd allow users to set the values independantly -- for example, the cdr of elements in `org-babel-load-languages', instead of being `t' all the time (because nil makes no sense to me), could contain an alist of variables and their local values when editing and... executing. This is: *if* we find cases that seem generic enough. What do you think? --=20 Bastien