emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Refresh buffer properties and local variables
@ 2013-11-20  1:54 Thomas S. Dye
  2013-11-20  3:26 ` Nick Dokos
  2013-11-21  5:37 ` Nick Dokos
  0 siblings, 2 replies; 9+ messages in thread
From: Thomas S. Dye @ 2013-11-20  1:54 UTC (permalink / raw)
  To: Org-mode

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

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Refresh buffer properties and local variables
  2013-11-20  1:54 Refresh buffer properties and local variables Thomas S. Dye
@ 2013-11-20  3:26 ` Nick Dokos
  2013-11-20 18:28   ` Thomas S. Dye
  2013-11-21  5:37 ` Nick Dokos
  1 sibling, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2013-11-20  3:26 UTC (permalink / raw)
  To: emacs-orgmode

tsd@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.
>

Indeed: by the time org-mode is called, the variables have been
forgotten.

> Is this intended? 
>

I doubt it.

> I end up running M-x normal-mode afterwards, which is sometimes
> difficult to remember.
>
Looking at what normal-mode does, I came up with the following hack.
Does it fix things for you?

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org.el b/lisp/org.el
index febee75..caf0348 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5512,7 +5512,8 @@ 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))
+  (hack-local-variables))
 
 ;; Update `customize-package-emacs-version-alist'
 (add-to-list 'customize-package-emacs-version-alist
--8<---------------cut here---------------end--------------->8---

-- 
Nick

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: Refresh buffer properties and local variables
  2013-11-20  3:26 ` Nick Dokos
@ 2013-11-20 18:28   ` Thomas S. Dye
  2013-11-20 18:38     ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas S. Dye @ 2013-11-20 18:28 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Hi Nick,

Nick Dokos <ndokos@gmail.com> writes:

> Looking at what normal-mode does, I came up with the following hack.
> Does it fix things for you?
>
> diff --git a/lisp/org.el b/lisp/org.el
> index febee75..caf0348 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -5512,7 +5512,8 @@ 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))
> +  (hack-local-variables))
>  
>  ;; Update `customize-package-emacs-version-alist'
>  (add-to-list 'customize-package-emacs-version-alist

Yes, it seems to fix things for me.  What an unfortunate function name!

Thanks for your help. Is there something else I can do to get this
change into Org?

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Refresh buffer properties and local variables
  2013-11-20 18:28   ` Thomas S. Dye
@ 2013-11-20 18:38     ` Bastien
  2013-11-20 19:47       ` Nick Dokos
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2013-11-20 18:38 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Nick Dokos, emacs-orgmode

Hi Thomas and Nick,

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

> Thanks for your help. Is there something else I can do to get this
> change into Org?

Nick, feel free to push this fix -- it was indeed not intended.

Thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Refresh buffer properties and local variables
  2013-11-20 18:38     ` Bastien
@ 2013-11-20 19:47       ` Nick Dokos
  0 siblings, 0 replies; 9+ messages in thread
From: Nick Dokos @ 2013-11-20 19:47 UTC (permalink / raw)
  To: emacs-orgmode

I'll prepare a properly formatted patch later on tonight.

Nick

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Refresh buffer properties and local variables
  2013-11-20  1:54 Refresh buffer properties and local variables Thomas S. Dye
  2013-11-20  3:26 ` Nick Dokos
@ 2013-11-21  5:37 ` Nick Dokos
  2013-11-21  7:13   ` Bastien
  1 sibling, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2013-11-21  5:37 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 478 bytes --]

tsd@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch to ensure that file local variables are set properly --]
[-- Type: text/x-diff, Size: 1206 bytes --]

From 5ea02285bacb9592b20c95d4797ca7c2ec68ecac Mon Sep 17 00:00:00 2001
From: Nick Dokos <ndokos@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


[-- Attachment #3: Type: text/plain, Size: 10 bytes --]


-- 
Nick

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: Refresh buffer properties and local variables
  2013-11-21  5:37 ` Nick Dokos
@ 2013-11-21  7:13   ` Bastien
  2013-11-21 13:51     ` Nick Dokos
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2013-11-21  7:13 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Hi Nick,

Nick Dokos <ndokos@gmail.com> writes:

> Patch attached.

Looks good, please push!

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Refresh buffer properties and local variables
  2013-11-21  7:13   ` Bastien
@ 2013-11-21 13:51     ` Nick Dokos
  2013-11-21 17:08       ` Thomas S. Dye
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2013-11-21 13:51 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg@gnu.org> writes:

> Looks good, please push!
>

Pushed to master (I hope...) Let me know if there is a problem.

-- 
Nick

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Refresh buffer properties and local variables
  2013-11-21 13:51     ` Nick Dokos
@ 2013-11-21 17:08       ` Thomas S. Dye
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas S. Dye @ 2013-11-21 17:08 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> Bastien <bzg@gnu.org> writes:
>
>> Looks good, please push!
>>
>
> Pushed to master (I hope...) Let me know if there is a problem.

Thanks Nick. After a pull this morning, my file's local variables aren't
lost when I refresh buffer properties.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-11-21 17:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20  1:54 Refresh buffer properties and local variables Thomas S. Dye
2013-11-20  3:26 ` Nick Dokos
2013-11-20 18:28   ` Thomas S. Dye
2013-11-20 18:38     ` Bastien
2013-11-20 19:47       ` Nick Dokos
2013-11-21  5:37 ` Nick Dokos
2013-11-21  7:13   ` Bastien
2013-11-21 13:51     ` Nick Dokos
2013-11-21 17:08       ` Thomas S. Dye

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).