Morgan Smith <[email protected]> writes:

> I have come up with a fix attached as 4 patches.
> ..
> Emacs parses the local variables in `hack-local-variables--find-variables'.
> There it ignores the local variables if they are not terminated with "End:", 
> so
> I think we too can ignore them if they aren't properly terminated.
>
> I've implemented a change where we pull out the "Local Variable" block with
> more precision using the "End:".

Makes sense.

> At first I wanted to only save the "Local Variable" block if it was after the
> last headline but I realized that it would still be used by emacs if it was
> within the last 3000 characters of the file so I scratched that idea.
>
> I've also included a patch to ensure that inserting a new headline with
> C-<return> inserts it before the local variables.

This sounds reasonable, but I am concerned about the case when no edit
is done by the body passed to the org-preserve-local-variables macro,
but we may still move the local variables around. That might be surprising.

Also, there is
(unless modified
              (restore-buffer-modified-p nil))

but with the new patch, we may edit the buffer even when MODIFIED is
nil. This may lead to problems.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to