From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: unfortunate "feature interaction" of org-export and emacs-latex-auctex mode Date: Mon, 09 Nov 2015 15:49:24 -0500 Message-ID: <871tbyhp9n.fsf@alphaville.usersys.redhat.com> References: <87egfz7x1m.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvtNk-0007Es-CC for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 15:49:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZvtNh-00067L-4W for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 15:49:40 -0500 Received: from plane.gmane.org ([80.91.229.3]:39405) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvtNg-00067G-Ts for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 15:49:37 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZvtNd-0000qP-QA for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 21:49:33 +0100 Received: from nat-pool-bos-t.redhat.com ([66.187.233.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 09 Nov 2015 21:49:33 +0100 Received: from ndokos by nat-pool-bos-t.redhat.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 09 Nov 2015 21:49:33 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Marcin Borkowski writes: > On 2015-11-09, at 19:54, Martin Steffen 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. #+END_COMMENT --8<---------------cut here---------------end--------------->8--- -- Nick