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: Fri, 7 Jun 2013 17:40:53 +0200 Message-ID: References: <87wqq6gj39.fsf@krugs.de> <87y5amdoae.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c24e1293d82304de924111 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukyme-0002hZ-OW for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 11:40:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ukymc-0004hN-Ms for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 11:40:56 -0400 Received: from mail-ve0-x231.google.com ([2607:f8b0:400c:c01::231]:38047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukymc-0004hI-5b for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 11:40:54 -0400 Received: by mail-ve0-f177.google.com with SMTP id cz10so3176623veb.36 for ; Fri, 07 Jun 2013 08:40:53 -0700 (PDT) In-Reply-To: <87y5amdoae.fsf@gmail.com> 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: Vitalie Spinu Cc: Rainer M Krug , "emacs-orgmode@gnu.org" --001a11c24e1293d82304de924111 Content-Type: text/plain; charset=ISO-8859-1 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. > I don't how this could be easily fixed on org side, but you can solve it > straightforwardly with: > > (add-to-list 'auto-mode-alist (cons "NAME\\|DESC" 'R-mode)) Ok - I'check it out on Monday. Cheers and have a nice weekend, Rainer > > Vitalie > > >> Rainer M Krug > > >> on Fri, 07 Jun 2013 15:12:58 +0200 wrote: > > > Hi > > > when tangling the following file > > > ,---- > > | * Package Files > > | ** DESCRIPTION File > > | :PROPERTIES: > > | :tangle: ./DESCRIPTION > > | :shebang: > > | :padline: no > > | :no-expand: TRUE > > | :comments: no > > | :END: > > | #+begin_src R > > | Package: asmDrak > > | #+end_src > > | > > | ** NAMESPACE File > > | :PROPERTIES: > > | :tangle: ./NAMESPACE > > | :shebang: > > | :padline: no > > | :no-expand: TRUE > > | :comments: no > > | :END: > > | #+begin_src R > > | this is a test > > | #+end_src > > | > > | > > | ** DESC2 File > > | :PROPERTIES: > > | :tangle: ./DESC2 > > | :shebang: > > | :padline: no > > | :no-expand: TRUE > > | :comments: yes > > | :END: > > | #+begin_src R > > | this is a test > > | #+end_src > > `---- > > > I get the following tangled files: > > > DESCRIPTION: > > > ,---- > > | Package: asmDrak > > | > > | ;; Local Variables: > > | ;; org-babel-tangled-file: t > > | ;; buffer-read-only: t > > | ;; End: > > `---- > > > which has the wrong comment character (should have #) > > > NAMESPACE: > > > ,---- > > | this is a test > > | > > | ## Local Variables: > > | ## org-babel-tangled-file: t > > | ## buffer-read-only: t > > | ## End: > > `---- > > > which has the correct comment characters, and > > > DESC2 > > > ,---- > > | ## [[file:~/tmp/tangle.org::*DESC2%20File][DESC2\ File:1]] > > | this is a test > > | ## DESC2\ File:1 ends here > > | > > | ;; Local Variables: > > | ;; org-babel-tangled-file: t > > | ;; buffer-read-only: t > > | ;; End: > > `---- > > > which has the correct comment characters for the comments, but the wrong > > ones for the file local variables. > > > I use the following in my .emacs file to set the post-tangle-hook to add > > the local file variables: > > > ,---- > > | (defvar org-babel-tangled-file nil > > | "If non-nill, current file was tangled with org-babel-tangle") > > | (put 'org-babel-tangled-file 'safe-local-variable 'booleanp) > > | > > | (defun org-babel-mark-file-as-tangled () > > | (add-file-local-variable 'org-babel-tangled-file t) > > | (add-file-local-variable 'buffer-read-only t) > > | ;; (add-file-local-variable 'eval: (auto-revert-mode)) > > | (basic-save-buffer)) > > | > > | (add-hook 'org-babel-post-tangle-hook > 'org-babel-mark-file-as-tangled) > > `---- > > > I assume this is a bug somewhere? > > > Org-mode version 8.0.3 (release_8.0.3-211-gf16b53 @ > > /home/rkrug/.emacs.d/org-mode/lisp/) > > > GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 3.6.4) > > of 2013-04-14 on actinium, modified by Debian > > > Cheers, > > > Rainer > -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax (F): +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug --001a11c24e1293d82304de924111 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

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.
=A0=
I don't how this could be easily fixed on org side, but you can solve i= t
straightforwardly with:

=A0 =A0(add-to-list 'auto-mode-alist (cons "NAME\\|DESC" '= ;R-mode))

Ok - I'check it out on Monday= .

Cheers and have a nice weekend,

Rainer=A0

=A0Vitalie

=A0>> Rainer M Krug <Rainer@krugs.de>
=A0>> on Fri, 07 Jun 2013 15:12:58 +0200 wrote:

=A0> Hi

=A0> when tangling the following file

=A0> ,----
=A0> | * Package Files
=A0> | ** DESCRIPTION File
=A0> | :PROPERTIES:
=A0> | :tangle: =A0 ./DESCRIPTION
=A0> | :shebang:
=A0> | :padline: no
=A0> | :no-expand: TRUE
=A0> | :comments: no
=A0> | :END:
=A0> | #+begin_src R
=A0> | =A0 Package: asmDrak
=A0> | #+end_src
=A0> |
=A0> | ** NAMESPACE File
=A0> | :PROPERTIES:
=A0> | :tangle: =A0 ./NAMESPACE
=A0> | :shebang:
=A0> | :padline: no
=A0> | :no-expand: TRUE
=A0> | :comments: no
=A0> | :END:
=A0> | #+begin_src R
=A0> | =A0this is a test
=A0> | #+end_src
=A0> |
=A0> |
=A0> | ** DESC2 File
=A0> | :PROPERTIES:
=A0> | :tangle: =A0 ./DESC2
=A0> | :shebang:
=A0> | :padline: no
=A0> | :no-expand: TRUE
=A0> | :comments: yes
=A0> | :END:
=A0> | #+begin_src R
=A0> | =A0 this is a test
=A0> | #+end_src
=A0> `----

=A0> I get the following tangled files:

=A0> DESCRIPTION:

=A0> ,----
=A0> | Package: asmDrak
=A0> |
=A0> | ;; Local Variables:
=A0> | ;; org-babel-tangled-file: t
=A0> | ;; buffer-read-only: t
=A0> | ;; End:
=A0> `----

=A0> which has the wrong comment character (should have #)

=A0> NAMESPACE:

=A0> ,----
=A0> | this is a test
=A0> |
=A0> | ## Local Variables:
=A0> | ## org-babel-tangled-file: t
=A0> | ## buffer-read-only: t
=A0> | ## End:
=A0> `----

=A0> which has the correct comment characters, and

=A0> DESC2

=A0> ,----
=A0> | ## [[file:~/tmp/tangle.org::*DESC2%20File][DESC2\ File:1]]
=A0> | this is a test
=A0> | ## DESC2\ File:1 ends here
=A0> |
=A0> | ;; Local Variables:
=A0> | ;; org-babel-tangled-file: t
=A0> | ;; buffer-read-only: t
=A0> | ;; End:
=A0> `----

=A0> which has the correct comment characters for the comments, but the = wrong
=A0> ones for the file local variables.

=A0> I use the following in my .emacs file to set the post-tangle-hook t= o add
=A0> the local file variables:

=A0> ,----
=A0> | =A0 (defvar org-babel-tangled-file nil
=A0> | =A0 =A0 "If non-nill, current file was tangled with org-babe= l-tangle")
=A0> | =A0 (put 'org-babel-tangled-file 'safe-local-variable = 9;booleanp)
=A0> |
=A0> | =A0 (defun org-babel-mark-file-as-tangled ()
=A0> | =A0 =A0 (add-file-local-variable 'org-babel-tangled-file t) =A0> | =A0 =A0 (add-file-local-variable 'buffer-read-only t)
=A0> | =A0 =A0 ;; (add-file-local-variable 'eval: (auto-revert-mode)= )
=A0> | =A0 =A0 (basic-save-buffer))
=A0> |
=A0> | =A0 (add-hook 'org-babel-post-tangle-hook 'org-babel-mark= -file-as-tangled)
=A0> `----

=A0> I assume this is a bug somewhere?

=A0> Org-mode version 8.0.3 (release_8.0.3-211-gf16b53 @
=A0> /home/rkrug/.emacs.d/org-mode/lisp/)

=A0> GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 3.6.4)
=A0> =A0of 2013-04-14 on actinium, modified by Debian

=A0> Cheers,

=A0> Rainer


--
Rainer M. Krug, PhD (Conservation Ecology, SUN)= , MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of E= xcellence for Invasion Biology
Stellenbosch University
South Africa
Tel : =A0 =A0 =A0 +33 - (0)9 53 10 27 44
Cell: =A0 =A0 =A0 +33 - (0)= 6 85 62 59 98
Fax (F): =A0 =A0 =A0 +33 - (0)9 58 10 27 44

Fax (D)= : =A0 =A0+49 - (0)3 21 21 25 22 44

email: =A0 =A0 =A0Rainer@krugs.de

Skype: =A0 =A0 =A0RMkrug

--001a11c24e1293d82304de924111--