emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* feature request: reloading settings in an org file should reload file local variables
@ 2014-01-14 14:03 Eric S Fraga
  2014-01-14 14:49 ` Carsten Dominik
  0 siblings, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2014-01-14 14:03 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I constantly run into an annoying side effect of org's handling of
settings in a document.  When writing a document for export, usually to
LaTeX, I find myself playing around with the document wide
setting variables, e.g. 

   #+options: toc:nil
   #+latex_header: \usepackage{tikz}

and similar.  Org requires me to re-load the document settings by
hitting C-c C-c on any such document setting line.  This is fine.

The problem is that org appears to reset *all* variables to default
(custom?)  settings.  This includes variables that have been set using
file local variables in the given document.  Of particular note is the
variable ~org-export-allow-bind-keywords~.  I normally have this set to
nil for safety reasons but wish to set this to t in some documents.  I
use something like this quite often on documents I *know* are safe:

,----
| # Local Variables:
| # org-confirm-babel-evaluate: nil
| # org-export-allow-bind-keywords: t
| # End:
`----

The problem is that hitting C-c C-c on a settings line clears these
variables.  Having the bind one reset is particularly confusing at
times.  In the end, I have to kill the buffer and re-visit the file to
have things set up properly.

Is it possible to have org reload the whole file when reloading
settings?  Or not reset any variables at all?  Either approach would be
exhibit more consistent behaviour possibly?  Obviously, the position in
the file would have to be remembered should the file be reloaded
automatically.

This is not a major issue but a niggly one...

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.2.5c-451-gf75f3d

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

* Re: feature request: reloading settings in an org file should reload file local variables
  2014-01-14 14:03 feature request: reloading settings in an org file should reload file local variables Eric S Fraga
@ 2014-01-14 14:49 ` Carsten Dominik
  2014-01-14 15:33   ` Nick Dokos
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Carsten Dominik @ 2014-01-14 14:49 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

Hi Eric,

On Jan 14, 2014, at 3:03 PM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:

> Hello,
> 
> I constantly run into an annoying side effect of org's handling of
> settings in a document.  When writing a document for export, usually to
> LaTeX, I find myself playing around with the document wide
> setting variables, e.g. 
> 
>   #+options: toc:nil
>   #+latex_header: \usepackage{tikz}
> 
> and similar.  Org requires me to re-load the document settings by
> hitting C-c C-c on any such document setting line.  This is fine.
> 
> The problem is that org appears to reset *all* variables to default
> (custom?)  settings.  This includes variables that have been set using
> file local variables in the given document.  Of particular note is the
> variable ~org-export-allow-bind-keywords~.  I normally have this set to
> nil for safety reasons but wish to set this to t in some documents.  I
> use something like this quite often on documents I *know* are safe:
> 
> ,----
> | # Local Variables:
> | # org-confirm-babel-evaluate: nil
> | # org-export-allow-bind-keywords: t
> | # End:
> `----
> 
> The problem is that hitting C-c C-c on a settings line clears these
> variables.  Having the bind one reset is particularly confusing at
> times.  In the end, I have to kill the buffer and re-visit the file to
> have things set up properly.
> 
> Is it possible to have org reload the whole file when reloading
> settings?  Or not reset any variables at all?  Either approach would be
> exhibit more consistent behaviour possibly?  Obviously, the position in
> the file would have to be remembered should the file be reloaded
> automatically.
> 
> This is not a major issue but a niggly one...

Could you try the following patch?

- Carsten

diff --git a/lisp/org.el b/lisp/org.el
index 549f1f8..6fca255 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20482,11 +20482,9 @@ This command does many different things, depending on context:
 Also updates the keyword regular expressions."
   (interactive)
   ;; this will set the mode *and* set file local variables.
-  (normal-mode)
-  ;; but it may leave us in some unrelated mode
-  (unless (derived-mode-p "org-mode")
-    (org-mode))
-  (message "Org-mode restarted"))
+  (funcall major-mode)
+  (hack-local-variables)
+  (message "Mode restarted"))

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

* Re: feature request: reloading settings in an org file should reload file local variables
  2014-01-14 14:49 ` Carsten Dominik
