From: Rainer M Krug <Rainer@krugs.de>
To: emacs-orgmode@gnu.org
Subject: Re: Wrong comment character when adding file local variables?
Date: Mon, 10 Jun 2013 16:55:30 +0200 [thread overview]
Message-ID: <87li6if21p.fsf@krugs.de> (raw)
In-Reply-To: 878v2iksr2.fsf@pierrot.dokosmarshall.org
[-- Attachment #1: Type: text/plain, Size: 2630 bytes --]
Nick Dokos <ndokos@gmail.com> writes:
> Rainer M Krug <Rainer@krugs.de> writes:
>
>> Vitalie Spinu <spinuvit@gmail.com> writes:
>>
>>> >> Rainer M Krug <r.m.krug@gmail.com>
>>> >> 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.
Thanks for this very clear description of how this happened. I think I
understand what is going here.
And now I see why the block NAMESPACE file uses the R comment character,
while the others don't: NAMESPACE is in the auto-mode-alist defined as
an R file.
Adding DESCRIPTION as an R file would not be useful, as it is not an R
file - it follows the Debian Control File rules. I dont think there is a
mode for these?
But wouldn't this mechanism be an argument for a header argument to
enable adding of the mode of the file as tangled?
Always adding a local variable to the tangled file might cause problems
with certain formats which do not support comments.
Cheers,
Rainer
-- Rainer M. Krug
email: RMKrug<at>gmail<dot>com
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
next prev parent reply other threads:[~2013-06-10 14:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-07 13:12 Wrong comment character when adding file local variables? Rainer M Krug
2013-06-07 13:48 ` Vitalie Spinu
2013-06-07 15:40 ` Rainer M Krug
2013-06-07 16:48 ` Vitalie Spinu
2013-06-10 8:27 ` Rainer M Krug
2013-06-10 13:19 ` Nick Dokos
2013-06-10 14:55 ` Rainer M Krug [this message]
2013-06-08 7:47 ` Nick Dokos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87li6if21p.fsf@krugs.de \
--to=rainer@krugs.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).