[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] Problem in tangle-mode -- WAS: Automatically adding local variables
From: |
Rainer M Krug |
Subject: |
[O] Problem in tangle-mode -- WAS: Automatically adding local variables to tangled file |
Date: |
Mon, 10 Jun 2013 12:12:25 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Rainer M Krug <address@hidden> writes:
> Eric Schulte <address@hidden> writes:
>
>>>>
>>>> We already set the permission of tangled files to be executable when
>>>> they include a shebang line. Perhaps we could add an option (or change
>>>> the default) to set the permissions of tangled files to be read only.
>>>>
>>>> Perhaps this could be done using the post-tangle hook with something
>>>> like the following.
>>>>
>>>> ;; -*- emacs-lisp -*-
>>>> (defun org-babel-mark-tangled-as-read-only ()
>>>> "Mark the current file read only.
>>>> If it is executable keep it executable."
>>>> (if (= #o755 (file-modes (buffer-file-name)))
>>>> (set-file-modes (buffer-file-name) #o555)
>>>> (set-file-modes (buffer-file-name) #o444)))
>>>>
>>>> (add-hook 'org-babel-post-tangle-hook
>>>> 'org-babel-mark-tangled-as-read-only)
>>>>
>>>
>>> I think that would be a good idea to add this in a way so that it is
>>> controled by a variable
>>
>> I've added a :tangle-mode header argument which may be used to control
>> the permissions of tangled files. See the manual for instructions on
>> it's usage.
>
>
> Thanks a lot. I will try it out today or tomorrow.
I did, and there is a problem with tangling multiple blocks into a
single file:
The following does not work:
,----
| #+PROPERTY: tangle-mode (identity #o444)
| #+PROPERTY: tangle ./tools.R
| * Two blocks
| Block 1
| #+begin_src R
| suitName <- function(species)
| {
| return( paste(species$layer, "suitability", sep="_") )
| }
| #+end_src
|
| Block 2
| #+begin_src R
| statDistName <- function(species){
| return( paste(species$layer, "disturbances_static", sep="_") )
| }
| #+end_src
`----
It seems that the second block can not be written, as the file is
already set to read-only.
For the moment, I exclude this setting again but will try it out as son
as it is fixed.
Cheers,
Rainer
>
> 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 : +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: address@hidden
Skype: RMkrug
pgpNAS8Cch3iW.pgp
Description: PGP signature
- Re: [O] Automatically adding local variables to tangled file, (continued)
- Re: [O] Automatically adding local variables to tangled file, Eric Schulte, 2013/06/06
- Re: [O] Automatically adding local variables to tangled file, Rainer M Krug, 2013/06/07
- Re: [O] Automatically adding local variables to tangled file, Rainer M Krug, 2013/06/07
- [O] [PATCH] Don't ask "File changed on disk" in org-babel-post-tangle-hook, Vitalie Spinu, 2013/06/07
- Re: [O] [PATCH] Don't ask "File changed on disk" in org-babel-post-tangle-hook, Eric Schulte, 2013/06/07
- Re: [O] [PATCH] Don't ask "File changed on disk" in org-babel-post-tangle-hook, Rainer M Krug, 2013/06/07
- Re: [O] Automatically adding local variables to tangled file, Eric Schulte, 2013/06/08
- Re: [O] Automatically adding local variables to tangled file, Achim Gratz, 2013/06/08
- Re: [O] Automatically adding local variables to tangled file, Eric Schulte, 2013/06/08
- Re: [O] Automatically adding local variables to tangled file, Rainer M Krug, 2013/06/10
- [O] Problem in tangle-mode -- WAS: Automatically adding local variables to tangled file,
Rainer M Krug <=
- Re: [O] Problem in tangle-mode -- WAS: Automatically adding local variables to tangled file, Eric Schulte, 2013/06/10
- [O] BUG - Problem in tangle-mode, Rainer M Krug, 2013/06/11
- Re: [O] BUG - Problem in tangle-mode, Eric Schulte, 2013/06/11
- Re: [O] BUG - Problem in tangle-mode, Rainer M Krug, 2013/06/11
- Re: [O] BUG - Problem in tangle-mode, Rainer M Krug, 2013/06/12
- Re: [O] BUG - Problem in tangle-mode, Eric Schulte, 2013/06/12
- Re: [O] BUG - Problem in tangle-mode, Rainer M Krug, 2013/06/13
- [O] SOLVED: Automatically adding local variables to tangled file, Rainer M Krug, 2013/06/10
Re: [O] Automatically adding local variables to tangled file, Thorsten Jolitz, 2013/06/05