emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Wrong comment character when adding file local variables?


From: Nick Dokos
Subject: Re: [O] Wrong comment character when adding file local variables?
Date: Mon, 10 Jun 2013 09:19:45 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Rainer M Krug <address@hidden> writes:

> Vitalie Spinu <address@hidden> writes:
>
>>  >> Rainer M Krug <address@hidden>
>>  >> on Fri, 7 Jun 2013 17:40:53 +0200 wrote:
>>
>>  > On Friday, June 7, 2013, Vitalie Spinu wrote:
>>  >     All your examples are placed in fundamental mode. The comments are
>>  >     treated by org and thus are correct, local variables are inserted
>>  >     according to the major mode.
>>
>>  > The question is why - all .R files are automatically in r mode when I 
>> open them
>>  > and all other R files tangle fine.
>>
>> Because they are placed automatically in R mode, your files are in
>> fundamental mode.
>
> I think I get it now: my files are interpreted by emacs as fundamental
> files. But when I visit them in a buffer, the buffer is interpreted as
> an R buffer.
>

Almost. Files are *opened* in some mode: if no other mode is
found, they are opened in fundamental mode - by themselves, they are not
"fundamental files" or "R-mode files" or ... That's an interpretation
that emacs superimposes on them when it visits them. To do that, it uses
information in auto-mode-alist, or in any mode specification in the file
itself (using file-local variables embedded in comments).

So when you open a file "foo", it will be opened in fundamental mode
(absent some other specification in the auto-mode-alist). When you add
contents, the mode does not change. If you save it as file "foo" and
then reopen it, it will still be in fundamental mode.  But if you save
it as "foo.org" and then reopen it, the auto-mode-alist will tell emacs
to change the mode to org-mode (assuming that the .org suffix has been
set up correctly in the auto-mode-alist).  It does not matter what the
contents were: it could be a C program e.g.  and it would still be
opened in org mode.

-- 
Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]