From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: Wrong comment character when adding file local variables? Date: Mon, 10 Jun 2013 16:55:30 +0200 Message-ID: <87li6if21p.fsf@krugs.de> References: <87wqq6gj39.fsf@krugs.de> <87y5amdoae.fsf@gmail.com> <87ppvxeujx.fsf@gmail.com> <87wqq2z7za.fsf@krugs.de> <878v2iksr2.fsf@pierrot.dokosmarshall.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um3Vh-0006SX-MM for emacs-orgmode@gnu.org; Mon, 10 Jun 2013 10:55:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Um3Vc-0002Xm-Q1 for emacs-orgmode@gnu.org; Mon, 10 Jun 2013 10:55:53 -0400 Received: from plane.gmane.org ([80.91.229.3]:43602) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um3Vc-0002Xc-AO for emacs-orgmode@gnu.org; Mon, 10 Jun 2013 10:55:48 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Um3Va-00026P-AF for emacs-orgmode@gnu.org; Mon, 10 Jun 2013 16:55:46 +0200 Received: from arn78-1-88-186-171-7.fbx.proxad.net ([88.186.171.7]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 10 Jun 2013 16:55:46 +0200 Received: from Rainer by arn78-1-88-186-171-7.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 10 Jun 2013 16:55:46 +0200 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 --=-=-= Content-Type: text/plain Nick Dokos writes: > Rainer M Krug writes: > >> Vitalie Spinu writes: >> >>> >> Rainer M Krug >>> >> 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: RMKruggmailcom --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJRtejiAAoJENvXNx4PUvmCQ0MH/22aTr9UeEc1UcQQBGT/UcYC Puaab3LLbGO+e7rY00ZJBvNaun3yTN3ZQEhoS0PhTfd7cFN0z6dsQ/HTVIY3TA0d DWBj0qUH6fgu3T2K8avE1EO47MJwvSrQ0JnSsmaTcVj4NqNxv77DAbYwZgvq3Ysc Hckj/6eF8rqhZH2/Wj8lxv6Jw8JNtMctcFdXgk18dqBfNhgCExPVIr6CGr2ag8ej zJ/JnXuABUor7z41F+rkCcvzchwaGB0WzYo50TkChiNd6dK7Pd2GnQfyRNsCowDb kpbQkuYflZMV/UPAxwi+t7RNP0Mes3N61O9/UMkr/FycDQ/lZYDcELD5NSgHIQI= =YyCg -----END PGP SIGNATURE----- --=-=-=--