From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Problem in tangle-mode -- WAS: Automatically adding local variables to tangled file Date: Mon, 10 Jun 2013 12:12:25 +0200 Message-ID: <8761xmgtpy.fsf_-_@krugs.de> References: <878v2omz5g.fsf@krugs.de> <51af4bfd.0c95ec0a.2372.097e@mx.google.com> <87ehcf6xey.fsf@gmail.com> <87ehcewdye.fsf@krugs.de> <8738ssmoyl.fsf@gmail.com> <87k3m21jhc.fsf@krugs.de> 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]:42169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ulz5b-0005lq-4y for emacs-orgmode@gnu.org; Mon, 10 Jun 2013 06:12:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ulz5Y-0000hI-Ch for emacs-orgmode@gnu.org; Mon, 10 Jun 2013 06:12:39 -0400 Received: from mail-we0-x229.google.com ([2a00:1450:400c:c03::229]:50583) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ulz5Y-0000h2-6S for emacs-orgmode@gnu.org; Mon, 10 Jun 2013 06:12:36 -0400 Received: by mail-we0-f169.google.com with SMTP id n57so4744336wev.28 for ; Mon, 10 Jun 2013 03:12:35 -0700 (PDT) In-Reply-To: <87k3m21jhc.fsf@krugs.de> (Rainer M. Krug's message of "Mon, 10 Jun 2013 10:02:39 +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: Eric Schulte Cc: emacs-orgmode --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Rainer M Krug writes: > Eric Schulte 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 (=3D #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-r= ead-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=3D"= _") ) | } | #+end_src=20=20 |=20 | Block 2 | #+begin_src R | statDistName <- function(species){ | return( paste(species$layer, "disturbances_static", sep=3D"_") ) | } | #+end_src=20=20 `---- 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 =2D-=20 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: Rainer@krugs.de Skype: RMkrug --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJRtaaKAAoJENvXNx4PUvmCNFQH/3M+2hCy23yByy6MwbJeKFnX FeYEJnycjbHnJ06mN9cD9pATkoReW8mY+KVTvHKbO6V+nsGmiCtf5/u3YDKhOUcP Cm5YK3OBpqO/auRYaSsAGIlLidtuwzyHyGqLf7l1sycdYu+ZgGUTTCeIPuydYOrt Rilt9gQaQtwt9Kcp8bCgXMvd/enNzOPkOZUDFu4K7beHwt5nzOozlSEc0Z8uYJrH 1LCb8q/zlCuydp3Ag17xeD691RQ/l/JRSXuvjMvDpq5rD66Q6xcyogk52FKb1ajd yV0uyKoSUrHTqdebPyUuEkzKgDlwGXuhGXXuKM3yUaNSNMmEULFCSAtbCOnIQgc= =ZRfe -----END PGP SIGNATURE----- --=-=-=--