t...@tsdye.com (Thomas S. Dye) writes:

> Aloha all,
>
> I just discovered that refreshing buffer properties, C-c C-c at the top
> of my Org mode file, resets Local Variables to their default values (I
> think). At any rate, the Local Variables I set at the end of the file
> are changed by refreshing buffer properties.
>
> Is this intended? 
>
> I end up running M-x normal-mode afterwards, which is sometimes
> difficult to remember.
>
> All the best,
> Tom

Patch attached.

>From 5ea02285bacb9592b20c95d4797ca7c2ec68ecac Mon Sep 17 00:00:00 2001
From: Nick Dokos <ndo...@gmail.com>
Date: Thu, 21 Nov 2013 00:30:05 -0500
Subject: [PATCH] Ensure that file local variables are set

* lisp/org.el (org-mode): Call `hack-local-variables'
  at the end of `org-mode' to set file local variables.
  Cribbed from `normal-mode'.

Reported by Tom Dye: C-c C-c on e.g an #+OPTIONS line
would lose file local variable settings.
---
 lisp/org.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index febee75..8539f51 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5512,7 +5512,10 @@ The following commands are available:
      (unless org-inhibit-startup-visibility-stuff
        (org-set-startup-visibility))))
   ;; Try to set org-hide correctly
-  (set-face-foreground 'org-hide (org-find-invisible-foreground)))
+  (set-face-foreground 'org-hide (org-find-invisible-foreground))
+  ;; Make sure that file local variables are set.
+  (report-errors "File local-variables error: %s"
+    (hack-local-variables)))
 
 ;; Update `customize-package-emacs-version-alist'
 (add-to-list 'customize-package-emacs-version-alist
-- 
1.8.3.101.g727a46b

-- 
Nick

Reply via email to