From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?G=C3=B6ktu=C4=9F_Kayaalp?= Subject: Re: Inheriting some local variables from source code block editing buffers Date: Tue, 01 May 2018 06:30:33 +0300 Message-ID: References: <874ljt3bs0.fsf@gnu.org> 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]:47824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDM09-0002pZ-0b for emacs-orgmode@gnu.org; Mon, 30 Apr 2018 23:30:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fDM04-0005Gq-T3 for emacs-orgmode@gnu.org; Mon, 30 Apr 2018 23:30:49 -0400 In-Reply-To: <874ljt3bs0.fsf@gnu.org> (Bastien's message of "Mon, 30 Apr 2018 00:09:35 +0200") 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: Bastien Cc: emacs-orgmode@gnu.org On 2018-04-30 00:09 +02, Bastien wrote: > Hi G=C3=B6ktu=C4=9F, > > thanks for your patch. You're welcome! > Kayaalp writes: > Do you have other examples on local variables that would be useful to > pass on when editing code in Org Src buffers? Currently I only pass on lexical-binding and truncate-lines, and I do not have another concrete example in my configuration (I do not use source blocks for anything other than shell and elisp currently). But I have listed some hypothetical use cases further down. > 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 might be a better way indeed. But this setting is then global, i.e. one can't have the file A.org have lexical-binding on, but B.org off (which might be necessary for say an older org file that depends on lexical binding). > This is: *if* we find cases that seem generic enough. > > What do you think? One case I can think of is to set variables like fill-column when editing inline LaTeX, HTML, &c blocks, and also, those like c-file-style, where say when writing a paper the author wants to use k&r style, but when writing a literate source prefers gnu style. Maybe a good way to achieve this would be to have the way you suggest to set defaults for Babel, but allow to define such bindings also in individual org mode files, either via the local variables or with a specific #+keyword like: #+edit_special_bindings: lexical-binding:t # or #+edit_special_bindings: c-file-style:gnu fill-column:80 which is better IMO because there is no need to declare separately which variables to copy, and is more granular. Also, in this case, a shortcut syntax for inheriting the buffer local value of a variable can be useful: =3D=3D=3D=3D x.org =3D=3D=3D # -*- fill-column: 65 -*- #+edit_special_bindings: c-file-style:gnu fill-column* This can be useful when one needs/wants to keep a consistent style in a given file. --=20 =C4=B0. G=C3=B6ktu=C4=9F Kayaalp 024C 30DD 597D 142B 49AC 40EB 465C D949 B101 2427