# $Id: edit-bindings.org,v 1.2 2018/05/14 05:23:48 g Exp $ #+title: :edit-bindings and #+ATTR_EDIT test file #+author: Göktuğ Kayaalp We use the variables ~lexical-binding~, ~truncate-lines~ and ~word-wrap~ for this test/demo. We assume the first is ~nil~, the second is set from a file local variable, and for the third we have no assumptions. #+BEGIN_SRC elisp :results verbatim (list lexical-binding truncate-lines word-wrap) #+END_SRC #+RESULTS: : (nil 62 t) Now we set up the default ~:edit-bindings~ property. #+PROPERTY: header-args :edit-bindings '((lexical-binding t)) >From now on, we'll do our observations evaluating the forms in source code blocks via =C-c ' C-M-x=, and evaluating variables via =M-:= in the edit special buffer. In edit-special buffer, when editing, we observe that ~lexical-binding~ is set to ~t~: #+BEGIN_SRC elisp (eq lexical-binding t) #+END_SRC But ~truncate-lines~ is not set: #+BEGIN_SRC elisp (eq truncate-lines 62) #+END_SRC Copy ~truncate-lines~ over from this file's buffer local variables: #+BEGIN_SRC elisp :edit-bindings '(truncate-lines) (list lexical-binding truncate-lines) #+END_SRC We observe that now the buffer-wide value is shadoved, and while truncate lines is passed through, ~lexical-binding~ is not, it's nil. So we pass both through: #+BEGIN_SRC elisp :edit-bindings '((lexical-binding t) truncate-lines) (list (eq truncate-lines 62) (eq lexical-binding t)) #+END_SRC Export blocks can not use header arguments. Thus we use an element property called ~ATTR_EDIT~: #+ATTR_EDIT: ((fill-column 30) truncate-lines) #+BEGIN_EXPORT latex Nullam eu ante vel est convallis dignissim. Fusce suscipit, wisi nec facilisis facilisis, est dui fermentum leo, quis tempor ligula erat quis odio. Nunc porta vulputate tellus. Nunc rutrum turpis sed pede. Sed bibendum. #+END_EXPORT When we observe the value of ~truncate-lines~, we see that it is 62, and when we use ~fill-paragraph~, that it wraps according to the new value of ~fill-column~. We get an error if we supply a bad varlist, but editing continues anyways: #+BEGIN_SRC python :edit-bindings '(("monty" "python")) print(None) #+END_SRC #+ATTR_EDIT: Tea? #+BEGIN_EXPORT latex \textit{nope} #+END_EXPORT # Local Variables: # truncate-lines: 62 # End: