Max Nikulin <maniku...@gmail.com> writes: > On 18/12/2024 11:13, Joseph Turner wrote: >> Is there a way to make Emacs ignore Local Variables lists which >> appear >> inside of source blocks? >> For example, is there a way to include the following content in an >> Org >> file without Emacs attempting to locally set foo to bar? >> #+BEGIN_EXAMPLE >> # Local Variables: >> # foo: 'bar >> # End: >> #+END_EXAMPLE > > Have you tried to create a comment block below? > > #+begin_comment > Deactivate local variables above in the example block: > Local Variables: > End: > #+end_comment
In my testing, in order to make Emacs ignore the `foo: bar' binding, the empty Local Variables list actually needs to go first. > If it is not enough (and breaking the example into 2 parts is not > acceptable) then ask Emacs developers. I do not think, Org should (and > has a chance) to deal with this feature Yes, I agree that Org should not deal with this feature. Splitting the example into two parts results in "File mode specification error: (user-error Local variables entry is missing the prefix) " upon opening the file. You can test with this: --8<---------------cut here---------------start------------->8--- #+BEGIN_SRC org # Local Variables: #+END_SRC #+BEGIN_SRC org # org-srs-review-new-items-per-day: 30 # org-srs-review-max-reviews-per-day: 100 # End: #+END_SRC --8<---------------cut here---------------end--------------->8--- > (info "(emacs) Specifying File Variables") By the way, is there a built-in command to copy that (info ...) sexp when viewing that info page? > <https://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html> Thanks, I just re-read that page more carefully, and I see this: If some unrelated text might look to Emacs as a local variables list, you can countermand that by inserting a form-feed character (a page delimiter, *note Pages::) after that text. Emacs only looks for file-local variables in the last page of a file, after the last page delimiter. In the org-srs README.org, I think we can just throw a at the bottom of the file (or before a Local Variables list which we do want to use). Problem solved! Thank you, Max! Joseph