* unfortunate "feature interaction" of org-export and emacs-latex-auctex mode
@ 2015-11-09 18:54 Martin Steffen
2015-11-09 20:11 ` Marcin Borkowski
2015-11-09 20:38 ` Rasmus
0 siblings, 2 replies; 6+ messages in thread
From: Martin Steffen @ 2015-11-09 18:54 UTC (permalink / raw)
To: emacs-orgmode
Hi,
Perhaps it's not really a "fault" of org (nor of auctex), but both
things interact unfortunate.
The reason is: when I export org to LaTeX, and I visit the latex file
afterwards, I want that auctex/emacs is instructed about some facts. Thus I
like to have some lines such as
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
at the end of the latex file. Org allows that, in that I add the
"LATEX-only" export at the end of the org-file
#+BEGIN_LATEX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
#+END_LATEX
Doing that produces the desired lines at the end of the generated latex, and
if I visit the latex file, emacs/auctex is instructed according to my wishes.
Now the problem: If I refresh the /org/ file, emacs/org thinks that actually
the file is a latex file (due to the line "mode: latex") and switches from
org-mode to latex-mode.
It's a minor thing, obviously, but I just wonder if there's an easy workaround.
Martin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: unfortunate "feature interaction" of org-export and emacs-latex-auctex mode
2015-11-09 18:54 unfortunate "feature interaction" of org-export and emacs-latex-auctex mode Martin Steffen
@ 2015-11-09 20:11 ` Marcin Borkowski
2015-11-09 20:49 ` Nick Dokos
2015-11-10 6:51 ` Martin Steffen
2015-11-09 20:38 ` Rasmus
1 sibling, 2 replies; 6+ messages in thread
From: Marcin Borkowski @ 2015-11-09 20:11 UTC (permalink / raw)
To: Martin Steffen; +Cc: emacs-orgmode
On 2015-11-09, at 19:54, Martin Steffen <msteffen@ifi.uio.no> wrote:
> Hi,
>
> Perhaps it's not really a "fault" of org (nor of auctex), but both
> things interact unfortunate.
>
> The reason is: when I export org to LaTeX, and I visit the latex file
> afterwards, I want that auctex/emacs is instructed about some facts. Thus I
> like to have some lines such as
>
> %%% Local Variables:
> %%% mode: latex
> %%% TeX-master: t
> %%% End:
>
> at the end of the latex file. Org allows that, in that I add the
> "LATEX-only" export at the end of the org-file
>
> #+BEGIN_LATEX
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%% Local Variables:
> %%% mode: latex
> %%% TeX-master: t
> %%% End:
> #+END_LATEX
>
>
> Doing that produces the desired lines at the end of the generated latex, and
> if I visit the latex file, emacs/auctex is instructed according to my wishes.
>
>
> Now the problem: If I refresh the /org/ file, emacs/org thinks that actually
> the file is a latex file (due to the line "mode: latex") and switches from
> org-mode to latex-mode.
>
>
> It's a minor thing, obviously, but I just wonder if there's an easy workaround.
Note: this is a terrible hack, so use it your own risk, only if there's
no sane alternative etc.
--8<---------------cut here---------------start------------->8---
#+BEGIN_COMMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Local Variables:
%%% mode: org
%%% End:
#+END_COMMENT
#+BEGIN_LATEX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
#+END_LATEX
--8<---------------cut here---------------end--------------->8---
> Martin
Hth,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: unfortunate "feature interaction" of org-export and emacs-latex-auctex mode
2015-11-09 18:54 unfortunate "feature interaction" of org-export and emacs-latex-auctex mode Martin Steffen
2015-11-09 20:11 ` Marcin Borkowski
@ 2015-11-09 20:38 ` Rasmus
1 sibling, 0 replies; 6+ messages in thread
From: Rasmus @ 2015-11-09 20:38 UTC (permalink / raw)
To: emacs-orgmode
Martin Steffen <msteffen@ifi.uio.no> writes:
> Hi,
>
> Perhaps it's not really a "fault" of org (nor of auctex), but both
> things interact unfortunate.
>
> The reason is: when I export org to LaTeX, and I visit the latex file
> afterwards, I want that auctex/emacs is instructed about some facts. Thus I
> like to have some lines such as
>
> %%% Local Variables:
> %%% mode: latex
> %%% TeX-master: t
> %%% End:
>
> at the end of the latex file. Org allows that, in that I add the
> "LATEX-only" export at the end of the org-file
If it's only about setting the mode, you could use
org-latex-compiler-file-string (in the git version), and set tex-master in
a latex block...
Rasmus
--
Lasciate ogni speranza, voi che leggete questo.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: unfortunate "feature interaction" of org-export and emacs-latex-auctex mode
2015-11-09 20:11 ` Marcin Borkowski
@ 2015-11-09 20:49 ` Nick Dokos
2015-11-09 21:08 ` Marcin Borkowski
2015-11-10 6:51 ` Martin Steffen
1 sibling, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2015-11-09 20:49 UTC (permalink / raw)
To: emacs-orgmode
Marcin Borkowski <mbork@mbork.pl> writes:
> On 2015-11-09, at 19:54, Martin Steffen <msteffen@ifi.uio.no> wrote:
>
>> Hi,
>>
>> Perhaps it's not really a "fault" of org (nor of auctex), but both
>> things interact unfortunate.
>>
>> The reason is: when I export org to LaTeX, and I visit the latex file
>> afterwards, I want that auctex/emacs is instructed about some facts. Thus I
>> like to have some lines such as
>>
>> %%% Local Variables:
>> %%% mode: latex
>> %%% TeX-master: t
>> %%% End:
>>
>> at the end of the latex file. Org allows that, in that I add the
>> "LATEX-only" export at the end of the org-file
>>
>> #+BEGIN_LATEX
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> %%% Local Variables:
>> %%% mode: latex
>> %%% TeX-master: t
>> %%% End:
>> #+END_LATEX
>>
>>
>> Doing that produces the desired lines at the end of the generated latex, and
>> if I visit the latex file, emacs/auctex is instructed according to my wishes.
>>
>>
>> Now the problem: If I refresh the /org/ file, emacs/org thinks that actually
>> the file is a latex file (due to the line "mode: latex") and switches from
>> org-mode to latex-mode.
>>
>>
>> It's a minor thing, obviously, but I just wonder if there's an easy workaround.
>
> Note: this is a terrible hack, so use it your own risk, only if there's
> no sane alternative etc.
>
> #+BEGIN_COMMENT
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%% Local Variables:
> %%% mode: org
> %%% End:
> #+END_COMMENT
> #+BEGIN_LATEX
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%% Local Variables:
> %%% mode: latex
> %%% TeX-master: t
> %%% End:
> #+END_LATEX
>
Is there some rule about what happens when emacs sees two local variable
blocks in a file? It seems that the first one is enforced and the second
ignored: the above works in the given order of the two blocks, but not
if the order is reversed.
In any case, another solution along the same lines is as follows:
local variables are only recognized in the last "page" of the file so
just add a Control-L at the end of the org file:
--8<---------------cut here---------------start------------->8---
...
#+BEGIN_COMMENT
Insert a control-L here to prevent emacs from interpreting the local
variables block above - local variables blocks are recognized only on
the last "page" of the file.
\f
#+END_COMMENT
--8<---------------cut here---------------end--------------->8---
--
Nick
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: unfortunate "feature interaction" of org-export and emacs-latex-auctex mode
2015-11-09 20:49 ` Nick Dokos
@ 2015-11-09 21:08 ` Marcin Borkowski
0 siblings, 0 replies; 6+ messages in thread
From: Marcin Borkowski @ 2015-11-09 21:08 UTC (permalink / raw)
To: Nick Dokos; +Cc: emacs-orgmode
On 2015-11-09, at 21:49, Nick Dokos <ndokos@gmail.com> wrote:
> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> On 2015-11-09, at 19:54, Martin Steffen <msteffen@ifi.uio.no> wrote:
>>
>>> Hi,
>>>
>>> Perhaps it's not really a "fault" of org (nor of auctex), but both
>>> things interact unfortunate.
>>>
>>> The reason is: when I export org to LaTeX, and I visit the latex file
>>> afterwards, I want that auctex/emacs is instructed about some facts. Thus I
>>> like to have some lines such as
>>>
>>> %%% Local Variables:
>>> %%% mode: latex
>>> %%% TeX-master: t
>>> %%% End:
>>>
>>> at the end of the latex file. Org allows that, in that I add the
>>> "LATEX-only" export at the end of the org-file
>>>
>>> #+BEGIN_LATEX
>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>> %%% Local Variables:
>>> %%% mode: latex
>>> %%% TeX-master: t
>>> %%% End:
>>> #+END_LATEX
>>>
>>>
>>> Doing that produces the desired lines at the end of the generated latex, and
>>> if I visit the latex file, emacs/auctex is instructed according to my wishes.
>>>
>>>
>>> Now the problem: If I refresh the /org/ file, emacs/org thinks that actually
>>> the file is a latex file (due to the line "mode: latex") and switches from
>>> org-mode to latex-mode.
>>>
>>>
>>> It's a minor thing, obviously, but I just wonder if there's an easy workaround.
>>
>> Note: this is a terrible hack, so use it your own risk, only if there's
>> no sane alternative etc.
>>
>> #+BEGIN_COMMENT
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> %%% Local Variables:
>> %%% mode: org
>> %%% End:
>> #+END_COMMENT
>> #+BEGIN_LATEX
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> %%% Local Variables:
>> %%% mode: latex
>> %%% TeX-master: t
>> %%% End:
>> #+END_LATEX
>>
>
> Is there some rule about what happens when emacs sees two local variable
> blocks in a file? It seems that the first one is enforced and the second
> ignored: the above works in the given order of the two blocks, but not
> if the order is reversed.
I guess this is just implementation detail: the last 3000 characters of
the last page are scanned, and if a file local variables list is found,
it is applied, no matter what happens /after/ it.
> In any case, another solution along the same lines is as follows:
> local variables are only recognized in the last "page" of the file so
> just add a Control-L at the end of the org file:
>
> --8<---------------cut here---------------start------------->8---
> ...
> #+BEGIN_COMMENT
> Insert a control-L here to prevent emacs from interpreting the local
> variables block above - local variables blocks are recognized only on
> the last "page" of the file.
> \f
> #+END_COMMENT
> --8<---------------cut here---------------end--------------->8---
Still not pretty, but /much/ better than mine!
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: unfortunate "feature interaction" of org-export and emacs-latex-auctex mode
2015-11-09 20:11 ` Marcin Borkowski
2015-11-09 20:49 ` Nick Dokos
@ 2015-11-10 6:51 ` Martin Steffen
1 sibling, 0 replies; 6+ messages in thread
From: Martin Steffen @ 2015-11-10 6:51 UTC (permalink / raw)
To: Marcin Borkowski; +Cc: emacs-orgmode
>>>>> "Marcin" == Marcin Borkowski <mbork@mbork.pl> writes:
Marcin> Note: this is a terrible hack, so use it your own risk, only
Marcin> if there's no sane alternative etc.
Works for me, thanks (and for the suggestions of the others in the
thread. Martin
Marcin> #+BEGIN_COMMENT
Marcin> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Marcin> %%% Local Variables: %%% mode: org %%% End:
Marcin> #+END_COMMENT #+BEGIN_LATEX
Marcin> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Marcin> %%% Local Variables: %%% mode: latex %%% TeX-master: t %%%
Marcin> End: #+END_LATEX
>> Martin
Marcin> Hth,
Marcin> -- Marcin Borkowski
Marcin> http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of
Marcin> Mathematics and Computer Science Adam Mickiewicz University
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-11-10 6:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-09 18:54 unfortunate "feature interaction" of org-export and emacs-latex-auctex mode Martin Steffen
2015-11-09 20:11 ` Marcin Borkowski
2015-11-09 20:49 ` Nick Dokos
2015-11-09 21:08 ` Marcin Borkowski
2015-11-10 6:51 ` Martin Steffen
2015-11-09 20:38 ` Rasmus
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).