Hello,

Göktuğ Kayaalp <s...@gkayaalp.com> 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:
>
>     ==== x.org ===
>     # -*- 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,

-- 
Nicolas Goaziou

Reply via email to