From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Inheriting some local variables from source code block editing buffers Date: Tue, 01 May 2018 10:43:23 +0200 Message-ID: <87h8nrkbpw.fsf@nicolasgoaziou.fr> 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]:43688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDQso-0008DH-BI for emacs-orgmode@gnu.org; Tue, 01 May 2018 04:43:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fDQsn-0000hJ-FJ for emacs-orgmode@gnu.org; Tue, 01 May 2018 04:43:34 -0400 In-Reply-To: (=?utf-8?B?IkfDtmt0dcSf?= Kayaalp"'s message of "Tue, 01 May 2018 06:30:33 +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: Bastien , emacs-orgmode@gnu.org Hello, G=C3=B6ktu=C4=9F Kayaalp writes: > 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. I think this machinery is not necessary. First add a call to `hack-local-variables-apply' somewhere in `org-src--edit-element'. Then, just use regular file-local variables ,e.g., #+begin_src emacs-lisp (foo) ;; Local Variables: ;; fill-column: 99 ;; End: #+end_src Regards, --=20 Nicolas Goaziou