Re: [O] BUG - Problem in tangle-mode
Eric Schulte schulte.e...@gmail.com writes: Hi it seems that I have no luck at the moment. Now the post tangle hook does not seem to be called. It is called, however the shell script you are trying to execute is not executing because it is not set as executable. The permissions of tangled files are set *after* the post-tangle hook is called (so that the post-tangle hook has a chance to modify files which will eventually be set to read only). That makes perfect sense - thanks. You example is trying to run a tangled shell script before it is set to be executable. This can not work. My attached alternative of your example does run the shell script by not assuming it is executable. OK - I will adapt it accordingly. Thanks a lot, Rainer #+PROPERTY: tangle ./test.R * Internal configurations :noexport: ** Evaluate to run post tangle script #+begin_src emacs-lisp :results silent :tangle no :exports none (add-hook 'org-babel-post-tangle-hook (lambda () (message running the post-tangle shell script) (shell-command bash ./postTangleScript.sh))) #+end_src ** Post tangle script #+begin_src sh :tangle postTangleScript.sh :results silent touch PostTangleScriptHasBeenExecuted #+end_src * 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 #secure method=pgpmime mode=sign -- 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: rai...@krugs.de Skype: RMkrug
Re: [O] BUG - Problem in tangle-mode
Rainer M Krug r.m.k...@gmail.com writes: On Tuesday, June 11, 2013, Eric Schulte wrote: Rainer M Krug rai...@krugs.de javascript:; writes: Eric Schulte schulte.e...@gmail.com javascript:; writes: 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: Oh, stupid of me. Thanks for sending this alert, I've just pushed up a change which should fix this problem. We now wait to set the file modes until after all blocks are tangled and after the post-tangle-hook has been run. Thanks, Hi Unfortunately, it is now worse, as even without the tangle-mode header, I can't tangle two blocks - the second block overwrites the before tangled blocks. It tells me that two blocks were tangled, but only the last one is in the tangled file. I will for revert for now to the version from yesterday. Cheers, Just pushed up a fix. Cheers, Thanks. Will try it out tomorrow, Hi it seems that I have no luck at the moment. Now the post tangle hook does not seem to be called. If I use the file below, evaluate the code to set the hook, the hook is not executed. , | #+PROPERTY: tangle ./test.R | | * Internal configurations :noexport: | ** Evaluate to run post tangle script | #+begin_src emacs-lisp :results silent :tangle no :exports none | (add-hook 'org-babel-post-tangle-hook( | lambda () (call-process-shell-command ./postTangleScript.sh nil 0 nil)) | ) | #+end_src | | ** Post tangle script | #+begin_src sh :tangle postTangleScript.sh | touch PostTangleScriptHasBeenExecuted | #+end_src | | #+results: | | | * 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 ` The hook is set: , | Its value is | ((lambda nil |(call-process-shell-command ./postTangleScript.sh nil 0 nil))) | | Original value was nil ` Strangely enough, if I use , | #+begin_src emacs-lisp :tangle no | (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 () | | (when (string-match [.]R (buffer-file-name)) | (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) | #+end_src ` and evaluate this block (after resetting the post-tangle-hook), this function is executed? Sorry about all the hassles, Rainer Cheers, Rainer -- Eric Schulte http://cs.unm.edu/~eschulte -- 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: rai...@krugs.de Skype: RMkrug pgpML9UV3sGef.pgp Description: PGP signature
Re: [O] BUG - Problem in tangle-mode
Hi it seems that I have no luck at the moment. Now the post tangle hook does not seem to be called. It is called, however the shell script you are trying to execute is not executing because it is not set as executable. The permissions of tangled files are set *after* the post-tangle hook is called (so that the post-tangle hook has a chance to modify files which will eventually be set to read only). You example is trying to run a tangled shell script before it is set to be executable. This can not work. My attached alternative of your example does run the shell script by not assuming it is executable. #+PROPERTY: tangle ./test.R * Internal configurations :noexport: ** Evaluate to run post tangle script #+begin_src emacs-lisp :results silent :tangle no :exports none (add-hook 'org-babel-post-tangle-hook (lambda () (message running the post-tangle shell script) (shell-command bash ./postTangleScript.sh))) #+end_src ** Post tangle script #+begin_src sh :tangle postTangleScript.sh :results silent touch PostTangleScriptHasBeenExecuted #+end_src * 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 -- Eric Schulte http://cs.unm.edu/~eschulte
Re: [O] BUG - Problem in tangle-mode
Rainer M Krug rai...@krugs.de writes: Eric Schulte schulte.e...@gmail.com writes: 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: Oh, stupid of me. Thanks for sending this alert, I've just pushed up a change which should fix this problem. We now wait to set the file modes until after all blocks are tangled and after the post-tangle-hook has been run. Thanks, Hi Unfortunately, it is now worse, as even without the tangle-mode header, I can't tangle two blocks - the second block overwrites the before tangled blocks. It tells me that two blocks were tangled, but only the last one is in the tangled file. I will for revert for now to the version from yesterday. Cheers, Just pushed up a fix. Cheers, -- Eric Schulte http://cs.unm.edu/~eschulte
Re: [O] BUG - Problem in tangle-mode
On Tuesday, June 11, 2013, Eric Schulte wrote: Rainer M Krug rai...@krugs.de javascript:; writes: Eric Schulte schulte.e...@gmail.com javascript:; writes: 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: Oh, stupid of me. Thanks for sending this alert, I've just pushed up a change which should fix this problem. We now wait to set the file modes until after all blocks are tangled and after the post-tangle-hook has been run. Thanks, Hi Unfortunately, it is now worse, as even without the tangle-mode header, I can't tangle two blocks - the second block overwrites the before tangled blocks. It tells me that two blocks were tangled, but only the last one is in the tangled file. I will for revert for now to the version from yesterday. Cheers, Just pushed up a fix. Cheers, Thanks. Will try it out tomorrow, Cheers, Rainer -- Eric Schulte http://cs.unm.edu/~eschulte -- 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: rai...@krugs.de Skype: RMkrug