From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Automatically adding local variables to tangled file Date: Sat, 08 Jun 2013 12:23:31 -0600 Message-ID: <8738ssmoyl.fsf@gmail.com> References: <878v2omz5g.fsf@krugs.de> <51af4bfd.0c95ec0a.2372.097e@mx.google.com> <87ehcf6xey.fsf@gmail.com> <87ehcewdye.fsf@krugs.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UlNyd-0001TH-Or for emacs-orgmode@gnu.org; Sat, 08 Jun 2013 14:35:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UlNyc-0004Ej-RE for emacs-orgmode@gnu.org; Sat, 08 Jun 2013 14:34:59 -0400 Received: from mail-pd0-f177.google.com ([209.85.192.177]:50198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UlNyc-0004EW-LG for emacs-orgmode@gnu.org; Sat, 08 Jun 2013 14:34:58 -0400 Received: by mail-pd0-f177.google.com with SMTP id p10so514883pdj.36 for ; Sat, 08 Jun 2013 11:34:57 -0700 (PDT) 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: Rainer M Krug Cc: emacs-orgmode@gnu.org >> >> 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. -- Eric Schulte http://cs.unm.edu/~eschulte