@ 2014-01-14 15:33   ` Nick Dokos
  2014-01-14 19:49     ` Carsten Dominik
  2014-01-14 16:12   ` Bastien
  2014-01-14 19:57   ` Eric S Fraga
  2 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2014-01-14 15:33 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> Hi Eric,
>
> On Jan 14, 2014, at 3:03 PM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
>
>> Hello,
>> 
>> I constantly run into an annoying side effect of org's handling of
>> settings in a document.  When writing a document for export, usually to
>> LaTeX, I find myself playing around with the document wide
>> setting variables, e.g. 
>> 
>>   #+options: toc:nil
>>   #+latex_header: \usepackage{tikz}
>> 
>> and similar.  Org requires me to re-load the document settings by
>> hitting C-c C-c on any such document setting line.  This is fine.
>> 
>> The problem is that org appears to reset *all* variables to default
>> (custom?)  settings.  This includes variables that have been set using
>> file local variables in the given document.  Of particular note is the
>> variable ~org-export-allow-bind-keywords~.  I normally have this set to
>> nil for safety reasons but wish to set this to t in some documents.  I
>> use something like this quite often on documents I *know* are safe:
>> 
>> ,----
>> | # Local Variables:
>> | # org-confirm-babel-evaluate: nil
>> | # org-export-allow-bind-keywords: t
>> | # End:
>> `----
>> 
>> The problem is that hitting C-c C-c on a settings line clears these
>> variables.  Having the bind one reset is particularly confusing at
>> times.  In the end, I have to kill the buffer and re-visit the file to
>> have things set up properly.
>> 
>> Is it possible to have org reload the whole file when reloading
>> settings?  Or not reset any variables at all?  Either approach would be
>> exhibit more consistent behaviour possibly?  Obviously, the position in
>> the file would have to be remembered should the file be reloaded
>> automatically.
>> 
>> This is not a major issue but a niggly one...
>
> Could you try the following patch?
>
> - Carsten
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 549f1f8..6fca255 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -20482,11 +20482,9 @@ This command does many different things, depending on context:
>  Also updates the keyword regular expressions."
>    (interactive)
>    ;; this will set the mode *and* set file local variables.
> -  (normal-mode)
> -  ;; but it may leave us in some unrelated mode
> -  (unless (derived-mode-p "org-mode")
> -    (org-mode))
> -  (message "Org-mode restarted"))
> +  (funcall major-mode)
> +  (hack-local-variables)
> +  (message "Mode restarted"))


I thought this was fixed, originally with commit 5ea0228
and after York Zhao found a problem (see the thread at
http://thread.gmane.org/gmane.emacs.orgmode/79187)
with commit 0911edfac881ab17a2cd1670f169ff4bdf1ac486
and two subsequent commits by Achim to fix some problems:

commit e655e664bff9fb6e98478682f03e713f990acba5
commit f2483ec4bbe196ab29ef6312b0d7c1c179a9eafe

Is this another maint vs master issue perhaps?

Nick

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

* Re: feature request: reloading settings in an org file should reload file local variables
  2014-01-14 14:49 ` Carsten Dominik
  2014-01-14 15:33   ` Nick Dokos
@ 2014-01-14 16:12   ` Bastien
  2014-01-14 19:57   ` Eric S Fraga
  2 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2014-01-14 16:12 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> Could you try the following patch?

I just tried this and it does the right thing.

-- 
 Bastien

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

* Re: feature request: reloading settings in an org file should reload file local variables
  2014-01-14 15:33   ` Nick Dokos
