emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Inheriting some local variables from source code block editing b


From: Nicolas Goaziou
Subject: Re: [O] Inheriting some local variables from source code block editing buffers
Date: Tue, 01 May 2018 10:43:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hello,

Göktuğ Kayaalp <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]