* LaTeX chunk makes .org file not in Org mode
@ 2018-11-14 11:54 Alain.Cochard
2018-11-16 9:27 ` Eric S Fraga
0 siblings, 1 reply; 4+ messages in thread
From: Alain.Cochard @ 2018-11-14 11:54 UTC (permalink / raw)
To: emacs-orgmode
Hello. I guess this is normal, but I wanted to report it in case
there is room for improvement:
After inserting a latex file into an .org file, I ended up with the
following part in the org file (which was an agenda file):
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
Editing this file as an org file (in Org mode), as well as agenda
operations, worked well for weeks until I had to restart emacs. It
was then not instantaneous to me to find out why, suddenly, 'C-c a a'
failed, whereas I had not changed anything... (with message: "Agenda
file xxx.org is not in Org mode")
It the issue could somehow be made apparent to the user right away
(that is, when the chunk is inserted), it would be easier/faster to
fix.
Regards
--
EOST (École et Observatoire des Sciences de la Terre)
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes [bureau 106] | Phone: +33 (0)3 68 85 50 44
F-67084 Strasbourg Cedex, France | Fax: +33 (0)3 68 85 01 25
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: LaTeX chunk makes .org file not in Org mode
2018-11-14 11:54 LaTeX chunk makes .org file not in Org mode Alain.Cochard
@ 2018-11-16 9:27 ` Eric S Fraga
2018-11-16 12:28 ` Alain.Cochard
0 siblings, 1 reply; 4+ messages in thread
From: Eric S Fraga @ 2018-11-16 9:27 UTC (permalink / raw)
To: Alain.Cochard; +Cc: emacs-orgmode
On Wednesday, 14 Nov 2018 at 12:54, Alain.Cochard@unistra.fr wrote:
> Hello. I guess this is normal, but I wanted to report it in case
> there is room for improvement:
>
> After inserting a latex file into an .org file, I ended up with the
> following part in the org file (which was an agenda file):
>
> %%% Local Variables:
> %%% mode: latex
> %%% TeX-master: t
> %%% End:
[...]
> It the issue could somehow be made apparent to the user right away
> (that is, when the chunk is inserted), it would be easier/faster to
> fix.
There's really nothing to fix. You've inserted some local variable
settings that take effect next time you visit the file. You've decided
(not on purpose, I realize) that you want this file to be opened in
LaTeX mode and Emacs does what you said. I cannot imagine a fix that
could catch this as it would require org to essentially parse the new
contents as if it were all of Emacs and then somehow figure out what had
been set that shouldn't have been set.
--
Eric S Fraga via Emacs 27.0.50, Org release_9.1.13-894-gf79545
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: LaTeX chunk makes .org file not in Org mode
2018-11-16 9:27 ` Eric S Fraga
@ 2018-11-16 12:28 ` Alain.Cochard
2018-11-16 16:32 ` Eric S Fraga
0 siblings, 1 reply; 4+ messages in thread
From: Alain.Cochard @ 2018-11-16 12:28 UTC (permalink / raw)
To: Eric S Fraga; +Cc: emacs-orgmode
Eric S Fraga writes on Fri 16 Nov 2018 09:27:
> On Wednesday, 14 Nov 2018 at 12:54, Alain.Cochard@unistra.fr wrote:
> > Hello. I guess this is normal, but I wanted to report it in case
> > there is room for improvement:
> >
> > After inserting a latex file into an .org file, I ended up with the
> > following part in the org file (which was an agenda file):
> >
> > %%% Local Variables:
> > %%% mode: latex
> > %%% TeX-master: t
> > %%% End:
>
> [...]
>
> > It the issue could somehow be made apparent to the user right away
> > (that is, when the chunk is inserted), it would be easier/faster to
> > fix.
>
> There's really nothing to fix. You've inserted some local variable
> settings that take effect next time you visit the file. You've decided
> (not on purpose, I realize) that you want this file to be opened in
> LaTeX mode and Emacs does what you said. I cannot imagine a fix that
> could catch this as it would require org to essentially parse the new
> contents as if it were all of Emacs and then somehow figure out what had
> been set that shouldn't have been set.
Hi Eric, and thanks a lot for the feedback.
By 'fix', I of course meant 'fix my own mistake'...
I forgive myself here, though, because I have been using LaTeX for
many years without having to pay any attention to this kind of chunks,
which are (for me) inserted automatically.
But it is certainly not obvious to me why the content of this chunk
takes precedence over the file extension -- after all, the manual
says: "Files with the ‘.org’ extension use Org mode by default."
I can certainly understand if the content cannot be examined after
each insertion, but, as there are many things in Org which are done on
the fly, I felt compelled to ask.
(One could also imagine that Org would detect upon loading the file
that there is a conflict between the modes -- but I also understand
if this is not something reasonable to ask.)
Regards,
a.
--
EOST (École et Observatoire des Sciences de la Terre)
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes [bureau 106] | Phone: +33 (0)3 68 85 50 44
F-67084 Strasbourg Cedex, France | Fax: +33 (0)3 68 85 01 25
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: LaTeX chunk makes .org file not in Org mode
2018-11-16 12:28 ` Alain.Cochard
@ 2018-11-16 16:32 ` Eric S Fraga
0 siblings, 0 replies; 4+ messages in thread
From: Eric S Fraga @ 2018-11-16 16:32 UTC (permalink / raw)
To: Alain.Cochard; +Cc: emacs-orgmode
On Friday, 16 Nov 2018 at 13:28, Alain.Cochard@unistra.fr wrote:
> > > %%% Local Variables:
> > > %%% mode: latex
> > > %%% TeX-master: t
> > > %%% End:
> But it is certainly not obvious to me why the content of this chunk
> takes precedence over the file extension -- after all, the manual
> says: "Files with the ‘.org’ extension use Org mode by default."
Because local variables are set after the initial loading of the
file. When the file is opened, the mode is initially determined by the
autoload settings but then local variables allow you to change this as
file extensions may not always reflect what you want.
--
Eric S Fraga via Emacs 27.0.50, Org release_9.1.13-894-gf79545
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-16 16:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-14 11:54 LaTeX chunk makes .org file not in Org mode Alain.Cochard
2018-11-16 9:27 ` Eric S Fraga
2018-11-16 12:28 ` Alain.Cochard
2018-11-16 16:32 ` 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).