@ 2014-01-14 19:49     ` Carsten Dominik
  0 siblings, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2014-01-14 19:49 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode


On 14 Jan 2014, at 16:33, Nick Dokos <ndokos@gmail.com> wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
> 
>> Hi Eric,
>> 
>> On Jan 14, 2014, at 3:03 PM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
>> 
>>> Hello,
>>> 
>>> I constantly run into an annoying side effect of org's handling of
>>> settings in a document.  When writing a document for export, usually to
>>> LaTeX, I find myself playing around with the document wide
>>> setting variables, e.g. 
>>> 
>>>  #+options: toc:nil
>>>  #+latex_header: \usepackage{tikz}
>>> 
>>> and similar.  Org requires me to re-load the document settings by
>>> hitting C-c C-c on any such document setting line.  This is fine.
>>> 
>>> The problem is that org appears to reset *all* variables to default
>>> (custom?)  settings.  This includes variables that have been set using
>>> file local variables in the given document.  Of particular note is the
>>> variable ~org-export-allow-bind-keywords~.  I normally have this set to
>>> nil for safety reasons but wish to set this to t in some documents.  I
>>> use something like this quite often on documents I *know* are safe:
>>> 
>>> ,----
>>> | # Local Variables:
>>> | # org-confirm-babel-evaluate: nil
>>> | # org-export-allow-bind-keywords: t
>>> | # End:
>>> `----
>>> 
>>> The problem is that hitting C-c C-c on a settings line clears these
>>> variables.  Having the bind one reset is particularly confusing at
>>> times.  In the end, I have to kill the buffer and re-visit the file to
>>> have things set up properly.
>>> 
>>> Is it possible to have org reload the whole file when reloading
>>> settings?  Or not reset any variables at all?  Either approach would be
>>> exhibit more consistent behaviour possibly?  Obviously, the position in
>>> the file would have to be remembered should the file be reloaded
>>> automatically.
>>> 
>>> This is not a major issue but a niggly one...
>> 
>> Could you try the following patch?
>> 
>> - Carsten
>> 
>> diff --git a/lisp/org.el b/lisp/org.el
>> index 549f1f8..6fca255 100644
>> --- a/lisp/org.el
>> +++ b/lisp/org.el
>> @@ -20482,11 +20482,9 @@ This command does many different things, depending on context:
>> Also updates the keyword regular expressions."
>>   (interactive)
>>   ;; this will set the mode *and* set file local variables.
>> -  (normal-mode)
>> -  ;; but it may leave us in some unrelated mode
>> -  (unless (derived-mode-p "org-mode")
>> -    (org-mode))
>> -  (message "Org-mode restarted"))
>> +  (funcall major-mode)
>> +  (hack-local-variables)
>> +  (message "Mode restarted"))
> 
> 
> I thought this was fixed, originally with commit 5ea0228
> and after York Zhao found a problem (see the thread at
> http://thread.gmane.org/gmane.emacs.orgmode/79187)
> with commit 0911edfac881ab17a2cd1670f169ff4bdf1ac486
> and two subsequent commits by Achim to fix some problems:
> 
> commit e655e664bff9fb6e98478682f03e713f990acba5
> commit f2483ec4bbe196ab29ef6312b0d7c1c179a9eafe
> 
> Is this another maint vs master issue perhaps?
> 
> Nick
> 
> 


Indeed, there were differences between maint and master.  Now fixed in both.
- Carsten

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

* Re: feature request: reloading settings in an org file should reload file local variables
  2014-01-14 14:49 ` Carsten Dominik
  2014-01-14 15:33   ` Nick Dokos
  2014-01-14 16:12   ` Bastien
@ 2014-01-14 19:57   ` Eric S Fraga
  2 siblings, 0 replies; 6+ messages in thread
From: Eric S Fraga @ 2014-01-14 19:57 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> Hi Eric,

[...]

> Could you try the following patch?
>
> - Carsten

Seems to work just fine!  Thanks.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.2.5d-479-g8694aa

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

end of thread, other threads:[~2014-01-14 19:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-14 14:03 feature request: reloading settings in an org file should reload file local variables Eric S Fraga
2014-01-14 14:49 ` Carsten Dominik
2014-01-14 15:33   ` Nick Dokos
2014-01-14 19:49     ` Carsten Dominik
2014-01-14 16:12   ` Bastien
2014-01-14 19:57   ` Eric S Fraga

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).